Gentoo Archives: gentoo-catalyst

From: Chris Gianelloni <wolf31o2@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] LiveCD fs root creation
Date: Sat, 24 Nov 2007 15:37:24
Message-Id: 1195918527.18939.23.camel@inertia.twi-31o2.org
In Reply to: [gentoo-catalyst] LiveCD fs root creation by lurker
1 On Mon, 2007-11-19 at 13:06 +0100, lurker wrote:
2 > How/when/where is the LiveCD's filesystem root "created"? With this I'm
3 > referring to the actual fs root ("/") when running the CD, not the root
4 > found in the squashfs image that is created during build time. For some
5 > reason, these are not the same. It appears that only some directories
6 > from the image appears on the LiveCD root, where some symlinks not
7 > present in the image root also get created.
8
9 A typical squashfs-enabled LiveCD built with catalyst has 3 different
10 places that could be considered "root" on the CD at different times.
11 The first is the "outside" root, what you see when you mount the CD and
12 browse it. The second is the intramfs "root" which houses the splash
13 themes, drivers, busybox, lvm/evms, etc. from genkernel. The last, is
14 the tmpfs created at boot, which genkernel runs one of switch_root,
15 pivot_root, or chroot. This tmpfs consists of certain directories from
16 within the squashfs image, like /etc and /tmp, so they're writable. It
17 also symlinks certain other directories, like /usr.
18
19 > In my case I need /media to have KDED media manager automounting through
20 > HAL. I explicitly create /media in my fsscript and have verified that it
21 > indeed is created (by mounting the image) but it still doesn't appear on
22 > the LiveCD root. This is also the case for the Gentoo LiveCD's. The
23 > obvious solution is to create /media in local.start at every LiveCD boot
24 > up but I would nonetheless like to know the procedure of how the LiveCD
25 > root is set up from the contents of the image and if and how I can
26 > modify it.
27
28 You could modify it, but you would need to modify genkernel to do so.
29 There are two ways that I can think of to resolve this. Using
30 local.start is one way of doing it, and how we have done some things in
31 the past. We're trying to move away from that in the official media,
32 but it's still a viable solution. The second is to use a feature of
33 genkernel that very few people know exists. When booting a CD,
34 genkernel will search for ${NEW_ROOT}/mnt/cdrom/cdupdate.sh, which is
35 the "outside" root of the CD. When genkernel finds this, it executes
36 it. This is done in the "second" root above, the initramfs, immediately
37 prior to the chroot/pivot_root/switch_root. Since it runs in busybox,
38 it needs to run in the minimal busybox shell correctly. In your case,
39 it could simply say:
40
41 #!/bin/sh
42 mkdir -p ${NEW_ROOT}/media
43
44 Make sure the file is executable, or genkernel won't run it.
45
46 --
47 Chris Gianelloni
48 Release Engineering Strategic Lead
49 Alpha/AMD64/x86 Architecture Teams
50 Games Developer/Foundation Trustee
51 Gentoo Foundation

Attachments

File name MIME type
signature.asc application/pgp-signature