Gentoo Archives: gentoo-dev

From: Marc Schiffbauer <mschiff@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] /usr vs. initramfs redux
Date: Sat, 06 Aug 2011 15:53:42
Message-Id: 20110806155254.GA24881@lisa.schiffbauer.lan
In Reply to: Re: [gentoo-dev] /usr vs. initramfs redux by Samuli Suominen
1 * Samuli Suominen schrieb am 05.08.11 um 15:43 Uhr:
2 > On 08/05/2011 04:12 PM, Marc Schiffbauer wrote:
3 > > OTOH the initrd that Robin described would be a very static solution
4 > > with almost no dependencies, so if genkernel had a USE flag like
5 > > "dracut" it would be possible to build it without dracut
6 > > dependency and thus would allow for smaller systems.
7 > >
8 > To clarify,
9 >
10 > By dependencies in dracut you mean udev?
11
12 For example yes.
13
14 > And by smaller systems you mean
15 > systems without udev?
16
17 No.
18
19 >
20 > Then yes, such minimal initramfs should propably be covered in the
21 > embedded's documentation, but otherwise trying to avoid dracut is
22 > reinventing the wheel...
23
24 You may be right, but to my understanding such a minimalistic initrd
25 would really do nothing special. Possibly a small shell script run
26 in a static busybox would do the job, Given some required conditions
27 like having a "normal" boot device like /dev/sda is given this
28 thingy would just mount the rootfs, read some config,, then mount
29 other things like /usr and thats it. Not to forget pivot_root and
30 starting the real init of course.
31
32 Maybe something like:
33 <pseudo shell mode>
34 #!/bin/sh
35 mount -t proc proc /proc
36 rootfs=`sed 's/.*root=\([^ ]*\)/\$1` /proc/cmdline
37 mount $rootfs /newroot
38 while read device mnt fstype; do
39 mount -t $fstype $device $mnt
40 done < /newroot/etc/initramfs.mount
41 cd /newroot
42 pivot_root . /oldroot
43 exec chroot . /sbin/init
44 # END
45
46
47 -Marc
48 --
49 8AAC 5F46 83B4 DB70 8317 3723 296C 6CCA 35A6 4134

Replies

Subject Author
Re: [gentoo-dev] /usr vs. initramfs redux "Michał Górny" <mgorny@g.o>