]>
Commit | Line | Data |
---|---|---|
997358a6 MW |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> |
2 | <HTML> | |
3 | <HEAD> | |
4 | <TITLE>Building a RedHat root image</TITLE> | |
5 | <!-- Created by: Michael Richardson, 22-Nov-2001 --> | |
6 | <!-- Changed by: Michael Richardson, 22-Nov-2001 --> | |
7 | ||
8 | ||
9 | </HEAD> | |
10 | <BODY> | |
11 | <H1>Building a RedHat root image</H1> | |
12 | ||
13 | <P> | |
14 | The image required to use User-Mode-Linux is just a normal set of executables. | |
15 | These can be extracted from a RedHat distribution using the following proceedure. | |
16 | </P> | |
17 | ||
18 | <P> | |
19 | There is a script in testing/utils called <CODE>uml-rhroot.sh</CODE>. It takes | |
20 | two arguments: | |
21 | <UL> | |
22 | <LI> a directory in which to put resulting directory tree. | |
23 | <LI> a directory tree containing the RedHat distribution RPMs. This may be | |
24 | in one of three forms: | |
25 | <UL> | |
26 | <LI> a directory containing the directories "disc1" and "disc2". These | |
27 | could be ISO images that are mounted loopback via, for instance: | |
28 | <PRE> | |
29 | <CODE> | |
30 | mkdir -p /distros/redhat/7.2/disc1 /distros/redhat/7.2/disc1 | |
31 | mount -t iso9660 -o loop,ro /distros/redhat/7.2/enigma-i386-disc1.iso /distros/redhat/7.2/disc1 | |
32 | mount -t iso9660 -o loop,ro /distros/redhat/7.2/enigma-i386-disc2.iso /distros/redhat/7.2/disc2 | |
33 | </CODE> | |
34 | </PRE> | |
35 | or even two real CDroms mounted somewhere. In the example above, use "/distros/redhat/7.2" as the distribution directory. | |
36 | </LI> | |
37 | <LI> a directory containing a "merged" disc1 and disc2 as suggested by RedHat in <A HREF="http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/install-guide/s1-install-network.html#S2-INSTALL-SETUPSERVER">http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/install-guide/s1-install-network.html under "Setting up the Server"</A>. | |
38 | <LI> a directory containing all the required RPMs. (See <A HREF="uml-rhroot-list7.2.txt">list of RPMs</A>)</LI> | |
39 | </UL> | |
40 | </UL> | |
41 | </P> | |
42 | ||
43 | <P>The unpacked distribution will take approximately 133Mb. You will | |
44 | want to locate this on the same partition as your intended root | |
45 | trees for your User-Mode-Linux's as this will permit hard links to | |
46 | be used, saving disk space. | |
47 | </P> | |
48 | ||
49 | <P> | |
50 | Because the RPM command used uses the chroot(2) system call and | |
51 | needs to change ownership of the files that it creates, it must be | |
52 | run as root. Afterward, you should chown the entire directory to the | |
53 | userid that you will be using for testing (i.e. probably | |
54 | yours). It should eventually suffices to make sure that you can read | |
55 | every file. | |
56 | </P> | |
57 | ||
58 | <P> | |
59 | You should be able to chroot to this directory and run programs. If | |
60 | you can not at least run ls, then there is a problem. | |
61 | </P> | |
62 | <P> | |
63 | Expect a couple of errors about install-info. | |
64 | </P> | |
65 | ||
66 | <P> | |
67 | An example: | |
68 | <PRE> | |
69 | <CODE> | |
70 | Script started on Thu Nov 22 15:51:15 2001 | |
71 | cassidy:/c2/user-mode-linux# df | |
72 | Filesystem 1k-blocks Used Available Use% Mounted on | |
73 | /dev/hda1 3844408 1673528 1975584 46% / | |
74 | /dev/hda3 12495048 1823404 10036884 16% /home | |
75 | /dev/hdc1 10325748 805056 8996172 9% /c1 | |
76 | /dev/hdc2 10325780 4815160 4986100 50% /c2 | |
77 | /dev/hdc3 10325780 2972480 6828780 31% /c3 | |
78 | /dev/hdc4 7495084 3059640 4054704 44% /c4 | |
79 | /distros/redhat/7.2/enigma-i386-disc1.iso | |
80 | 662072 662072 0 100% /distros/redhat/7.2/disc1 | |
81 | /distros/redhat/7.2/enigma-i386-disc2.iso | |
82 | 653740 653740 0 100% /distros/redhat/7.2/disc2 | |
83 | cassidy:/c2/user-mode-linux# /c2/freeswan/sandbox-main/testing/utils/uml-rhroot.sh | |
84 | Usage: /c2/freeswan/sandbox-main/testing/utils/uml-rhroot.sh rootdir cdimagedir | |
85 | cassidy:/c2/user-mode-linux# /c2/freeswan/sandbox-main/testing/utils/uml-rhroot.sh /c2/user-mode-linux/rpm-root/root /distros/redhat/7.2 | |
86 | Assuming RH disc1 at /distros/redhat/7.2/disc1/RedHat/RPMS | |
87 | and disc2 at /distros/redhat/7.2/disc2/RedHat/RPMS | |
88 | /var/tmp/rpm-tmp.99149: /sbin/install-info: No such file or directory | |
89 | error: execution of %post scriptlet from textutils-2.0.14-2 failed, exit status 127 | |
90 | cat: /proc/mounts: No such file or directory | |
91 | warning: /var/lib/rpm/Basenames created as /var/lib/rpm/Basenames.rpmnew | |
92 | warning: /var/lib/rpm/Conflictname created as /var/lib/rpm/Conflictname.rpmnew | |
93 | warning: /var/lib/rpm/Group created as /var/lib/rpm/Group.rpmnew | |
94 | warning: /var/lib/rpm/Name created as /var/lib/rpm/Name.rpmnew | |
95 | warning: /var/lib/rpm/Packages created as /var/lib/rpm/Packages.rpmnew | |
96 | warning: /var/lib/rpm/Providename created as /var/lib/rpm/Providename.rpmnew | |
97 | warning: /var/lib/rpm/Requirename created as /var/lib/rpm/Requirename.rpmnew | |
98 | warning: /var/lib/rpm/Triggername created as /var/lib/rpm/Triggername.rpmnew | |
99 | You should now chown it to yourself. | |
100 | cassidy:/c2/user-mode-linux# chown -R mcr rpm-root/root | |
101 | cassidy:/c2/user-mode-linux# ls rpm-root/root | |
102 | bin dev home lib opt root tmp var | |
103 | boot etc initrd mnt proc sbin usr | |
104 | cassidy:/c2/user-mode-linux# chroot rpm-root/root | |
105 | cassidy:/# ls | |
106 | bin dev home lib opt root tmp var | |
107 | boot etc initrd mnt proc sbin usr | |
108 | cassidy:/# exit | |
109 | cassidy:/c2/user-mode-linux# exit | |
110 | Script done on Thu Nov 22 15:54:33 2001 | |
111 | </CODE> | |
112 | </PRE> | |
113 | ||
114 | ||
115 | </BODY> | |
116 | </HTML> |