Skip to contentSkip to conversation

initrd and uImage

DISCUSSION Fundu 5 participants 5 messages Aug 8, 2008 – Aug 11, 2008

lore
Share & tools
lore

Fundu

author
#0 lore raw

Hi,
First off i have a ppc based board.
and i'm trying to load a kernel image with ramdisk rootfs.

i have build the kernel. it spit uImage,zImage and vmlinux.gz

my question are.
1) what are all the different image types ?
i know the uImage is just the kernel, what are the rest (zImage & vmlinux.gz)?

2) i'm using u-boot as the bootldr. so i download the uImage (cause zImage and vmlinux.gz aren't bootlable) from tftp server and then do bootm <address> the kernel only load partially. How does the kernel know where/how to load the rootfs ?

thanks !

#1 lore raw
Quoted 2 lines · Fundu

First off i have a ppc based board.
and i'm trying to load a kernel image with ramdisk rootfs.

Why? You can also boot your root fs for example directly from a flash partition.

Quoted 1 line

i have build the kernel. it spit uImage,zImage and vmlinux.gz

That depends on your build system ...

Quoted 3 lines

my question are.
1) what are all the different image types ?
i know the uImage is just the kernel, what are the rest (zImage & vmlinux.gz)?

An uImage can contain a kernel but also other things. Please check the U-Boot documentation for more details.

zImage and vmlinux.gz are kernel images. You usually need only one of them, but the details do surely depend also on your build system.

Quoted 4 lines

2) i'm using u-boot as the bootldr. so i download the uImage (cause zImage and vmlinux.gz aren't bootlable) from tftp server and then do bootm <address> the kernel only load partially. How does the kernel know where/how to load the rootfs ?

In U-Boot you can add a kernel command line by setting the bootargs environment variable.

It's probably a good idea to start reading the U-Boot documentation, or whatever came with your board support package.

rsc

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
#2 lore raw
In reply to Fundu
Quoted 10 lines · Fundu

Hi,
First off i have a ppc based board.
and i'm trying to load a kernel image with ramdisk rootfs.

i have build the kernel. it spit uImage,zImage and vmlinux.gz

my question are.
1) what are all the different image types ?
i know the uImage is just the kernel, what are the rest (zImage & vmlinux.gz)?

vmlinux is the uncompressed result of compiling and linking the kernel.

I presume that vmlinux.gz is a gzipped version of vmlinux.

zImage is some other compressed kernel image format.

uImage is another kernel image format, with information specifically for loading with U-Boot.

You can see what commands are being used to create these different images by using "V=1" with your kernel make. (e.g. make V=1 uImage)

On my machine, I see the following:
/bin/sh /a/home/tbird/work/tiny/branch_ss/scripts/mkuboot.sh -A arm -O linux -T kernel -C none -a 0x10008000 -e 0x10008000 -n 'Linux-2.6.23.17-alp_nl-gfcc28266' -d arch/arm/boot/zImage arch/arm/boot/uImage

If I recall correctly, mkuboot.sh prepends the
size and start location for the kernel onto the zImage, in order to create the uImage. However, don't take my word for it -- see the U-Boot documentation, or even better read the mkuboot.sh source, or the source for U-Boot itself. That's the beauty of open source. You can see all the software and examine/modify any part you want.

If the source is impenetrable, there's always the U-Boot mailing list.

Quoted 4 lines

2) i'm using u-boot as the bootldr. so i download the uImage (cause zImage and vmlinux.gz aren't bootlable) from tftp server and then do bootm <address> the kernel only load partially. How does the kernel know where/how to load the rootfs ?

Usually, you tell it with a command line option (root=...). The command line can come from the boot loader, or it may be compiled into the kernel binary. See Documentation/kernel-parameters.txt for information about kernel command line options.

This mentions root=, but I didn't see any examples in my quick glance just now. Here are some examples I use:

Use the first partition on the first IDE hard drive:
root=/dev/hda1
or (later kernels):
root=/dev/sda1

Use NFS root filesystem (kernel config must support this) root=/dev/nfs

(Usually you need to add some other arguments to make sure the kernel IP address gets configured, or to specify the host NFS path.)

Use flash device partition 2:
root/dev/mtd/2

I hope this helps.

-- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum Senior Staff Engineer, Sony Corporation of America
=============================

#3 lore raw
Quoted 12 lines · Tim Bird
Quoted 10 lines · Fundu

Hi,
First off i have a ppc based board.
and i'm trying to load a kernel image with ramdisk rootfs.

i have build the kernel. it spit uImage,zImage and vmlinux.gz

my question are.
1) what are all the different image types ?
i know the uImage is just the kernel, what are the rest (zImage & vmlinux.gz)?

Quoted 5 lines

vmlinux is the uncompressed result of compiling and linking the kernel.

I presume that vmlinux.gz is a gzipped version of vmlinux.

zImage is some other compressed kernel image format.

zImage (for ppc at least), is a "wrapper" around the kernel that does the load and decompress. It's akin to how uImage works, just for non-U-Boot platforms.

Quoted 10 lines

uImage is another kernel image format, with information specifically for loading with U-Boot.

You can see what commands are being used to create these different images by using "V=1" with your kernel make. (e.g. make V=1 uImage)

On my machine, I see the following:
/bin/sh /a/home/tbird/work/tiny/branch_ss/scripts/mkuboot.sh -A arm -O linux -T kernel -C none -a 0x10008000 -e 0x10008000 -n 'Linux-2.6.23.17-alp_nl-gfcc28266' -d arch/arm/boot/zImage arch/arm/boot/uImage

Quoted 6 lines

If I recall correctly, mkuboot.sh prepends the
size and start location for the kernel onto the zImage, in order to create the uImage. However, don't take my word for it -- see the U-Boot documentation, or even better read the mkuboot.sh source, or the source for U-Boot itself. That's the beauty of open source. You can see all the software and examine/modify any part you want.

mkuboot.sh is a script that calls the 'mkimage' tool that is provided with the U-Boot source code. I'd also recommend reading the U-Boot source code to better understand this if your board uses U-Boot as the bootloader.

Quoted 8 lines

If the source is impenetrable, there's always the U-Boot mailing list.

Quoted 4 lines

2) i'm using u-boot as the bootldr. so i download the uImage (cause zImage and vmlinux.gz aren't bootlable) from tftp server and then do bootm <address> the kernel only load partially. How does the kernel know where/how to load the rootfs ?

Quoted 4 lines

Usually, you tell it with a command line option (root=...). The command line can come from the boot loader, or it may be compiled into the kernel binary. See Documentation/kernel-parameters.txt for information about kernel command line options.

And for U-Boot, you want to make sure the command line is set via the 'bootargs' U-Boot environment variable.

josh

#4 lore raw
In reply to Fundu
Quoted 3 lines · Fundu

Hi,
First off i have a ppc based board.
and i'm trying to load a kernel image with ramdisk rootfs.

Which version of U-Boot do you use?
Which features do you enable?

Quoted 8 lines

i have build the kernel. it spit uImage,zImage and vmlinux.gz

my question are.
1) what are all the different image types ?
i know the uImage is just the kernel, what are the rest (zImage & vmlinux.gz)?

2) i'm using u-boot as the bootldr. so i download the uImage (cause zImage and vmlinux.gz aren't bootlable) from tftp server and then do bootm <address> the kernel only load partially. How does the kernel know where/how to load the rootfs ?

It's depend on which uImage you use.

In U-Boot, you can generate a Multi-File Image with the ramdisk inside, FDT, multiple configuration etc...

In the case you describe you are supposed to download the ramdisk via tftp also and set the kernel parameter via the bootargs variable and do bootm.

example

U-Boot> tftp 200000 uImage
U-Boot> tftp a00000 uRamdisk
U-Boot> bootm 200000 a00000

good examples on these pages

http://www.denx.de/wiki/view/DULG/Manual
http://www.denx.de/wiki/view/DULG/RootFileSystemOnARamdisk
http://www.denx.de/wiki/view/DULG/CombiningKernelAndRamdisk

Best Regards,
J.