20 | | provide a temporary environment that can be chrooted into and from which can be |
21 | | produced a clean, trouble-free build of the target LFS system in <xref |
22 | | linkend="chapter-building-system"/>. Along the way, we separate the new system |
23 | | from the host system as much as possible, and in doing so, build a |
24 | | self-contained and self-hosted toolchain. It should be noted that the build |
25 | | process has been designed to minimize the risks for new readers and provide |
26 | | maximum educational value at the same time.</para> |
| 20 | provide a temporary environment via the <command>chroot</command> command and |
| 21 | where a clean, trouble-free build of the target LFS system in <xref |
| 22 | linkend="chapter-building-system"/> can be produced. Along the way, we |
| 23 | separate the new system from the host system as much as possible, and in |
| 24 | doing so, build a self-contained and self-hosted toolchain. |
| 25 | The build process has been designed to minimize the risks for new |
| 26 | readers and to provide the most educational value at the same time.</para> |
120 | | compiler is generally not an issue since Glibc will always use the |
121 | | <command>gcc</command> found in a <envar>PATH</envar> directory. The binary |
122 | | tools and kernel headers can be a bit more complicated. Therefore, take no |
123 | | risks and use the available configure switches to enforce the correct |
124 | | selections. After the run of <command>configure</command>, check the contents |
125 | | of the <filename>config.make</filename> file in the <filename |
| 119 | compiler is generally not an issue since Glibc will always use the compiler |
| 120 | relating to the <parameter>--host</parameter> parameter passed to its |
| 121 | configure script, e.g. in our case, |
| 122 | <command>i686-lfs-linux-gnu-gcc</command>. The binary tools and kernel |
| 123 | headers can be a bit more complicated. Therefore, take no risks and use the |
| 124 | available configure switches to enforce the correct selections. After the run |
| 125 | of <command>configure</command>, check the contents of the |
| 126 | <filename>config.make</filename> file in the <filename |
134 | | <para>After the Glibc installation, make some adjustments to ensure that |
135 | | searching and linking take place only within the <filename |
136 | | class="directory">/tools</filename> prefix. Install an adjusted |
137 | | <command>ld</command>, which has a hard-wired search path limited to |
138 | | <filename class="directory">/tools/lib</filename>. Then amend |
139 | | <command>gcc</command>'s specs file to point to the new dynamic linker in |
140 | | <filename class="directory">/tools/lib</filename>. This last step is vital |
141 | | to the whole process. As mentioned above, a hard-wired path to a dynamic |
142 | | linker is embedded into every Executable and Link Format (ELF)-shared |
143 | | executable. This can be inspected by running: |
| 135 | <para>After the Glibc installation, change <command>gcc</command>'s specs file |
| 136 | to point to the new dynamic linker in <filename |
| 137 | class="directory">/tools/lib</filename>. This last step is vital in ensuring |
| 138 | that searching and linking take place only within the <filename |
| 139 | class="directory">/tools</filename> prefix. As mentioned above, a hard-wired |
| 140 | path to a dynamic linker is embedded into every Executable and Link Format |
| 141 | (ELF)-shared executable. This can be inspected by running: |