<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-intro-how">
  <?dbhtml filename="how.html"?>

  <title>如何构建 LFS 系统</title>

  <!--para>The LFS system will be built by using an already installed
  Linux distribution (such as Debian, OpenMandriva, Fedora, or openSUSE). This
  existing Linux system (the host) will be used as a starting point to
  provide necessary programs, including a compiler, linker, and shell,
  to build the new system. Select the <quote>development</quote> option
  during the distribution installation to be able to access these
  tools.</para-->
  <para>LFS 系统必须在一个已经安装好的 Linux 发行版 (如 Debian、
	  OpenMandriva、Fedora 或者 openSUSE) 中构建。这个安装好的 Linux 系统
	  (称为宿主) 提供包括编译器、链接器和 shell 在内的必要程序，
	  作为构建新系统的起点。
	  请在安装发行版的过程中选择<quote>development</quote>
	  (开发) 选项，以使用这些工具。</para>

  <!-- Junk here has been removed in translation -->
  <para>您也可以选择不安装一个单独的发行版，而是使用某个商业发行版的
	  LiveCD 。</para>

  <!--para><xref linkend="chapter-partitioning"/> of this book describes how
  to create a new Linux native partition and file system. This is the place
  where the new LFS system will be compiled and installed. <xref
  linkend="chapter-getting-materials"/> explains which packages and
  patches need to be downloaded to build an LFS system and how to store
  them on the new file system. <xref linkend="chapter-final-preps"/>
  discusses the setup of an appropriate working environment. Please read
  <xref linkend="chapter-final-preps"/> carefully as it explains several
  important issues you need be aware of before beginning to
  work your way through <xref linkend="chapter-temporary-tools"/> and beyond.</para-->
  <para>本书的<xref linkend="chapter-partitioning"/>描述了如何创建一个新的
	  Linux 本地分区和文件系统，新的 LFS 系统将在该文件系统中被编译和安装。
	  <xref linkend="chapter-getting-materials"/>
	  列举了在构建 LFS 系统的过程中必须下载的软件包和补丁，
	  并解释了在新文件系统中存储它们的方法。
	  <xref linkend="chapter-final-preps"/>讨论工作环境的正确配置。
	  请仔细阅读<xref linkend="chapter-final-preps"/>，因为它解释了您在开始
	  <xref linkend="chapter-temporary-tools"/>
	  及后续章节的工作前必须了解的一些重要问题。</para>

  <!--para><xref linkend="chapter-temporary-tools"/> explains the
  installation of a number of packages that will form the basic
  development suite (or toolchain) which is used to build the actual
  system in <xref linkend="chapter-building-system"/>. Some of these
  packages are needed to resolve circular dependencies&mdash;for example,
  to compile a compiler, you need a compiler.</para-->
  <para><xref linkend="chapter-temporary-tools"/>
	  解释了安装大量软件包以形成基本开发套件 (或称为工具链) 的过程，
	  之后在 <xref linkend="chapter-building-system"/>
	  中将用工具链构建真正的系统。其中一些包需要解决循环依赖问题
	  &mdash;&mdash;例如，为了编译一个编译器，您首先需要一个编译器。</para>

  <!--para><xref linkend="chapter-temporary-tools"/> also shows you how to
  build a first pass of the toolchain, including Binutils and GCC (first pass
  basically means these two core packages will be reinstalled).
  The next step is to build Glibc, the C library. Glibc will be compiled by
  the toolchain programs built in the first pass. Then, a second pass of the
  toolchain will be built. This time, the toolchain will be dynamically linked
  against the newly built Glibc. The remaining <xref
  linkend="chapter-temporary-tools"/> packages are built using this second
  pass toolchain. When this is done, the LFS installation process will no
  longer depend on the host distribution, with the exception of the running
  kernel. </para-->
  <para>另外，
	  <xref linkend="chapter-temporary-tools"/>
	  也展示了构建第一轮工具链的过程，包括 Binutils 和 GCC
	  (<quote>第一轮</quote>表示这两个核心软件包会被重新安装一次)。
	  下一步是构建 Glibc ，即 C 运行库。我们将用第一轮工具链中的程序编译
	  Glibc 。之后，我们构建第二轮工具链，
	  第二轮工具链将会动态链接到新编译的 Glibc 上。
	  我们将使用第二轮工具链构建
	  <xref linkend="chapter-temporary-tools"/> 中的其余软件包。
	  在这些工作完成后，除正在运行的内核外，
	  LFS 的安装过程将不再依赖于作为宿主的发行版。</para>

  <!--para>This effort to isolate the new system from the host distribution may
  seem excessive. A full technical explanation as to why this is done is provided in
  <xref linkend="ch-tools-toolchaintechnotes"/>.</para-->
  <para>我们努力将新构造的系统从宿主发行版分离出来。这个过程看上去很繁琐，
	  我们将会在
	  <xref linkend="ch-tools-toolchaintechnotes"/>
	  完整地从技术上解释这样做的必要性。</para>

  <!--para>In <xref linkend="chapter-building-system"/>, the full LFS system is
  built. The <command>chroot</command> (change root) program is used to enter
  a virtual environment and start a new shell whose root directory will be
  set to the LFS partition. This is very similar to rebooting and instructing
  the kernel to mount the LFS partition as the root partition. The system
  does not actually reboot, but instead uses <command>chroot</command> because
  creating a bootable system requires additional work which is not necessary
  just yet. The major advantage is that <quote>chrooting</quote> allows you
  to continue using the host system while LFS is being built. While waiting
  for package compilations to complete, you can continue using your computer as
  normal.</para-->
  <para>在<xref linkend="chapter-building-system"/>中，
	  我们将构建完整的 LFS 系统。我们使用 <command>chroot</command>
	  (改变根目录) 命令进入一个虚拟化环境，其中根目录被设置为 LFS 文件系统。
	  这与重启计算机并指示内核将 LFS 文件系统挂载为根文件系统很相似，
	  然而由于创建一个可引导的系统需要一些尚未完成的额外工作，
	  我们选择使用 <command>chroot</command> 。<quote>换根</quote>
	  的最大好处是，我们在构建 LFS 的过程中，可以继续使用宿主系统。
	  在等待软件包编译的过程中，您可以继续正常使用计算机。</para>

  <!--para>To finish the installation, the basic system configuration is set up in
  <xref linkend="chapter-bootscripts"/>, and the kernel and boot loader are set
  up in <xref linkend="chapter-bootable"/>. <xref linkend="chapter-finalizing"/>
  contains information on continuing the LFS experience beyond this book.
  After the steps in this book have been implemented, the computer will be
  ready to reboot into the new LFS system.</para-->
  <para>为了完成安装，我们在 <xref linkend="chapter-bootscripts"/>
	  中进行系统的基本设置，在 <xref linkend="chapter-bootable"/>
	  中配置内核和引导加载器。最后，<xref linkend="chapter-finalizing"/>
	  包含在阅读完本书后继续体验 LFS 的相关信息。在完成本书的所有流程后，
	  重启计算机即可进入新的 LFS 系统。</para>

  <!--para>This is the process in a nutshell. Detailed information on each
  step is discussed in the following chapters and package descriptions.
  Items that may seem complicated will be clarified, and everything will
  fall into place as you embark on the LFS adventure.</para-->
  <para>以上是 LFS 构建过程的简要介绍，
	  针对特定步骤的详细信息将在之后章节以及软件包的简介中讨论。
	  在您踏上 LFS 的构建之旅后，就能逐步理清这些看上去很复杂的步骤，
	  每一步都将变得非常清晰。</para>

</sect1>
