Gentoo Archives: gentoo-catalyst

From: Eric Edgar <rocket@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] How is initrd built?
Date: Thu, 07 Jul 2005 15:12:24
Message-Id: 20050707151154.GB6259@toucan.gentoo.org
In Reply to: Re: [gentoo-catalyst] How is initrd built? by Paul Smith
1 You technically cannot extract the cpio archive as far as I can tell
2 because it really is multiple cpio archives concatenated together.
3
4 the kernel takes each one and overlays them ontop of eachother.
5 this makes it easy to create a new cpio archive and cat it to the end of
6 the existing archive to override any file. It does make the initramfs
7 file itself bigger, but shouldnt take any more ram.
8
9 There is an --initramfs-overlay option that will allow you to do this
10 automatically as it points to a directory and copies its structure into
11 the initramfs.
12
13 cd ${INITRAMFS_OVERLAY}
14 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_DIR}/cpio/initramfs-overlay.cpio.gz
15 cat old-oldinitramfs.cpio.gz initramfs-overlay.cpio.gz > new-initramfs.cpio.gz
16
17 We did it this way because its easier to add or subtract components from
18 the initramfs. because udev is its own cpio file, busybox is its own
19 cpio file etc. It would work as well if everything was one big cpio,
20 but then genkernel would be much slower as it has to do a lot more
21 copy operations.
22
23 Dont feel dumb.
24
25 On 10:35 Thu 07 Jul , Paul Smith wrote:
26 > %% Chris Gianelloni <wolf31o2@g.o> writes:
27 >
28 > cg> On Thu, 2005-07-07 at 09:50 -0400, Paul Smith wrote:
29 > >> In the new version, the initrd doesn't appear to be an ext2 filesystem
30 > >> anymore... it's some kind of compressed cpio file?!?! Anyway, that's
31 > >> what "file" tells me.
32 >
33 > cg> It is an initramfs image. You can work with it just like any
34 > cg> other cpio archive.
35 >
36 > Well, yeah, I tried to do that, but it doesn't work. What am I doing
37 > wrong (I haven't used cpio for years...)
38 >
39 > I unpack the tarball and then:
40 >
41 > # gzcat isolinux/gentoo.igz | cpio -tv
42 > drwxr-xr-x 11 root root 0 Jul 6 20:09 .
43 > drwxr-xr-x 2 root root 0 Jul 6 20:09 dev
44 > crw-rw---- 1 root root 5, 1 Jul 6 20:09 dev/console
45 > crw-rw---- 1 root root 1, 3 Jul 6 20:09 dev/null
46 > drwxr-xr-x 2 root root 0 Jul 6 20:09 bin
47 > drwxr-xr-x 2 root root 0 Jul 6 20:09 etc
48 > -rw-r--r-- 1 root root 93 Jul 6 20:09 etc/fstab
49 > drwxr-xr-x 4 root root 0 Jul 6 20:09 usr
50 > drwxr-xr-x 2 root root 0 Jul 6 20:09 usr/bin
51 > drwxr-xr-x 2 root root 0 Jul 6 20:09 usr/sbin
52 > drwxr-xr-x 2 root root 0 Jul 6 20:09 proc
53 > drwxr-xr-x 2 root root 0 Jul 6 20:09 temp
54 > drwxr-xr-x 2 root root 0 Jul 6 20:09 sys
55 > drwxr-xr-x 3 root root 0 Jul 6 20:09 var
56 > drwxr-xr-x 3 root root 0 Jul 6 20:09 var/lock
57 > drwxr-xr-x 2 root root 0 Jul 6 20:09 var/lock/dmraid
58 > drwxr-xr-x 2 root root 0 Jul 6 20:09 sbin
59 >
60 > Where's everything else? If I actually extract the archive I get the
61 > same results: just this small directory skeleton and no actual contents
62 > other than the ones in bin.
63 >
64 > The file, of course, is huge and the system does boot properly so it's
65 > all in there somewhere, but...???
66 >
67 >
68 > I feel dumb :-/.
69 >
70 > --
71 > -------------------------------------------------------------------------------
72 > Paul D. Smith <psmith@××××××.com> HASMAT--HA Software Mthds & Tools
73 > "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
74 > -------------------------------------------------------------------------------
75 > These are my opinions---Nortel Networks takes no responsibility for them.
76 > --
77 > gentoo-catalyst@g.o mailing list
78 >
79 >

Replies

Subject Author
Re: [gentoo-catalyst] How is initrd built? Paul Smith <psmith@××××××.com>