Gentoo Archives: gentoo-catalyst

From: Chris Gianelloni <wolf31o2@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] How is initrd built?
Date: Thu, 07 Jul 2005 19:17:06
Message-Id: 1120763778.11567.54.camel@cgianelloni.nuvox.net
In Reply to: Re: [gentoo-catalyst] How is initrd built? by Paul Smith
1 On Thu, 2005-07-07 at 14:42 -0400, Paul Smith wrote:
2 > %% Eric Edgar <rocket@g.o> writes:
3 >
4 > ee> Catalyst doesnt really support unionfs at the moment.
5 >
6 > ee> You will need to add unionfs to your isolinux loader script to get
7 > ee> it to work.
8 >
9 > Well, it pretty much works. I wonder if anyone can be more clear about
10 > in what way Catalyst doesn't support unionfs and what exactly "add
11 > unionfs to my isolinux script" means? I'm happy to continue moving
12 > forward with this and even posting fixes etc. if I run into any.
13
14 Actually, what rocket means in that catalyst has no built-in support for
15 unionfs. To get unionfs, you need to use gk_mainargs (or gk_kernargs)
16 --unionfs. You will also probably want livecd/bootargs: unionfs...
17 unless you know the device you want, in which case you can do
18 livecd/bootargs: unionfs=/dev/sda1 (or whatever).
19
20 Yeah, livecd/bootargs is new in the _pre series. I even documented it
21 in the template spec files... ;]
22
23 Before livecd/bootargs, you would have had to edit
24 livecd/runscript/x86-archscript.sh yourself to add an option to the
25 isolinux boot line.
26
27 > What happens now: I'm booting a livecd image. If I add --union to the
28 > genkernel arguments when I build my livecd image with catalyst, then the
29 > system does come up correctly. I see it detect unionctl, I see it
30 > create the tmpfs, I see it mount the tmpfs, etc.
31 >
32 > However, after the system is booted there is one problem: all the
33 > partitions that were mounted during the linuxrc are no longer visible
34 > from within the unionfs. Here are the unionfs-related steps genkernel
35 > uses as far as I can determine them; I'm replacing variables with actual
36 > values here to make things simpler to follow (I hope!):
37 >
38 > 0) mkdir -p /newroot
39 >
40 > 1) Create a tmpfs at /memory
41 >
42 > 2) Create a unionfs at /union, where the only item in the union is
43 > /memory (mounted RW)
44 >
45 > 3) Init /newroot (make directories, copy over /dev/null and /dev/console)
46 >
47 > 4) Find the cdrom and mount it as /newroot/mnt/cdrom
48 >
49 > 5) Mount the squashfs as /newroot/mnt/livecd (read-only)
50 >
51 > 6) Add /newroot/mnt/livecd to the unionfs after the tmpfs (/memory)
52 >
53 > 7) Create /union/proc and /union/sys
54 >
55 > 8) Pivot_root to make /union the new /.
56 >
57 > 9) Clean up the old root (in /tmp/.initrd)
58 >
59 > 10) chroot . 'exec /sbin/init' (basically).
60 >
61 > So, at the end of this our / is actually /union, and things are set up
62 > properly, BUT if I run "df", for example, I get:
63 >
64 > Filesystme 1K-blocks Used Available Use% Mounted on
65 > df: `/memory': No such file or directory
66 > df: `/newroot/mnt/cdrom': No such file or directory
67 > df: `/newroot/mnt/livecd': No such file or directory
68 > udev 127724 2668 125056 3% /dev
69 >
70 > Is there a way to fix this? Can we do some sort of fancy footwork
71 > (maybe mount --move?) to get those things visible inside the union?
72 > Creating these directories inside the union keeps df from complaining,
73 > but those directories are still empty: you can't unmount them for
74 > example (not that you'd be able to anyway for the unioned ones).
75 >
76 > I'm mostly concerned with the cdrom mount. I wonder if it would at
77 > least be reasonable to mount /mnt/cdrom inside /union instead of inside
78 > /newroot: that should be safe. You can't do that with /memory since it
79 > needs to exist before the union is created, and I doubt it would work to
80 > do it with the livecd (union mount something that is mounted inside the
81 > union...? Hmm)
82
83 AFIAK, /mnt/cdrom would need to be done before the pivot_root, too. So
84 you can't move that to later.
85
86 Other than that, well, we're into unknown territory for me.
87
88 --
89 Chris Gianelloni
90 Release Engineering - Strategic Lead/QA Manager
91 Games - Developer
92 Gentoo Linux

Attachments

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

Replies

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