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 | enviornment variable will no longer exist, so it will have no bearing on the
|
---|
18 | rest of the book. From this point on, 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 they have their own means
|
---|
22 | of determining it's 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 | aswell as inside the chroot will have the exact same output.</para>
|
---|
28 |
|
---|
29 | <para>If you're unsure if you're host and target have the same target
|
---|
30 | triplet, you can use this test to determine what the hosts 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 they 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 of 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 you 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 | <para os="uue">In the top level directory of the Uname Hack pacakage you
|
---|
103 | should see a file named uname_hack.ko. As soon as that module is loaded
|
---|
104 | into the running kernel the output of <command>uname -m</command> will be
|
---|
105 | affected immediately system-wide. Load the kernel module with the following
|
---|
106 | command:</para>
|
---|
107 |
|
---|
108 | <screen os="uuf"><userinput>insmod uname_hack.ko</userinput></screen>
|
---|
109 |
|
---|
110 | <para os="uug">To test if the Uname Hack is working properly, execute the
|
---|
111 | following command from inside of the <xref linkend="ch-system-automake"/>
|
---|
112 | directory:</para>
|
---|
113 |
|
---|
114 | <screen os="uuh"><userinput>lib/config.guess</userinput></screen>
|
---|
115 |
|
---|
116 | <para os="uui">The output of the above command should be the same as the
|
---|
117 | <envar>${CLFS_TARGET}</envar> enviornment variable. If this is not the
|
---|
118 | case, You can try and get help on the CLFS Support Mailing List or the
|
---|
119 | IRC Channel. See <xref linkend="ch-intro-askforhelp"/> for more
|
---|
120 | information.</para>
|
---|
121 |
|
---|
122 | </sect2>
|
---|
123 |
|
---|
124 | </sect1>
|
---|