I am using U-Boot on a Cubieboard 2, sun7i AllWinner A20 board to boot into ArchLinux ARM. The kernel version that I have is the sun7i latest, which is 3.4.103-5-ARCH so, in kernel terms, it's a bit behind the times but it is the most recent from the repos.

I am learning about U-Boot and would like to see if I can boot using a zImage. I already have a uImage that works. This is an exercise to understand its operation.

One reason for doing this is that the boot.txt shipped with ArchLinuxARM contains code to boot with an initramfs-linux.img but only if a zImage is used (the shipped code doesn't cater for an initramfs with a uImage).

I am not asking how to boot an initrams with a uImage - I know how to do that. I am asking how to use a zImage with U-Boot.

My uImage has this header:

# mkimage -l uImage 
Image Name:   Linux-3.4.103-5-ARCH
Created:      Fri Jan 16 13:34:10 2015
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3327616 Bytes = 3249.62 kB = 3.17 MB
Load Address: 40008000
Entry Point:  40008000

I can boot it manually with the following command sequence:

mmc dev 0
load mmc 0:1 0x48000000 /boot/uImage
load mmc 0:1 0x43000000 /boot/script.bin
setenv bootargs console=${console} root=/dev/sda6 rw rootwait
setenv bootm_boot_mode sec 
bootm 0x48000000

I extract the zImage from the uImage like this:

$ tail -c+65 < uImage > zImage

I check it looks ok

$ file zImage
zImage: Linux kernel ARM boot executable zImage (little-endian)

I then try booting it

mmc dev 0
load mmc 0:1 0x42000000 /boot/zImage
setenv bootargs console=${console} root=/dev/sda6 rw rootwait
bootz 0x42000000

But it doesn't work. All I see is "

Kernel image @ 0x42000000 [ 0x000000 - 0x32c680 ]
Starting kernel ...

I presume it's something to do with the script.bin that I load prior to bootm. If tried loading it prior to bootz but it made no difference. I also read abot a FDT file but I don't think the Arch Linix kernel package provides one. Nonetheless, bootm didn't need one so I would expect that bootz doesn't either (given the kernel image is the same).

To be sure my zimage was ok, I made a new uImage from it and it booted fine.

I derived the above commands and addresses from the boot.txt shipped with ArchLinuxARM.

My U-boot version is:

U-Boot 2015.01-1 (Jan 22 2015 - 16:37:34) Arch Linux ARM
gcc (GCC) 4.9.2 20141224 (prerelease)
GNU ld (GNU Binutils) 2.25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.