Welcome to the Slackware Documentation Project

This is an old revision of the document!


Making it easy for u-boot to find uImage and uinitrd

I often fiddle with testing root images, kernels and initrd on my kirkwood based systems by using usb flash sticks. I found that although Jeff did a brilliant job on uboot his default environment was unable to directly boot all my testing images.

I made myself a custom environment that was more flexible and allowed me to boot from any usb port as long as the following limitations are met:

  • the kernel must be called uImage or must be linked with that name
  • the initrd must be called uinitrd or must be linked with that name
  • uImage and uinitrd must be contained in the first 4 detected usb devices
  • uImage and uinitrd must be in the root or in a boot sub-directory in the device that holds them
  • the root filesystem bust be labelled “root”

Heres the environment dumped from fw_printenv:

arcNumber=3089
baudrate=115200
boot_flash_kernel=nand read $flash_kernel_load_addr $flash_kernel_offest $flash_kernel_size; bootm $flash_kernel_load_addr
bootargs=console=ttyS0,115200 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data) root=/dev/sda2 ro rootfstype=ext2
bootcmd=run usb_scan; run set_flash_bootargs; run boot_flash_kernel
bootdelay=3
console=console=ttyS0,115200
ethact=egiga0
ethaddr=<put here your mac address>
flash_kernel_load_addr=0x6400000
flash_kernel_offest=0x100000
flash_kernel_size=0x300000
flash_root_fs=root=/dev/mtdblock2
flash_root_fstype=rootfstype=jffs2
led_error=orange blinking
led_exit=green off
led_init=green blinking
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
root_fs=root=LABEL=root
rootfstype=rootfs=ext3
sb_scan_1=usb=0:2 dev=sda2
set_flash_bootargs=setenv bootargs ${console} ${mtdparts} ${flash_root_fs} ro ${flash_root_fstype}
set_usb_bootargs=setenv bootargs ${console} ${mtdparts} ${root_fs} ro ${root_fstype}
stderr=serial
stdin=serial
stdout=serial
usb_boot_6=setenv root_fs root=/dev/sdg${usb_dev_part}
usb_dev_list=3 2 1 0
usb_dev_part=1
usb_part_list=4 3 2 1
usb_scan=usb start; setenv usb_boot_dev none; for dev in  $usb_dev_list; do test $dev -eq 0 && setenv devname /dev/sda ; test $dev -eq 1 &&  setenv devname /dev/sdb ; test $dev -eq 2 && setenv devname /dev/sdc ; test $dev -eq 3 && setenv devname /dev/sdd ; echo $devname ; for part in $usb_part_list; do echo $dev $part ; if ext2load usb ${dev}:$part 0x800000 /boot/uImage 10 ; then setenv usb_boot_dev $dev:$part ; setenv usb_boot_dir /boot ; fi  ; if ext2load usb ${dev}:$part 0x800000 /uImage 10 ; then setenv usb_boot_dev $dev:$part ; setenv usb_boot_dir ; fi  ; done; done; if test "$usb_boot_dev" = "none" ; then echo "No USB bootable device found" ; else echo "USB device $usb_boot_dev is bootable" ; setenv bootargs $console $mtdparts $root_fs ro $rootfstype ; echo $bootargs ; sleep 1; ext2load usb $usb_boot_dev 0x800000 $usb_boot_dir/uImage && setenv usb_boot_address 0x800000 ; ext2load usb $usb_boot_dev 0x1100000 $usb_boot_dir/uinitrd && setenv usb_boot_address 0x800000 0x1100000 ; 

bootm $usb_boot_address ; fi;

Sources


In Other Languages
Translations of this page?:
QR Code
QR Code howtos:hardware:arm:sone_u-boot_hints (generated for current page)