Some questions about uImage, zImage and initramfs...

This forum is for supported devices using an ARMv7 Allwinner SoC.

Some questions about uImage, zImage and initramfs...

Postby starfry » Fri Jan 23, 2015 9:03 pm

The default sunxi boot.scr for ArchLinuxARM includes provision for booting from zImage as well as uImage and it will boot zImage in preference to uImage if both exist.

To boot zImage, an additional file "/boot/dtbs/${fdtfile}" is required and "/boot/initramfs-linux.img" is optional.

I have a couple of questions...

There is no provision for an initramfs when booting uImage. Is this is because uImage files can contain the kernel AND the initramfs images? If it is, and such an image is presented to U-Boot, does bootm automatically invoke such an initramfs when called (e.g bootm ${kernel_addr_r}) ?

If that is correct, is it documented anywhere how to produce such a uImage ?

My other question is about using zImage. I'd like to understand how this works. Why do I need the fdt file (and where do I get it - there isn't one in the linux-sunxi package for the cubieboard2) ? Why doesn't bootm need it, given the embedded kernel image is the same? Is script.bin doing the same thing and, if so, can that be used with bootz ?

I tried extracting a working zImage from a uImage and booting it with a command-line like the below but it didn't work

$this->bbcode_second_pass_code('', 'mmc dev 0
load mmc 0:1 ${kernel_addr_r} /boot/zImage
setenv bootargs console=${console} root=/dev/sda6 rw rootwait
bootz ${kernel_addr_r}')
starfry
 
Posts: 24
Joined: Wed Jul 18, 2012 7:24 pm

Re: Some questions about uImage, zImage and initramfs...

Postby sehraf » Sun Jan 25, 2015 1:25 pm

ok long story short:

have a look at the boot.scr file
$this->bbcode_second_pass_code('', 'if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
bootz ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi
')
is for mainline kernel. The kernel itself comes as a compress image (-> zImage) while the DTB (this /boot/dtbs/${fdtfile} thingy) is loaded on it's own. This is the default / preferred behavior.

sehraf

while the rest of the file is for old kernels / backward compatibility
$this->bbcode_second_pass_code('', 'if load ${devtype} ${devnum}:${bootpart} 0x48000000 /boot/uImage; then
if load ${devtype} ${devnum}:${bootpart} 0x43000000 /boot/script.bin; then
setenv bootm_boot_mode sec;
bootm 0x48000000;
fi;
fi')
The uImages provided by Arch Linux ARM include the DTB in the uImage for compatibility reasons.

I don't know if uImages can contains an initramfs as well - usually you would load everything into the RAM (kernal, initramfs and DTB separately) and then use bootm *kernel address* *initramfs address* *DTB address* (or without an initramfs just bootm *kernel address* - *DTB address*)

regarding the DTB you may have a looks here http://events.linuxfoundation.org/sites ... ummies.pdf (especially slide 8). You get this file when building a kernel. The sources can be found here https://github.com/torvalds/linux/tree/ ... m/boot/dts
sehraf
 
Posts: 69
Joined: Mon Feb 03, 2014 10:06 pm

Re: Some questions about uImage, zImage and initramfs...

Postby WarheadsSE » Mon Jan 26, 2015 3:21 pm

uImage does not contain an initrd.

We (Arch Linux ARM) do not ship and initrd in any form, for any device.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm


Return to Allwinner

Who is online

Users browsing this forum: No registered users and 8 guests