boot PowerPC ramdisk with u-boot

We use dhcp to transfer a combined image containing ramdisk and kernel. This is unpacked by u-boot and the kernel executed.

network boot ramdisk

inside u-boot

setenv loadaddr 0x800000
setenv bootargs 'console=ttyCPM2,19200 panic=30'
# setenv bootargs 'console=ttyS0,19200 panic=30'
dhcp
bootm

First we set a loadaddr. This is an memory address the transferred image will be saved before u-boot unpacks it. Unpacking of the kernel happens to address 0, it must be high enough that the unpacked kernel does not overwrite the ramdisk. The ramdisk is unpacked to the end of the memory.

Next we set the kernel parameters. We define a serial console (ttypCPM2 on CPU87, ttyS0 on CU824) and that we want to reboot in 30 seconds if we fail.

dhcp will retrieve an IP Adress and download the bootimage via tftp (if the server is correctly configured).

bootm unpacks the kernel und boots the system.

Historic note: setting a ramdisk size is no longer required. Since Oct 2014 an initramfs is used which dynamicly expands as required.

flash boot

it is possible to store the bootimage in the onboard flash banks.

The procedure has only be tested on CPU87. CU824 has a different flash layout so all adresses have to be adjusted

Note: The CPU87 kernel shows mtd partitions during boot. These partitions are hardcoded into the kernel and not adjusted to our flash banks (see drivers/mtd/maps/cpu87.c). We don't use any, as we don't write any data back to flash.
=> setenv flashbase 0xff000000
=> dhcp
=> erase $(flashbase) +$(filesize)
=> cp.b $(loadaddr) $(flashbase) $(filesize)
=> reset

First figure out the base address of the flash banks. The command flinfo might help.

Next fetch the bootimage. Please check the file fits the flashbank. CPU87 smaller then 8MB (0x800000). CU824 maybe 12MB, not sure.

Prepare the flashbanks. Flash must be erased before it can be written.

Copy into flash. Important note: use cp.b, this is binary, the normal cp counts in blocks

reset the system.

Run it from u-boot

setenv bootargs 'console=ttyCPM2,19200 panic=30'
# setenv bootargs 'console=ttyS0,19200 panic=30'
bootm 0xff000000

Example environment

ein beispiel environment
console=ttyCPM2
# console=ttyS0
ethact=FCC1 ETHERNET
# ethact=i82559#0
baudrate=19200
loadaddr=0x800000
flashbase=0xff000000

serial#=12345
ethaddr=00:40:42:cc:aa:bb
ethaddr1=00:40:42:cc:aa:bb
bootdelay=5
netdev=eth0
stdin=serial
stdout=serial
stderr=serial
bootargs=panic=10
add_console=setenv bootargs ${bootargs} console=${console},${baudrate}
add_nfs=setenv bootargs ${bootargs} root=/dev/nfs rw nfsroot=${serverip}:${rootpath}
add_ip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
bootcmd_flash=run add_console; bootm $(flashbase)
bootcmd_ram=dhcp; run add_console; bootm
bootcmd_nfs=dhcp; run add_console add_ip add_nfs; bootm
bootcmd=run bootcmd_ram

This topic: Frontend > WebHome > EmbeddedLinux > EmbeddedBootUBoot
Topic revision: 04 May 2015, ReginePfeil
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback