NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 December 24, 2021 11:41AM |
Registered: 2 years ago Posts: 6 |
~ # cat /etc/fw_env.config # Configuration file for fw_(printenv/saveenv) utility. # Up to two entries are valid, in this case the redundand # environment sector is assumed present. # Notice, that the "Number of sectors" is ignored on NOR. # MTD device name Device offset Env. size Flash sector size Number of sectors # NAND example /dev/mtd1 0x0000 0x20000 0x20000 4
~ # cat /proc/mtd dev: size erasesize name mtd0: 00100000 00020000 "uboot" mtd1: 00080000 00020000 "uboot_env" mtd2: 00080000 00020000 "key_store" mtd3: 00080000 00020000 "info" mtd4: 00a00000 00020000 "etc" mtd5: 00a00000 00020000 "kernel_1" mtd6: 02fc0000 00020000 "rootfs1" mtd7: 00a00000 00020000 "kernel_2" mtd8: 02fc0000 00020000 "rootfs2"
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 December 24, 2021 03:28PM |
Admin Registered: 13 years ago Posts: 18,843 |
Quote
Note: for boxes such as Pogo V4 and Zyxel NSA3xx, the mtd partition definition are kept the same as stock definition, therefore is different from the one above.
If you don't have /etc/fw_env.config file in your system then go ahead and create this file with the above content. MTD parts are not important for booting and it can be adjusted later. For users who like to keep the stock mtd definition, there is no need to adjust it to the above definition. As long as mtd0 is defined as 1MB (0x00100000) or greater then it will be OK:
mtd0: 00100000 00020000 "u-boot"
> ~ # cat /proc/mtd > dev: size erasesize name > mtd0: 00100000 00020000 "uboot" > mtd1: 00080000 00020000 "uboot_env" > mtd2: 00080000 00020000 "key_store" > mtd3: 00080000 00020000 "info" > mtd4: 00a00000 00020000 "etc" > mtd5: 00a00000 00020000 "kernel_1" > mtd6: 02fc0000 00020000 "rootfs1" > mtd7: 00a00000 00020000 "kernel_2" > mtd8: 02fc0000 00020000 "rootfs2" >>
Quote
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
Quote
1. uBoot envs config should be defined as followed in your /etc/fw_env.config
cat /etc/fw_env.config
# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000
Quote
f. Adjust the DTB name to boot with a rootfs that has FDT kernel 3.17+ (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'
fw_setenv dtb_file '/boot/dts/kirkwood-nsa325.dtb'
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 December 26, 2021 04:20AM |
Registered: 2 years ago Posts: 6 |
[ 9.096906] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1 [ 9.104061] nand: Samsung NAND 128MiB 3,3V 8-bit [ 9.109398] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 [ 9.117739] Scanning device for bad blocks [ 9.219084] Bad eraseblock 1010 at 0x000007e40000 [ 9.225844] 9 fixed-partitions partitions found on MTD device orion_nand [ 9.233292] Creating 9 MTD partitions on "orion_nand": [ 9.239156] 0x000000000000-0x000000100000 : "uboot" [ 9.245291] mtdblock: MTD device 'uboot' is NAND, please consider using UBI block devices instead. [ 9.255839] 0x000000100000-0x000000180000 : "uboot_env" [ 9.262199] mtdblock: MTD device 'uboot_env' is NAND, please consider using UBI block devices instead. [ 9.273063] 0x000000180000-0x000000200000 : "key_store" [ 9.279455] mtdblock: MTD device 'key_store' is NAND, please consider using UBI block devices instead. [ 9.290309] 0x000000200000-0x000000280000 : "info" [ 9.296265] mtdblock: MTD device 'info' is NAND, please consider using UBI block devices instead. [ 9.306680] 0x000000280000-0x000000c80000 : "etc" [ 9.312554] mtdblock: MTD device 'etc' is NAND, please consider using UBI block devices instead. [ 9.322869] 0x000000c80000-0x000001680000 : "kernel_1" [ 9.329251] mtdblock: MTD device 'kernel_1' is NAND, please consider using UBI block devices instead. [ 9.340053] 0x000001680000-0x000004640000 : "rootfs1" [ 9.346477] mtdblock: MTD device 'rootfs1' is NAND, please consider using UBI block devices instead. [ 9.357175] 0x000004640000-0x000005040000 : "kernel_2" [ 9.363537] mtdblock: MTD device 'kernel_2' is NAND, please consider using UBI block devices instead. [ 9.374348] 0x000005040000-0x000008000000 : "rootfs2" [ 9.380730] mtdblock: MTD device 'rootfs2' is NAND, please consider using UBI block devices instead.
nanddump --omitoob -l 0x80000 -f mtd0 /dev/mtd0
flash_erase /dev/mtd0 0 4 nandwrite /dev/mtd0 stock_mtd0
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 December 26, 2021 03:22PM |
Admin Registered: 13 years ago Posts: 18,843 |
> nanddump --omitoob -l 0x80000 -f mtd0 /dev/mtd0 >>
> flash_erase /dev/mtd0 0 4 > nandwrite /dev/mtd0 stock_mtd0 >
nanddump --omitoob -f mtd0.nsa25.new /dev/mtd0
flash_erase /dev/mtd0 0 4 nandwrite /dev/mtd0 stock_mtd0
flash_erase /dev/mtd0 0 0 nandwrite /dev/mtd0 mtd0.nsa25.new
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 December 28, 2021 04:58AM |
Registered: 2 years ago Posts: 6 |
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 April 05, 2022 09:06AM |
Registered: 9 years ago Posts: 46 |
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 April 05, 2022 04:47PM |
Admin Registered: 13 years ago Posts: 18,843 |
Quote
3. Be sure to save your current uBoot image in mtd0, or have a backup image saved somewhere as precaution. And save your current u-boot envs with fw_printenv, or just copy/paste the listing into a text file. Note the nanddump command below allows future restoration to the same box you're backing up, and also can be used to restore a differrent box's mtd0 if needed.
Dumping NAND mtd0:
nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0
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.2017.07-tld-1.nsa325.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
nanddump --noecc --omitoob -l 0x80000 -f mtd0.stock /dev/mtd0
flash_erase /dev/mtd0 0 4 nandwrite /dev/mtd0 mtd0.stock
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 April 06, 2022 03:00AM |
Registered: 2 years ago Posts: 53 |
Re: NSA325v2 - A question and how to boot stock OS with uBoot 2017.07 April 06, 2022 03:27PM |
Admin Registered: 13 years ago Posts: 18,843 |