Re: how to backup/restore your NAND patitions and full device August 30, 2016 03:16PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device August 30, 2016 04:15PM |
Admin Registered: 13 years ago Posts: 18,853 |
Re: how to backup/restore your NAND patitions and full device August 30, 2016 05:24PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device August 30, 2016 06:20PM |
Admin Registered: 13 years ago Posts: 18,853 |
root@debian:/boot# mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=14202,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,relatime,size=24188k,mode=755) /dev/sda1 on / type ext2 ro,relatime,errors=continue,user_xattr,acl)
setenv set_bootargs_usb 'setenv bootargs console=$console root=$usb_root rootdelay=$rootdelay rootfstype=ext3 $mtdparts' boot
/dev/sda1 on / type ext3 rw,relatime,errors=continue,user_xattr,acl)
Quote
uboot.2016.05-tld-1.pogo_v4.bodhi.tar
md5:
0a16cbc707312d03b07094e4884be48b
sha256:
bb3b36527fdd76f3ddc130954d5aa47f53dc2f1b387ed623ddd15e33b0ef4c25
Re: how to backup/restore your NAND patitions and full device August 30, 2016 09:36PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device August 31, 2016 01:33PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device August 31, 2016 03:45PM |
Admin Registered: 13 years ago Posts: 18,853 |
printenv
Re: how to backup/restore your NAND patitions and full device September 01, 2016 12:39AM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 01, 2016 12:52PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 01, 2016 02:17PM |
Admin Registered: 13 years ago Posts: 18,853 |
umount /media/sdb1 e2fsck /dev/sdb1
Re: how to backup/restore your NAND patitions and full device September 02, 2016 06:46PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 03, 2016 12:55AM |
Admin Registered: 13 years ago Posts: 18,853 |
Quote
bodhi Wrote:
> You can now proceed to install u-boot if you feel
> like doing. But if the rootfs is RO then you need
> to copy u-boot image and uboot env image to the
> USB drive first, offline.
Re: how to backup/restore your NAND patitions and full device September 04, 2016 11:36AM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 04, 2016 04:31PM |
Admin Registered: 13 years ago Posts: 18,853 |
cat /proc/mtd dmesg | grep -i bad
Re: how to backup/restore your NAND patitions and full device September 05, 2016 01:54AM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 05, 2016 02:51AM |
Admin Registered: 13 years ago Posts: 18,853 |
Quote
6. Erase mtd0
flash_erase /dev/mtd0 0 4
Expected output:
Erase Total 4 Units
Performing Flash Erase of length 131072 at offset 0x60000 done
7. Write image to NAND
Among the nandwrite commands below, be extra careful and execute only one nandwrite command corresponding to your platform that you are installing to, using the kwb file that you have extracted in step 5. Please double check to make sure the file is for the correct platform. Especially the similar sounding names (e.g. nsa310s and nsa310 are different u-boots).
nandwrite /dev/mtd0 uboot.2016.05-tld-1.dockstar.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.goflexhome.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.goflexnet.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.iconnect.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.netgear_ms2110.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.pogo_e02.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.pogo_v4.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.sheevaplug.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.nsa320.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.nsa325.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.nsa310s.mtd0.kwb
nandwrite /dev/mtd0 uboot.2016.05-tld-1.nsa310.mtd0.kwb
Expected output:
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
8. Flashing default u-boot envs image:
As described in step 1, u-boot envs must be defined in etc/fw_env.config as
# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000
A special section (B. Flashing default u-boot envs image) about flashing default u-boot envs is included at the end of this installation procedure. Please follow the instruction in this section B to perform this step before continuing with step 9.
9. For sanity check, print out uBoot envs to see if they look OK.
fw_printenv
and then double check the ethaddr env again to be sure. Don't reboot if there is error while listing U-Boot envs.
10. Set up netconsole. It's important to set up neconsole if you don't already have serial console connected. If you've flashed the default environments in step 8 then activate netconsole with the following envs:
fw_setenv preboot_nc 'setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi'
fw_setenv preboot 'run preboot_nc'
fw_setenv ipaddr '192.168.0.xxx'
fw_setenv serverip '192.168.0.yyy'
where the 192.168.0.xxx is this plug IP address, and 192.168.0.yyy is the IP address of the netconsole server where it will monitor the output from the this plug (adjust them to the real values in your own local network settings).
11. Reboot. Upon reboot, in either serial console or netconsole, uBoot banner should show:
U-Boot 2016.05-tld-1 (Jun 12 2016 ….)
<your box name>
B. Flashing default u-boot envs image
This default envs image supports booting with multiple disk drives (and hubs) attached. The disk drives could be any type (usb, sata, sd card). The scanning logic and default envs were set to automatically boot the box with the following required configuration:
For whatever reason, if you can't set up your configuration to satisfy the following 4 requirements, then don't flash this defaut envs image. It might not boot properly. In this case, section C below can be used to tailor the envs to your specific configuration.
r1. There must be only one partition among all partitions from all drives that contains the kernel files. The 2 kernel files are /boot/uImage and /boot/uInitrd.
r2. The partition that contains the 2 kernel files must be partition 1 in a disk drive
r3. The partition that contains the rootfs must be labeled rootfs
r4. The rootfs partition is recommended to be type Ext3 (this is not a hard requirement, ext4 should boot OK, but Ext3 will ensure no problem).
So the bottom line is if you have only one rootfs in a single Ext3 partition, which is labeled as rootfs, then you're all set.
a. Download the default u-boot envs at Dropbox:
uboot.2016.05-tld-1.environment.bodhi.tar
md5:
3823eef10011b864859d31a76470e0e3
sha256:
c8db95a4225e8d78bdaaaa372bd5a87e4b98f3448dd9c62fc96c72b2df1a997c
This tarball includes 3 files:
uboot.2016.05-tld-1.environment.img (the default envs image to be flashed)
uboot.2016.05-tld-1.environment (the content of the default envs in text format)
uboot.2016.05-tld-1.environment.64K.img (small envs image to be flashed on HP T5325 only).
b. Extract the archive to /tmp
cd /tmp
tar -xf uboot.2016.05-tld-1.environment.bodhi.tar
c. Save current envs with fw_printenv, or just copy/paste the listing into a text file.
fw_printenv > current_envs.txt
d. Flash u-boot envs to NAND location 0xC0000.
Be extra careful with the next 2 commands, you should see output that look like below. If there is error, then do not reboot, post your problem here so we can help.
/usr/sbin/flash_erase /dev/mtd0 0xc0000 1
Expected output:
Erase Total 1 Units
Performing Flash Erase of length 131072 at offset 0xc0000 done
/usr/sbin/nandwrite -s 786432 /dev/mtd0 uboot.2016.05-tld-1.environment.img
Expected output:
Writing data to block 6 at offset 0xc0000
e. Modify the following u-boot variables using fw_setenv:
Note that setting arcNumber and machid are not necessary if you are booting with FDT kernel 3.17+ in the latest kernel and rootfs thread. But it's required for non-FDT kernel.
Also note that only some boxes need machid, some don't (so the command fw_setenv machid below clears them).
for Pogo V4/Mobile:
fw_setenv arcNumber 3960
fw_setenv machid f78
for iConnect:
fw_setenv arcNumber 2870
fw_setenv machid
for Stora:
fw_setenv arcNumber 2743
fw_setenv machid
for Dockstar:
fw_setenv arcNumber 2998
fw_setenv machid
for Pogo E02:
fw_setenv arcNumber 3542
fw_setenv machid dd6
for GoFlex Home:
fw_setenv arcNumber 3338
fw_setenv machid
for GoFlex Net:
fw_setenv arcNumber 3089
fw_setenv machid
for Sheevaplug:
fw_setenv arcNumber 2097
fw_setenv machid
for NSA325:
fw_setenv arcNumber 4495
fw_setenv machid
for NSA320:
fw_setenv arcNumber 3956
fw_setenv machid
for NSA310S/320S:
fw_setenv arcNumber 4931
fw_setenv machid
for NSA310:
fw_setenv arcNumber 4022
fw_setenv machid
Then for all boxes, restore these 2 envs using the saved envs text in step c (replace xxx with the real saved values)
fw_setenv mtdparts 'xxxxxxxxx'
fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'
Note: for boxes that boot with SATA as rootfs. Please make this adjustment if your boot drive is SATA:
fw_setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3'
(This will help the "ide reset" to work properly. There seems to be a bug in u-boot that if you do "ide reset" too quickly in succession, the SATA drive might have problem spinning up).
f. Adjust the DTB name to boot with a rootfs that has FDT kernel (this is the normal case):
Find your box DTB file in the rootfs /boot/dts directory and adjust the env to it. For example, if the box is the Dockstar
fw_setenv dtb_file '/boot/dts/kirkwood-dockstar.dtb'
In the special case when you are booting with a non-FDT kernel, or if you have appended the DTB to uImage. Remove the DTB file env. If not sure please post question before continuing.
fw_setenv dtb_file
h. List you envs again to make sure you've not missed any of the old envs that you might have adjusted to your box. Now is the time to restore those box- specific u-boot envs. Hint: if you changed u-boot envs while in Debian with fw_setenv, fw_printenv will list the modified envs at the end of the output.
fw_printenv
If there is error in listing u-boot envs, stop here and post your problem so we can help.
Remember to save away your old envs text file created in step c for future reference in case more need to be restored.
i. Done.
Re: how to backup/restore your NAND patitions and full device September 05, 2016 02:17PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 05, 2016 04:00PM |
Admin Registered: 13 years ago Posts: 18,853 |
which nandwrite which flash_erase which fw_setenv which fw_printenv
Re: how to backup/restore your NAND patitions and full device September 05, 2016 10:42PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 05, 2016 11:57PM |
Admin Registered: 13 years ago Posts: 18,853 |
# this has OOB written to the file, so it is greater than 2MB nanddump -nf usb/mtd0 /dev/mtd0 # this has OOB so it was written back to NAND differently nandwrite -on /dev/mtd0 mtd0
# this does not have OOB written to the file, (it's 2MB for the Pogo V4 if you obmit the length -l) nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0 # this did not mention OOB, because the default is no-OOB nandwrite /dev/mtd0 mtd0
Re: how to backup/restore your NAND patitions and full device September 06, 2016 02:08AM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 06, 2016 03:27AM |
Admin Registered: 13 years ago Posts: 18,853 |
nandwrite --help flash_erase --help
Re: how to backup/restore your NAND patitions and full device September 06, 2016 11:18PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 07, 2016 12:08AM |
Admin Registered: 13 years ago Posts: 18,853 |
Re: how to backup/restore your NAND patitions and full device September 07, 2016 01:51AM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 07, 2016 02:05PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 08, 2016 02:29PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 08, 2016 08:19PM |
Admin Registered: 13 years ago Posts: 18,853 |
Re: how to backup/restore your NAND patitions and full device September 08, 2016 09:53PM |
Registered: 8 years ago Posts: 102 |
Re: how to backup/restore your NAND patitions and full device September 09, 2016 02:05AM |
Admin Registered: 13 years ago Posts: 18,853 |