Changeset 6dfcfecc for chapter07/introduction.xml
- Timestamp:
- 03/31/2021 10:41:39 AM (3 years ago)
- Branches:
- ml-11.0, multilib
- Children:
- 7610848
- Parents:
- 811b5a39
- git-author:
- Thomas Trepl <thomas@…> (06/29/2020 07:55:01 AM)
- git-committer:
- Xℹ Ruoyao <xry111@…> (03/31/2021 10:41:39 AM)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/introduction.xml
r811b5a39 r6dfcfecc 6 6 ]> 7 7 8 <sect1 id="ch- config-introduction" revision="sysv">8 <sect1 id="ch-tools-introduction-chroot"> 9 9 <?dbhtml filename="introduction.html"?> 10 10 11 11 <title>Introduction</title> 12 12 13 <para>Booting a Linux system involves several tasks. The process must 14 mount both virtual and real file systems, initialize devices, activate swap, 15 check file systems for integrity, mount any swap partitions or files, set 16 the system clock, bring up networking, start any daemons required by the 17 system, and accomplish any other custom tasks needed by the user. This 18 process must be organized to ensure the tasks are performed in the correct 19 order but, at the same time, be executed as fast as possible.</para> 13 <para>This chapter shows how to build the last missing bits of the temporary 14 system: first, the tools needed by the build machinery of various packages, 15 then three packages needed to run tests. Now that all circular dependencies 16 have been resolved, we can use a <quote>chroot</quote> environment, 17 completely isolated the host operating system used for the build, except 18 for the running kernel.</para> 20 19 21 <!-- <para>In the packages that were installed in Chapter 6, there were two 22 different boot systems installed. LFS provides the ability to easily23 select which system the user wants to use and to compare and contrast the24 two systems by actually running each system on the local computer. The25 advantages and disadvantages of these systems is presented below.</para>-->20 <para>For proper operation of the isolated environment, some communication 21 with the running kernel must be established. This is done through the 22 so-called <emphasis>Virtual Kernel File Systems</emphasis>, which must be 23 mounted when entering the chroot environment. You may want to check 24 that they are mounted by issuing <command>findmnt</command>.</para> 26 25 27 <sect2 id='sysv-desc'> 28 <title>System V</title> 26 <para>Until <xref linkend="ch-tools-chroot"/>, the commands must be 27 run as <systemitem class="username">root</systemitem>, with the 28 <envar>LFS</envar> variable set. After entering chroot, all commands 29 are run as root, fortunately without access to the OS of the computer 30 you built LFS on. Be careful anyway, as it is easy to destroy the whole 31 LFS system with badly formed commands.</para> 29 32 30 <para>System V is the classic boot process that has been used in Unix and31 Unix-like systems such as Linux since about 1983. It consists of a small32 program, <command>init</command>, that sets up basic programs such as33 <command>login</command> (via getty) and runs a script. This script,34 usually named <command>rc</command>, controls the execution of a set of35 additional scripts that perform the tasks required to initialize the36 system.</para>37 38 <para>The <command>init</command> program is controlled by the39 <filename>/etc/inittab</filename> file and is organized into run levels that40 can be run by the user:</para>41 42 <literallayout>43 0 — halt44 1 — Single user mode45 2 — Multiuser, without networking46 3 — Full multiuser mode47 4 — User definable48 5 — Full multiuser mode with display manager49 6 — reboot50 </literallayout>51 52 <para>The usual default run level is 3 or 5.</para>53 54 <bridgehead renderas="sect3">Advantages</bridgehead>55 56 <itemizedlist>57 <listitem>58 <para>Established, well understood system.</para>59 </listitem>60 61 <listitem>62 <para>Easy to customize.</para>63 </listitem>64 65 </itemizedlist>66 67 68 <bridgehead renderas="sect3">Disadvantages</bridgehead>69 70 <itemizedlist>71 <listitem>72 <para>Slower to boot. A medium speed base LFS system73 takes 8-12 seconds where the boot time is measured from the74 first kernel message to the login prompt. Network75 connectivity is typically established about 2 seconds76 after the login prompt.</para>77 </listitem>78 79 <listitem>80 <para>Serial processing of boot tasks. This is related to the previous81 point. A delay in any process such as a file system check, will82 delay the entire boot process.</para>83 </listitem>84 85 <listitem>86 <para>Does not directly support advanced features like87 control groups (cgroups), and per-user fair share scheduling.</para>88 </listitem>89 90 <listitem>91 <para>Adding scripts requires manual, static sequencing decisions.</para>92 </listitem>93 94 </itemizedlist>95 96 </sect2>97 <!--98 <sect2 id='sysd-desc'>99 <title>Systemd</title>100 101 <para>Systemd is a group of interconnected programs that handles system and102 individual process requests. It provides a dependency system between103 various entities called "units". It automatically addresses dependencies104 between units and can execute several startup tasks in parallel. It105 provides login, inetd, logging, time, and networking services. </para>106 107 <bridgehead renderas="sect3">Advantages</bridgehead>108 109 <itemizedlist>110 <listitem>111 <para>Used on many established distributions by default.</para>112 </listitem>113 114 <listitem>115 <para>There is extensive documentation.116 See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para>117 </listitem>118 119 <listitem>120 <para>Parallel execution of boot processes. A medium speed121 base LFS system takes 6-10 seconds from kernel start to a122 login prompt. Network connectivity is typically established123 about 2 seconds after the login prompt. More complex startup124 procedures may show a greater speedup when compared to System V.</para>125 </listitem>126 127 <listitem>128 <para>Implements advanced features such as control groups to129 manage related processes.</para>130 </listitem>131 132 <listitem>133 <para>Maintains backward compatibility with System V programs134 and scripts.</para>135 </listitem>136 </itemizedlist>137 138 <bridgehead renderas="sect3">Disadvantages</bridgehead>139 140 <itemizedlist>141 <listitem>142 <para>There is a substantial learning curve.</para>143 </listitem>144 145 <listitem>146 <para>Some advanced features such as dbus or cgroups cannot be147 disabled if they are not otherwise needed.</para>148 </listitem>149 150 <listitem>151 <para>Although implemented as several executable programs152 the user cannot choose to implement only the portions desired.</para>153 </listitem>154 155 <listitem>156 <para>Due to the nature of using compiled programs, systemd is157 more difficult to debug.</para>158 </listitem>159 160 <listitem>161 <para>Logging is done in a binary format. Extra tools must162 be used to process logs or additional processes must be implemented163 to duplicate traditional logging programs.</para>164 </listitem>165 166 </itemizedlist>167 168 </sect2>169 -->170 <!--171 <sect2 id='sysv'>172 <title>Selecting a Boot Method</title>173 174 <para>Selecting a boot method in LFS is relatively easy.175 Both systems are installed side-by-side. The only task needed is to176 ensure the files that are needed by the system have the correct names.177 The following scripts do that.</para>178 179 <screen><userinput remap="install">cat > /usr/sbin/set-systemd << "EOF"180 #! /bin/bash181 182 ln -svfn init-systemd /sbin/init183 ln -svfn init.d-systemd /etc/init.d184 185 for tool in halt poweroff reboot runlevel shutdown telinit; do186 ln -sfvn ${tool}-systemd /sbin/${tool}187 ln -svfn ${tool}-systemd.8 /usr/share/man/man8/${tool}.8188 done189 190 echo "Now reboot with /sbin/reboot-sysv"191 EOF192 193 chmod 0744 /usr/sbin/set-systemd194 195 cat > /usr/sbin/set-sysv << "EOF"196 #! /bin/bash197 198 ln -sfvn init-sysv /sbin/init199 ln -svfn init.d-sysv /etc/init.d200 201 for tool in halt poweroff reboot runlevel shutdown telinit; do202 ln -sfvn ${tool}-sysv /sbin/${tool}203 ln -svfn ${tool}-sysv.8 /usr/share/man/man8/${tool}.8204 done205 206 echo "Now reboot with /sbin/reboot-systemd"207 EOF208 209 chmod 0744 /usr/sbin/set-sysv</userinput></screen>210 211 <note><para>The comment about the correct command to reboot in the212 above scripts is correct. The reboot command for the current boot213 system must be used after the script changes the default reboot command.214 </para></note>215 216 <para>Now set the desired boot system. The default is System V:</para>217 218 <screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen>219 220 <para>Changing the boot system can be done at any time by running the221 appropriate script above and rebooting.</para>222 223 </sect2>224 -->225 33 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.