Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3247

Conditional boot with DLINK DNS325 original U-boot (1 reply)

$
0
0
Hello.

I am trying to do conditional booting (USB -> HDD -> NAND) using *only* original U-boot.
I tried this:

setenv uImageAddr 0xa00000;
setenv uInitramfsAddr '0xf00000'
# from USB
setenv usb_root 'LABEL=rootusb'
setenv usb_opts 'usb-storage.delay_use=0 rootdelay=10'
setenv usb_load_uImage 'ext2load usb 0:1 ${uImageAddr} /boot/uImage'
setenv usb_load_uInitramfs 'ext2load usb 0:1 ${uInitramfsAddr} /boot/uInitramfs'
setenv usb_setbootargs 'setenv bootargs console=ttyS0,115200 root=${usb_root} ${usb_opts} ${mtdparts} ${bootargs_end} ${bootopts}'
setenv boot_from_usb 'usb reset; run usb_load_uImage; run usb_load_uInitramfs; run usb_setbootargs; bootm ${uImageAddr} ${uInitramfsAddr}'
# from HDD
setenv hdd_root 'LABEL=roothdd'
setenv hdd_opts ''
setenv hdd_load_uImage 'ext2load ide 0:1 ${uImageAddr} /uImage'
setenv hdd_load_uInitramfs 'ext2load ide 0:1 ${uInitramfsAddr} /uInitramfs'
setenv hdd_setbootargs 'setenv bootargs console=ttyS0,115200 root=${hdd_root} ${hdd_opts} ${mtdparts} ${bootargs_end} ${bootopts}'
setenv boot_from_hdd 'ide reset; run hdd_load_uImage; run hdd_load_uInitramfs; run hdd_setbootargs; bootm ${uImageAddr} ${uInitramfsAddr}'
# NAND
setenv nand_setbootargs 'setenv bootargs root=/dev/ram console=ttyS0,115200 :::DB88FXX81:egiga0:none'
setenv boot_from_nand 'run nand_setbootargs; nand read.e 0xa00000 0x100000 0x300000;nand read.e 0xf00000 0x600000 0x300000;bootm 0xa00000 0xf00000'

# BOOTCMD
setenv bootcmd 'run boot_from_usb; run boot_from_hdd; run boot_from_nand'

Single commands (boot_from_usb or boot_from_hdd or boot_from_nand) just work.
Problem is that if it cannot find the 1st device (eg USB), it does not go to the following, instead it is trying some sort of "builtin" bootcmd, which I cannot understand where is coming from.


This is serial output, without 1st device (usb) attached
it gives bad partition (expected), but then it reads from nand ... why? shouldn't it try to execute next command?

Hit any key to stop autoboot:  0
(Re)start USB...
USB:   scanning bus for devices... 1 USB Device(s) found
       scanning bus for storage devices... 0 Storage Device(s) found
** Bad partition 1 **
** Bad partition 1 **
## Booting image at 00a00000 ...
Bad Magic Number

NAND read: device 0 offset 0x7100800, size 0x500000
load addr ....  =a00000

 5242880 bytes read: OK
## Booting image at 00a00000 ...
   Image Name:   Linux-2.6.22.18
   Created:      2011-05-25   7:23:15 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2214860 Bytes =  2.1 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK
## Loading Ramdisk Image at 00d00000 ...
   Image Name:   Ramdisk
   Created:      2011-07-11   5:47:12 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    1566183 Bytes =  1.5 MB
   Load Address: 00e00000
   Entry Point:  00e00000
   Verifying Checksum ... OK


Any help is appreciated ^_^
Thx!

Viewing all articles
Browse latest Browse all 3247

Trending Articles