source: BOOK/chroot/x86/before-chroot.xml@ 8150908

clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 8150908 was 9d5337b, checked in by Chris Staub <chris@…>, 16 years ago

Text cleanup on the before-chroot page

  • Property mode set to 100644
File size: 5.8 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-chroot-before-chroot">
9 <?dbhtml filename="before-chroot.html"?>
10 <title>Before Entering the Chroot Environment</title>
11
12 <sect2 role="determining-ifneeded">
13 <title>Determining if steps need to be taken</title>
14
15 <para>Before we can enter the chroot we have to make sure that the system is
16 in the proper state. From this point on the <envar>${CLFS_TARGET}</envar>
17 environment variable will no longer exist, so it will have no bearing on the
18 rest of the book - most packages will rely on
19 <command>config.guess</command> provided by
20 <xref linkend="ch-system-automake"/>. Packages that do not use autotools
21 either do not care about the target triplet, or have their own means
22 of determining its value.</para>
23
24 <para>In both cases, the information about the host cpu used to determine
25 the target triplet is gathered from the same place,
26 <command>uname -m</command>. Executing this command outside of the chroot
27 as well as inside the chroot will have the exact same output.</para>
28
29 <para>If you're unsure if your host and target have the same target
30 triplet, you can use this test to determine what the host's target triplet
31 is and if you need to take any steps to ensure that you don't build for the
32 wrong architecture. Extract the <xref linkend="ch-system-automake"/> tarball
33 and <command>cd</command> into the created directory. Then execute the
34 following to see what the detected target triplet is by
35 <command>config.guess</command>:</para>
36
37<screen><userinput>lib/config.guess</userinput></screen>
38
39 <para>If the output of that command does not equal what is in
40 <envar>${CLFS_TARGET}</envar> then you need to read on. If it does then you
41 can safely continue onto <xref linkend="ch-chroot-chroot"/>.</para>
42
43 </sect2>
44
45 <sect2 role="using-setarch">
46 <title>Using Setarch</title>
47
48 <para>If your host has a tool called <command>setarch</command> this may
49 solve your problems. The reason for saying may is because on a architecture
50 such as x86_64, using <command>setarch linux32 uname -m</command> will only
51 ever output i686. It is not possible to get an output of i486 or i586.</para>
52
53 <para>To test if setarch does everything you need it to, execute the
54 following command from inside the <xref linkend="ch-system-automake"/>
55 directory:</para>
56
57<screen><userinput>setarch linux32 lib/config.guess</userinput></screen>
58
59 <para>If the output of the command above equals what is in
60 <envar>${CLFS_TARGET}</envar> then you have a viable solution. You can
61 wrap the chroot command on the next page with
62 <command>setarch linux32</command>. It will look like the following:</para>
63
64<screen><userinput>setarch linux32 chroot "${CLFS}" /tools/bin/env -i \
65 HOME=/root TERM="${TERM}" PS1='\u:\w\$ ' \
66 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
67 /tools/bin/bash --login +h</userinput></screen>
68
69 <para>If setarch works for you then you can safely continue onto
70 <xref linkend="ch-chroot-chroot"/>. If not, there is one more option
71 covered in this book.</para>
72
73 </sect2>
74
75 <sect2 role="using-uname_hack">
76 <title>Using a Uname Hack</title>
77
78 <para os="uua">The Uname Hack is a kernel module that modifies the output of
79 <command>uname -m</command> by directly changing the value of the
80 detected machine type. The kernel module will save the original value
81 and restore it when the module is unloaded.</para>
82
83 <variablelist os="uub" role="materials">
84 <varlistentry>
85 <term>Uname Hack (&uname_hack-version;) - &uname_hack-size;:</term>
86
87 <listitem>
88 <para>Home page: <ulink url="&uname_hack-home;"/></para>
89 <para>Download: <ulink url="&uname_hack-url;"/></para>
90 <para>MD5 sum: <literal>&uname_hack-md5;</literal></para>
91 </listitem>
92 </varlistentry>
93 </variablelist>
94
95 <para os="uuc">Extract the tarball and <command>cd</command> into the
96 created directory. To build the Uname Hack you must have the kernel sources
97 for your currently running kernel available. Build the Uname Hack with the
98 following or similar command:</para>
99
100<screen os="uud"><userinput>make uname_hack_fake_machine=i486</userinput></screen>
101
102 <variablelist os="uue">
103 <title>The meaning of the make and install options:</title>
104
105 <varlistentry os="uue1">
106 <term><parameter>uname_hack_fake_machine=i486</parameter></term>
107 <listitem>
108 <para>This parameter sets the value that the uts machine type will be
109 changed to. Alternatively this could be set to i586 or i686.</para>
110 </listitem>
111 </varlistentry>
112
113 </variablelist>
114
115 <para os="uuf">In the top level directory of the Uname Hack package you
116 should see a file named <filename>uname_hack.ko</filename>. As soon as
117 that module is loaded into the running kernel the output of
118 <command>uname -m</command> will be affected immediately system-wide.
119 Load the kernel module with the following command:</para>
120
121<screen os="uug"><userinput>insmod uname_hack.ko</userinput></screen>
122
123 <para os="uuh">To test if the Uname Hack is working properly, execute the
124 following command from inside the <xref linkend="ch-system-automake"/>
125 directory:</para>
126
127<screen os="uui"><userinput>lib/config.guess</userinput></screen>
128
129 <para os="uuj">The output of the above command should be the same as the
130 <envar>${CLFS_TARGET}</envar> environment variable. If this is not the
131 case, you can try and get help on the CLFS Support Mailing List or the
132 IRC Channel. See <xref linkend="ch-intro-askforhelp"/> for more
133 information.</para>
134
135 </sect2>
136
137</sect1>
Note: See TracBrowser for help on using the repository browser.