Gentoo Archives: gentoo-catalyst

From: Paul Smith <psmith@××××××.com>
To: gentoo-catalyst@l.g.o
Subject: Re: Unionfs (was: Re: [gentoo-catalyst] Keeping a test environment using catalyst)
Date: Wed, 25 May 2005 19:29:06
Message-Id: vpdrll63qf3t.fsf@lemming.engeast.baynetworks.com
In Reply to: Re: Unionfs (was: Re: [gentoo-catalyst] Keeping a test environment using catalyst) by Chris Gianelloni
1 %% Chris Gianelloni <wolf31o2@g.o> writes:
2
3 cg> That's a good point. I was just thinking that by holding off
4 cg> until a bit later, it allows us to have our full module list,
5 cg> rather than the limited subset provided in the initrd.
6
7 Well, you still can have your full module list during linuxrc. After
8 you mount the cdrom you can just change /lib to point to the version on
9 the cdrom partition (whether you do it directly or through the unionfs,
10 it doesn't really matter).
11
12 Now, making this change involves a little bit of fancy footwork, since
13 some applications, even in the initrd, will be dynamically linked and
14 trying to swap out /lib can give them a migraine. However, taking a
15 page from the Knoppix linuxrc I got it to work by invoking the runtime
16 linker from the cdrom directly; here's a snippet:
17
18 # Run a command using "safe" paths to the ORIGFS. Only valid once
19 # that's been mounted! Note that the command MUST have a
20 # fully-qualified path!
21 runit() {
22 cmd="$1"
23 shift
24 "${ORIGFS}/lib/ld-linux.so.2" --library-path "${ORIGFS}/lib" \
25 "${ORIGFS}$cmd" "$@"
26 }
27
28 cd /
29 mkdir -p /.old
30 for f in etc lib bin boot sbin var opt root usr; do
31 runit /usr/bin/test -e "/$f" \
32 && runit /bin/mv "/$f" /.old \
33 && runit /bin/ln -snf "${UNIONFS}/$f" "/$f"
34 done
35 $DEBUG || rm -rf /.old
36
37 Here, ORIGFS would be the mount point for the cdrom. Of course you can
38 change this into two loops easily enough if you don't want all of these
39 to go through the unionfs.
40
41
42 Anyway, once you get this done your "/" contains the fully-expressed
43 squashfs contents, not just the stuff in the initrd, so you can load up
44 any other modules you think are necessary, that might not exist in the
45 initrd filesystem.
46
47
48 Cheers!
49
50 --
51 -------------------------------------------------------------------------------
52 Paul D. Smith <psmith@××××××.com> HASMAT--HA Software Mthds & Tools
53 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
54 -------------------------------------------------------------------------------
55 These are my opinions---Nortel Networks takes no responsibility for them.
56 --
57 gentoo-catalyst@g.o mailing list

Replies