Gentoo Archives: gentoo-catalyst

From: Paul Smith <psmith@××××××.com>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] How is initrd built?
Date: Thu, 07 Jul 2005 18:42:59
Message-Id: vpdrslyqzceb.fsf@lemming.engeast.baynetworks.com
In Reply to: Re: [gentoo-catalyst] How is initrd built? by Eric Edgar
1 %% Eric Edgar <rocket@g.o> writes:
2
3 ee> Catalyst doesnt really support unionfs at the moment.
4
5 ee> You will need to add unionfs to your isolinux loader script to get
6 ee> it to work.
7
8 Well, it pretty much works. I wonder if anyone can be more clear about
9 in what way Catalyst doesn't support unionfs and what exactly "add
10 unionfs to my isolinux script" means? I'm happy to continue moving
11 forward with this and even posting fixes etc. if I run into any.
12
13
14 What happens now: I'm booting a livecd image. If I add --union to the
15 genkernel arguments when I build my livecd image with catalyst, then the
16 system does come up correctly. I see it detect unionctl, I see it
17 create the tmpfs, I see it mount the tmpfs, etc.
18
19 However, after the system is booted there is one problem: all the
20 partitions that were mounted during the linuxrc are no longer visible
21 from within the unionfs. Here are the unionfs-related steps genkernel
22 uses as far as I can determine them; I'm replacing variables with actual
23 values here to make things simpler to follow (I hope!):
24
25 0) mkdir -p /newroot
26
27 1) Create a tmpfs at /memory
28
29 2) Create a unionfs at /union, where the only item in the union is
30 /memory (mounted RW)
31
32 3) Init /newroot (make directories, copy over /dev/null and /dev/console)
33
34 4) Find the cdrom and mount it as /newroot/mnt/cdrom
35
36 5) Mount the squashfs as /newroot/mnt/livecd (read-only)
37
38 6) Add /newroot/mnt/livecd to the unionfs after the tmpfs (/memory)
39
40 7) Create /union/proc and /union/sys
41
42 8) Pivot_root to make /union the new /.
43
44 9) Clean up the old root (in /tmp/.initrd)
45
46 10) chroot . 'exec /sbin/init' (basically).
47
48 So, at the end of this our / is actually /union, and things are set up
49 properly, BUT if I run "df", for example, I get:
50
51 Filesystme 1K-blocks Used Available Use% Mounted on
52 df: `/memory': No such file or directory
53 df: `/newroot/mnt/cdrom': No such file or directory
54 df: `/newroot/mnt/livecd': No such file or directory
55 udev 127724 2668 125056 3% /dev
56
57 Is there a way to fix this? Can we do some sort of fancy footwork
58 (maybe mount --move?) to get those things visible inside the union?
59 Creating these directories inside the union keeps df from complaining,
60 but those directories are still empty: you can't unmount them for
61 example (not that you'd be able to anyway for the unioned ones).
62
63 I'm mostly concerned with the cdrom mount. I wonder if it would at
64 least be reasonable to mount /mnt/cdrom inside /union instead of inside
65 /newroot: that should be safe. You can't do that with /memory since it
66 needs to exist before the union is created, and I doubt it would work to
67 do it with the livecd (union mount something that is mounted inside the
68 union...? Hmm)
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

Replies

Subject Author
Re: [gentoo-catalyst] How is initrd built? Chris Gianelloni <wolf31o2@g.o>