Re: Dual boot with Openwrt on NAND April 23, 2018 12:42AM |
Registered: 11 years ago Posts: 58 |
U-Boot 2017.07-tld-1 (Oct 24 2017 - 22:32:36 -0700) Seagate FreeAgent DockStar SoC: Kirkwood 88F6281_A0 DRAM: 128 MiB WARNING: Caches not enabled NAND: 256 MiB In: serial Out: serial Err: serial Net: egiga0 88E1116 Initialized on egiga0 Using egiga0 device ping failed; host 192.168.180.21 is not alive Hit any key to stop autoboot: 0 DockStar> setenv bootcmd_exec 'if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; fi' DockStar> saveenv Saving Environment to NAND... Erasing NAND... Erasing at 0xc0000 -- 100% complete. Writing to NAND... OK DockStar> reset resetting ... U-Boot 2017.07-tld-1 (Oct 24 2017 - 22:32:36 -0700) Seagate FreeAgent DockStar SoC: Kirkwood 88F6281_A0 DRAM: 128 MiB WARNING: Caches not enabled NAND: 256 MiB In: serial Out: serial Err: serial Net: egiga0 88E1116 Initialized on egiga0 Using egiga0 device ping failed; host 192.168.180.21 is not alive Hit any key to stop autoboot: 0 ## Error: "bootcmd_uenv" not defined ## Error: "scan_disk" not defined ## Error: "set_bootargs" not defined ## Error: "load_uimage" not defined invalid partition number 2 for device nand0 (orion_nand) no such partition ubi0: attaching mtd1 ubi0: scanning is finished ubi0: attached mtd1 (name "mtd=1", size 255 MiB) ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512 ubi0: VID header offset: 512 (aligned 512), data offset: 2048 ubi0: good PEBs: 2039, bad PEBs: 1, corrupted PEBs: 0 ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128 ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 1517712165 ubi0: available PEBs: 8, total reserved PEBs: 2031, PEBs reserved for bad PEB handling: 39 Read 0 bytes from volume kernel to 800000 No size specified -> Using max size (1935360) ## Booting kernel from Legacy Image at 00800000 ... Image Name: ARM LEDE Linux-4.4.92 Created: 2017-10-17 17:46:20 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1810212 Bytes = 1.7 MiB ... BusyBox v1.25.1 () built-in shell (ash) _________ / /\ _ ___ ___ ___ / LE / \ | | | __| \| __| / DE / \ | |__| _|| |) | _| /________/ LE \ |____|___|___/|___| lede-project.org \ \ DE / \ LE \ / ----------------------------------------------------------- \ DE \ / Reboot (17.01.4, r3560-79f57e422d) \________\/ ----------------------------------------------------------- === WARNING! ===================================== There is no root password defined on this device! Use the "passwd" command to set up a new password in order to prevent unauthorized SSH logins. -------------------------------------------------- root@LEDE:/#
invalid partition number 2 for device nand0 (orion_nand)
Re: Dual boot with Openwrt on NAND April 23, 2018 12:50AM |
Admin Registered: 13 years ago Posts: 18,898 |
> invalid partition number 2 for device nand0 > (orion_nand) >
setenv partition 'nand0,0'
Re: Dual boot with Openwrt on NAND April 23, 2018 02:37PM |
Registered: 11 years ago Posts: 58 |
Re: Dual boot with Openwrt on NAND April 23, 2018 06:03PM |
Admin Registered: 13 years ago Posts: 18,898 |
## Booting kernel from Legacy Image at 00800000 ... Image Name: ARM LEDE Linux-4.4.92 Created: 2017-10-17 17:46:20 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1810212 Bytes = 1.7 MiB
## Error: "bootcmd_uenv" not defined ## Error: "scan_disk" not defined ## Error: "set_bootargs" not defined ## Error: "load_uimage" not defined
cat /proc/mtd cat /etc/fw_env.config printenv
Re: Dual boot with Openwrt on NAND April 24, 2018 12:48AM |
Registered: 11 years ago Posts: 58 |
root@LEDE:/# cat /proc/mtd dev: size erasesize name mtd0: 00100000 00020000 "u-boot" mtd1: 0ff00000 00020000 "ubi" root@LEDE:/# cat /etc/fw_env.config /dev/mtd1 0x0 0x20000 0x20000 root@LEDE:/# printenv /bin/ash: printenv: not found root@LEDE:/#Back to uboot:
DockStar> printenv arcNumber=2998 baudrate=115200 bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_lede bootcmd_exec=if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; fi bootcmd_lede=run set_bootargs_lede; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000 bootdelay=3 console=ttyS0,115200 dtb_file=/boot/dts/kirkwood-dockstar.dtb ethact=egiga0 ethaddr=00:10:75:1A:DD:17 fileaddr=800000 filesize=20000 force_rescue=0 force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi if_netconsole=ping $serverip ipaddr=192.168.180.64 led_error=orange blinking led_exit=green off led_init=green blinking mainlineLinux=yes mtdids=nand0=orion_nand mtdparts=mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi) partition=nand0,0 pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi preboot=run if_netconsole start_netconsole rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi rescue_installed=1 rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params serverip=192.168.180.21 set_bootargs_lede=setenv bootargs console=ttyS0,115200 $mtdparts start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version; stderr=serial stdin=serial stdout=serial ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi ubifs_mtd=3 ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot usb_device=0:1 usb_init=run usb_scan usb_root=/dev/sda1 usb_rootdelay=10 usb_rootfstype=ext2 usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done usb_scan_1=usb=0:1 dev=sda1 usb_scan_2=usb=1:1 dev=sdb1 usb_scan_3=usb=2:1 dev=sdc1 usb_scan_4=usb=3:1 dev=sdd1 usb_scan_list=1 2 3 4 usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params Environment size: 3093/131068 bytes DockStar>
Re: Dual boot with Openwrt on NAND April 24, 2018 03:14AM |
Admin Registered: 13 years ago Posts: 18,898 |
root@LEDE:/# cat /etc/fw_env.config /dev/mtd1 0x0 0x20000 0x20000
# MTD device name Device offset Env. size Flash sector size Number of sectors /dev/mtd0 0xc0000 0x20000 0x20000
Quote
8. Flashing default u-boot envs image (if you are upgrading from 2016.05-tld-1 u-boot, you can skip this step 8).
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
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 arcNumber and machid are not necessary if you are booting with FDT kernel 3.17+ in the latest kernel and rootfs thread. But it does not hurt to set them anyway.
archNumber and machid are required for non-FDT kernel (3.16.x or earlier)
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 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'
In the special case when you are booting with a non-FDT kernel 3.16 or earlier, 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. For sanity check, list you envs again
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 step 8.
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.
Re: Dual boot with Openwrt on NAND April 24, 2018 03:20AM |
Registered: 10 years ago Posts: 94 |
Quote
What I think you should do is to flash new u-boot envs image in LEDE, and reapply joerg envs setting (also at LEDE shell). You could try to fix them, but to start clean, flashing the correct default envs will be quicker.
Quote
# With the new u-boot, /etc/fw_env.config should be:
# MTD device name Device offset Env. size Flash sector size Number of sectors /dev/mtd0 0xc0000 0x20000 0x20000
Thats correct, and that was also my fault to cannot edit the envs from LEDE, thank you again bodhi
/dev/mtd0 0xc0000 0x20000 0x20000
-------------------------------------------------------------------------------- # original uboot-envs uboot.2016.05-tld-1.environment.img # universal -------------------------------------------------------------------------------- tftpboot 0x800000 uboot.2016.05-tld-1.environment.img nand erase 0xc0000 0x20000 nand write.e 0x800000 0xc0000 0x20000 reset # @uboot Dockstar: setenv ethaddr <ethaddr Userbox> setenv arcNumber 2998 setenv machid setenv dtb_file '/boot/dts/kirkwood-dockstar.dtb' saveenv reset# try to boot your debian USB stick at this point
# @debian fw_setenv mtdparts 'mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)' fw_setenv partition 'nand0,0' fw_setenv set_bootargs_lede 'setenv bootargs console=ttyS0,115200 $mtdparts' fw_setenv bootcmd_lede 'run set_bootargs_lede; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000' fw_setenv bootcmd 'run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_lede' fw_setenv bootcmd_exec 'if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; fi'
# uboot-envs for dockstar ================================================================================ root@LEDE:/# cat /etc/fw_env.config /dev/mtd0 0xc0000 0x20000 0x20000 fw_printenv arcNumber=2998 bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_lede bootcmd_exec=if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; fi bootcmd_lede=run set_bootargs_lede; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000 bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi bootdelay=5 bootdev=usb device=0:1 devices=usb ide mmc disks=0 1 2 3 dtb_file=/boot/dts/kirkwood-dockstar.dtb ethact=egiga0 ethaddr=00:25:31:xx:yy:zz if_netconsole=ping $serverip init_ide=ide reset init_mmc=mmc rescan init_usb=usb start ipaddr=192.168.0.231 led_error=orange blinking led_exit=green off led_init=green blinking load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file load_dtb_addr=0x1c00000 load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd load_initrd_addr=0x1100000 load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage load_uimage_addr=0x800000 mainlineLinux=yes mtdids=nand0=orion_nand mtdparts=mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi) partition=nand0,0 preboot_nc=run if_netconsole start_netconsole scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start"; setenv scan_ide "ide reset"; setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done scan_ide=ide reset scan_mmc=mmc rescan scan_usb=usb start serverip=192.168.0.220 set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params set_bootargs_lede=setenv bootargs console=ttyS0,115200 $mtdparts start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version; stderr=serial stdin=serial stdout=serial uenv_addr=0x810000 uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize uenv_init_devices=setenv init_usb "usb start"; setenv init_ide "ide reset"; setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done; uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices; do for disknum in 0; do run uenv_read_disk; done; done; uenv_loaded=0 uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read; fi; else if $devtype part $disknum; then run uenv_read; fi; fi usb_ready_retry=15
Re: Dual boot with Openwrt on NAND April 24, 2018 03:02PM |
Registered: 11 years ago Posts: 58 |
Re: Dual boot with Openwrt on NAND April 24, 2018 03:32PM |
Registered: 10 years ago Posts: 94 |
Re: Dual boot with Openwrt on NAND April 24, 2018 07:11PM |
Admin Registered: 13 years ago Posts: 18,898 |
Re: Dual boot with Openwrt on NAND April 25, 2018 10:04PM |
Admin Registered: 13 years ago Posts: 18,898 |
Re: Dual boot with Openwrt on NAND April 26, 2018 03:03AM |
Registered: 10 years ago Posts: 94 |
Re: Dual boot with Openwrt on NAND April 26, 2018 03:40AM |
Admin Registered: 13 years ago Posts: 18,898 |