75XX XNAND Recovery: Difference between revisions

From embeddedTS Manuals
No edit summary
m (Links auto-updated for 2022 re-branding ( https://files.embeddedarm.com/ts-arm-sbc/ts-7500-linux/binaries/ts-images/xnandimg-latest.dd.bz2 →‎ https://files.embeddedTS.com/ts-arm-sbc/ts-7500-linux/binaries/ts-images/xnandimg-latest.dd.bz2))
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This needs to be done directly on the SBC.  Please note that all NBD partitions from the NAND card must be dismounted before attempting to image the NAND on the SBC.
This needs to be done directly on the SBC.  If you are running from the SD card the XNAND will not be mounted by default.  You can also boot to the initrd of the XNAND and unmount the xnand:
<source lang=bash>
umount /mnt/root
</source>
 
If there is no /mnt/root/ directory then the system is still booted to Debian and you should not proceed with the backup/restore sections.  The image that is written or read back will be corrupt.


You can find the latest xnand image [ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7500-linux/binaries/ts-images/xnandimg-latest.dd.bz2 here].  Make sure you decompress the image first before writing.
{{Warning|Rewriting the XNAND from a Debian filesystem on the XNAND will result in a corrupted image.}}
 
You can find the latest xnand image [https://files.embeddedTS.com/ts-arm-sbc/ts-7500-linux/binaries/ts-images/xnandimg-latest.dd.bz2 here].   
Once downloaded you can decompress the image using bzip2:
<source lang=bash>
bzip2 -d xnandimg-latest.dd.bz2
</source>
The resulting file will be "xnandimg-latest.dd".


'''Backup'''
'''Backup'''


Entire Image
To create the image first connect a USB drive and then power the device on.  Boot to the busybox environment and not the full Debian.  The USB drive should be formatted with ext2/3 or fat32.
 
<source lang=bash>
killall nandctl
mkdir /mnt/usb
mount /dev/sda1 /mnt/usb
nandctl -XR 2048 -z 131072 > /mnt/usb/backup.dd
umount /mnt/usb
sync
</source>
 
To backup the entire image containing the MBR/Kernel/Initrd/Debian you can run one command:
<source lang=bash>
<source lang=bash>
nandctl -XR 2048 -z 131072 > /path/to/backup.dd
nandctl -XR 2048 -z 131072 > /path/to/backup.dd
</source>
</source>


Kernel
To backup the current kernel:
<source lang=bash>
<source lang=bash>
nandctl -XR 4096 -z 512 --seek part1 > /path/to/kernel
nandctl -XR 4096 -z 512 --seek part1 > /path/to/kernel
</source>
</source>


Initrd
To backup the initrd:
<source lang=bash>
<source lang=bash>
nandctl -XR 4096 -z 512 --seek part2 > /path/to/initrd
nandctl -XR 4096 -z 512 --seek part2 > /path/to/initrd
Line 22: Line 45:
'''Restore'''
'''Restore'''


Entire Image
To write the image first connect a USB drive with the image and then power the device on.  Boot to the busybox environment and not the full Debian.  The USB drive should be formatted with ext2/3 or fat32.
<source lang=bash>
killall nandctl
mkdir /mnt/usb
mount /dev/sda1 /mnt/usb
nandctl -XW 2048 -z 131072 -i /mnt/usb/backup-image.dd
umount /mnt/usb
sync
</source>
 
To write the entire image containing the MBR/Kernel/Initrd/Debian you can run one command:
<source lang=bash>
<source lang=bash>
nandctl -XW 2048 -z 131072 -i /path/to/xnandimg-latest.dd
nandctl -XW 2048 -z 131072 -i /path/to/xnandimg-latest.dd
</source>
</source>


Kernel
To write a new kernel:
<source lang=bash>
<source lang=bash>
nandctl -XW 4096 -z 512 --seek part1 -i /path/to/kernel
dd if=zImage bs=512 conv=sync | nandctl -X -W 4095 -k kernel -z 512 -i -</source>
</source>


Initrd
To write a new initrd:
<source lang=bash>
<source lang=bash>
nandctl -XW 4096 -z 512 --seek part2 -i /path/to/initrd
dd if=initrd bs=512 conv=sync | nandctl -X -W 4095 -k initrd -z 512 -i -
</source>
</source>

Latest revision as of 16:27, 17 January 2022

This needs to be done directly on the SBC. If you are running from the SD card the XNAND will not be mounted by default. You can also boot to the initrd of the XNAND and unmount the xnand:

umount /mnt/root

If there is no /mnt/root/ directory then the system is still booted to Debian and you should not proceed with the backup/restore sections. The image that is written or read back will be corrupt.

WARNING: Rewriting the XNAND from a Debian filesystem on the XNAND will result in a corrupted image.

You can find the latest xnand image here. Once downloaded you can decompress the image using bzip2:

bzip2 -d xnandimg-latest.dd.bz2

The resulting file will be "xnandimg-latest.dd".

Backup

To create the image first connect a USB drive and then power the device on. Boot to the busybox environment and not the full Debian. The USB drive should be formatted with ext2/3 or fat32.

killall nandctl
mkdir /mnt/usb
mount /dev/sda1 /mnt/usb
nandctl -XR 2048 -z 131072 > /mnt/usb/backup.dd
umount /mnt/usb
sync

To backup the entire image containing the MBR/Kernel/Initrd/Debian you can run one command:

nandctl -XR 2048 -z 131072 > /path/to/backup.dd

To backup the current kernel:

nandctl -XR 4096 -z 512 --seek part1 > /path/to/kernel

To backup the initrd:

nandctl -XR 4096 -z 512 --seek part2 > /path/to/initrd

Restore

To write the image first connect a USB drive with the image and then power the device on. Boot to the busybox environment and not the full Debian. The USB drive should be formatted with ext2/3 or fat32.

killall nandctl
mkdir /mnt/usb
mount /dev/sda1 /mnt/usb
nandctl -XW 2048 -z 131072 -i /mnt/usb/backup-image.dd
umount /mnt/usb
sync

To write the entire image containing the MBR/Kernel/Initrd/Debian you can run one command:

nandctl -XW 2048 -z 131072 -i /path/to/xnandimg-latest.dd

To write a new kernel:

dd if=zImage bs=512 conv=sync | nandctl -X -W 4095 -k kernel -z 512 -i -

To write a new initrd:

dd if=initrd bs=512 conv=sync | nandctl -X -W 4095 -k initrd -z 512 -i -