Skip to contentSkip to conversation

Creating initrd

Buildroot Chris Wilkinson 2 participants 11 messages Oct 11, 2012 – Oct 12, 2012 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

I haven't been able to figure out how to get BR to create an initial ramdisk.

I selected initramfs in Filesystem images. What I end up with is

-rw-r--r-- 1 chrisw chrisw 38356992 Oct 11 09:00 rootfs.cpio -rw-r--r-- 1 chrisw chrisw 13666196 Oct 11 09:00 rootfs.cpio.gz -rw-r--r-- 1 chrisw chrisw 48346112 Oct 11 09:00 rootfs.ext2 -rw-r--r-- 1 chrisw chrisw 13990321 Oct 11 09:00 rootfs.ext2.gz -rwxr-xr-x 1 chrisw chrisw 1422576 Oct 11 09:01 zImage

There is no initrd and the rootfs is way too big for flash.

Chris

#1 lore raw

Dear Chris Wilkinson,

Quoted 11 lines · Chris Wilkinson

I haven't been able to figure out how to get BR to create an initial ramdisk.

I selected initramfs in Filesystem images. What I end up with is

(quoted diff) +0 -5
-rw-r--r-- 1 chrisw chrisw 38356992 Oct 11 09:00 rootfs.cpio
-rw-r--r-- 1 chrisw chrisw 13666196 Oct 11 09:00 rootfs.cpio.gz
-rw-r--r-- 1 chrisw chrisw 48346112 Oct 11 09:00 rootfs.ext2
-rw-r--r-- 1 chrisw chrisw 13990321 Oct 11 09:00 rootfs.ext2.gz
-rwxr-xr-x 1 chrisw chrisw  1422576 Oct 11 09:01 zImage
Quoted 1 line

There is no initrd and the rootfs is way too big for flash.

Forget about initrd, nobody uses that anymore.

Can you post your entire .config?

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

The .config is here

http://pastebin.com/84LqnBXS

This shows what I'm trying to achieve.

http://d-i.alioth.debian.org/manual/en.armel/ch05s01.html#boot-firmware.

The output on the serial console goes like this on power up.

Quoted 1 line
Quoted 1 line

No network interfaces found

EM-7210 ver.T04 2005-12-12 (For ver.AA)
== Executing boot script in 1.000 seconds - enter ^C to abort

At this point, hit Control-C to interrupt the boot loader[4]. This will give you the RedBoot prompt. Enter the following commands:

Quoted 3 lines

load -v -r -b 0x01800000 -m ymodem ramdisk.gz
load -v -r -b 0x01008000 -m ymodem zImage
exec -c "console=ttyS0,115200 rw root=/dev/ram mem=256M at 0xa0000000" -r

0x01800000

Chris

Quoted 23 lines · Thomas Petazzoni

Dear Chris Wilkinson,

Quoted 11 lines · Chris Wilkinson

I haven't been able to figure out how to get BR to create an initial ramdisk.

I selected initramfs in Filesystem images. What I end up with is

(quoted diff) +0 -5
-rw-r--r-- 1 chrisw chrisw 38356992 Oct 11 09:00 rootfs.cpio
-rw-r--r-- 1 chrisw chrisw 13666196 Oct 11 09:00 rootfs.cpio.gz
-rw-r--r-- 1 chrisw chrisw 48346112 Oct 11 09:00 rootfs.ext2
-rw-r--r-- 1 chrisw chrisw 13990321 Oct 11 09:00 rootfs.ext2.gz
-rwxr-xr-x 1 chrisw chrisw  1422576 Oct 11 09:01 zImage
Quoted 1 line

There is no initrd and the rootfs is way too big for flash.

Forget about initrd, nobody uses that anymore.

Can you post your entire .config?

Thanks,

Thomas

#3 lore raw
Quoted 3 lines · Chris Wilkinson

The .config is here

http://pastebin.com/84LqnBXS

Are you sure you did a "make clean; make" after doing all your configuration changes? Your configuration has almost no packages enabled, the generated root filesystem definitely shouldn't be that big.

Quoted 7 lines

This shows what I'm trying to achieve.

http://d-i.alioth.debian.org/manual/en.armel/ch05s01.html#boot-firmware.

The output on the serial console goes like this on power up.

Quoted 1 line
Quoted 1 line
Quoted 11 lines

No network interfaces found

EM-7210 ver.T04 2005-12-12 (For ver.AA)
== Executing boot script in 1.000 seconds - enter ^C to abort

At this point, hit Control-C to interrupt the boot loader[4]. This will give you the RedBoot prompt. Enter the following commands:

Quoted 3 lines

load -v -r -b 0x01800000 -m ymodem ramdisk.gz
load -v -r -b 0x01008000 -m ymodem zImage
exec -c "console=ttyS0,115200 rw root=/dev/ram mem=256M at 0xa0000000" -r 0x01800000

You have two choices:

1 Use an initramfs embedded inside the kernel image. This is what
Buildroot does when you enable the BR2_TARGET_ROOTFS_INITRAMFS option. In that case, you only need to load zImage to RAM, and execute it, it already contains the initramfs.

2 Use an initramfs outside the kernel image. In that case, don't
enable the BR2_TARGET_ROOTFS_INITRAMFS Buildroot option, and simply generated a compressed cpio archive for the root filesystem, thanks to BR2_TARGET_ROOTFS_CPIO + BR2_TARGET_ROOTFS_CPIO_GZIP. Then, make sure your kernel as the support for initramfs enabled.

I am quite familiar with choice 1, but I haven't tested choice 2 with Buildroot.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

I had not done 'make clean' first. Having done that and rebuilt with the same config I now have,

-rw-r--r-- 1 chrisw chrisw 49223680 Oct 11 13:14 rootfs.cpio -rw-r--r-- 1 chrisw chrisw 17878125 Oct 11 13:15 rootfs.cpio.gz -rwxr-xr-x 1 chrisw chrisw 19337904 Oct 11 13:17 zImage

It would appear that the initramfs has been embedded within zImage. Still way too big. This is a puzzle since as you say I took care to not enable any but the most basic of packages.

Chris

Quoted 47 lines · Thomas Petazzoni
Quoted 3 lines · Chris Wilkinson

The .config is here

http://pastebin.com/84LqnBXS

Are you sure you did a "make clean; make" after doing all your configuration changes? Your configuration has almost no packages enabled, the generated root filesystem definitely shouldn't be that big.

Quoted 7 lines

This shows what I'm trying to achieve.

http://d-i.alioth.debian.org/manual/en.armel/ch05s01.html#boot-firmware.

The output on the serial console goes like this on power up.

Quoted 1 line
Quoted 1 line
Quoted 11 lines

No network interfaces found

EM-7210 ver.T04 2005-12-12 (For ver.AA)
== Executing boot script in 1.000 seconds - enter ^C to abort

At this point, hit Control-C to interrupt the boot loader[4]. This will give you the RedBoot prompt. Enter the following commands:

Quoted 3 lines

load -v -r -b 0x01800000 -m ymodem ramdisk.gz
load -v -r -b 0x01008000 -m ymodem zImage
exec -c "console=ttyS0,115200 rw root=/dev/ram mem=256M at 0xa0000000" -r 0x01800000

You have two choices:

1 Use an initramfs embedded inside the kernel image. This is what
Buildroot does when you enable the BR2_TARGET_ROOTFS_INITRAMFS option. In that case, you only need to load zImage to RAM, and execute it, it already contains the initramfs.

2 Use an initramfs outside the kernel image. In that case, don't
enable the BR2_TARGET_ROOTFS_INITRAMFS Buildroot option, and simply generated a compressed cpio archive for the root filesystem, thanks to BR2_TARGET_ROOTFS_CPIO + BR2_TARGET_ROOTFS_CPIO_GZIP. Then, make sure your kernel as the support for initramfs enabled.

I am quite familiar with choice 1, but I haven't tested choice 2 with Buildroot.

Best regards,

Thomas

#5 lore raw

Dear Chris Wilkinson,

Quoted 10 lines · Chris Wilkinson

I had not done 'make clean' first. Having done that and rebuilt with the same config I now have,

(quoted diff) +0 -3
-rw-r--r-- 1 chrisw chrisw 49223680 Oct 11 13:14 rootfs.cpio
-rw-r--r-- 1 chrisw chrisw 17878125 Oct 11 13:15 rootfs.cpio.gz
-rwxr-xr-x 1 chrisw chrisw 19337904 Oct 11 13:17 zImage

It would appear that the initramfs has been embedded within zImage. Still way too big. This is a puzzle since as you say I took care to not enable any but the most basic of packages.

Can you put online somewhere your kernel tarball and your kernel config so that I can build your Buildroot configuration and try to reproduce the problem?

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

A message that is not in the archive (sent off-list or not yet received): 1349988968.14474.34.camel@Homeserver

A message that is not in the archive (sent off-list or not yet received): 20121012091408.6184bb9f@skate

A message that is not in the archive (sent off-list or not yet received): 1350049738.14474.52.camel@Homeserver

#9 lore raw

Dear Chris Wilkinson,

Please don't reply to me directly: keep the Buildroot list Cc'ed.

Quoted 6 lines · Chris Wilkinson

I had been using crosstool to build the kernel but now I see that BR can do that and using crosstool is unnecessary. I cleaned the kernel tree and the tar.bz2 is now 89MB. It is here

https://skydrive.live.com/redir?resid=834D8577B5544D4E!169&authkey=!
AGZIOn-ye6O3anc

By crosstool, do you mean crosstool-ng? Or something else?

Both the old crosstool (that no-one should be using) and crosstool-ng do *NOT* build the kernel, so what you're saying doesn't make sense here. They use kernel /headers/ to build a toolchain, but that's all they do with the kernel.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#10 lore raw

Yes, sorry.

CT-NG was used to build an ARM x-compiler which in turn was used to build the kernel. Sorry I didn't explain that too well.

Chris

-----Original Message-----
From: Thomas Petazzoni [mailto:thomas.petazzoni at free-electrons.com]
Sent: Friday, October 12, 2012 10:13 AM
To: Chris Wilkinson; buildroot at uclibc.org
Subject: Re: [Buildroot] Creating initrd

Dear Chris Wilkinson,

Please don't reply to me directly: keep the Buildroot list Cc'ed.

Quoted 6 lines · Chris Wilkinson

I had been using crosstool to build the kernel but now I see that BR can do that and using crosstool is unnecessary. I cleaned the kernel tree and the tar.bz2 is now 89MB. It is here

https://skydrive.live.com/redir?resid=834D8577B5544D4E!169&authkey=!
AGZIOn-ye6O3anc

By crosstool, do you mean crosstool-ng? Or something else?

Both the old crosstool (that no-one should be using) and crosstool-ng do *NOT* build the kernel, so what you're saying doesn't make sense here. They use kernel /headers/ to build a toolchain, but that's all they do with the kernel.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#11 lore raw
In reply to a message not in the archive

Dear Chris Wilkinson,

Quoted 6 lines · Chris Wilkinson

I had been using crosstool to build the kernel but now I see that BR can do that and using crosstool is unnecessary. I cleaned the kernel tree and the tar.bz2 is now 89MB. It is here

https://skydrive.live.com/redir?resid=834D8577B5544D4E!169&authkey=!
AGZIOn-ye6O3anc

The .config file in this kernel tarball (which I assume is the kernel configuration you're using) has gazillions of kernel modules enabled. 99.999999% of them are most likely useless in your setup. Those kernel modules are the one that are causing your root filesystem to be 30+MB.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#12 lore raw
In reply to Thomas Petazzoni

Clean/make on a stock v3.4.7 kernel gives the following

-rw-r--r-- 1 chrisw chrisw 1.5M Oct 11 17:19 rootfs.cpio -rw-r--r-- 1 chrisw chrisw 718K Oct 11 17:19 rootfs.cpio.gz -rwxr-xr-x 1 chrisw chrisw 2.7M Oct 11 17:18 zImage

So it seems that the size problem originates in my customized kernel. 2.7MB is still too big so I need to investigate the config settings in both my customized kernel and the stock one.

Chris

Quoted 47 lines · Thomas Petazzoni
Quoted 3 lines · Chris Wilkinson

The .config is here

http://pastebin.com/84LqnBXS

Are you sure you did a "make clean; make" after doing all your configuration changes? Your configuration has almost no packages enabled, the generated root filesystem definitely shouldn't be that big.

Quoted 7 lines

This shows what I'm trying to achieve.

http://d-i.alioth.debian.org/manual/en.armel/ch05s01.html#boot-firmware.

The output on the serial console goes like this on power up.

Quoted 1 line
Quoted 1 line
Quoted 11 lines

No network interfaces found

EM-7210 ver.T04 2005-12-12 (For ver.AA)
== Executing boot script in 1.000 seconds - enter ^C to abort

At this point, hit Control-C to interrupt the boot loader[4]. This will give you the RedBoot prompt. Enter the following commands:

Quoted 3 lines

load -v -r -b 0x01800000 -m ymodem ramdisk.gz
load -v -r -b 0x01008000 -m ymodem zImage
exec -c "console=ttyS0,115200 rw root=/dev/ram mem=256M at 0xa0000000" -r 0x01800000

You have two choices:

1 Use an initramfs embedded inside the kernel image. This is what
Buildroot does when you enable the BR2_TARGET_ROOTFS_INITRAMFS option. In that case, you only need to load zImage to RAM, and execute it, it already contains the initramfs.

2 Use an initramfs outside the kernel image. In that case, don't
enable the BR2_TARGET_ROOTFS_INITRAMFS Buildroot option, and simply generated a compressed cpio archive for the root filesystem, thanks to BR2_TARGET_ROOTFS_CPIO + BR2_TARGET_ROOTFS_CPIO_GZIP. Then, make sure your kernel as the support for initramfs enabled.

I am quite familiar with choice 1, but I haven't tested choice 2 with Buildroot.

Best regards,

Thomas

#13 lore raw

Dear Chris Wilkinson,

Quoted 9 lines · Chris Wilkinson

Clean/make on a stock v3.4.7 kernel gives the following

(quoted diff) +0 -3
-rw-r--r-- 1 chrisw chrisw 1.5M Oct 11 17:19 rootfs.cpio
-rw-r--r-- 1 chrisw chrisw 718K Oct 11 17:19 rootfs.cpio.gz
-rwxr-xr-x 1 chrisw chrisw 2.7M Oct 11 17:18 zImage

So it seems that the size problem originates in my customized kernel. 2.7MB is still too big so I need to investigate the config settings in both my customized kernel and the stock one.

Ah, maybe your customized kernel configuration has gazillions of kernel modules enabled, which make the size of the root filesystem enormous. Could you pastebin your kernel config so we can confirm this?

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com