Changeset d2c332bc
- Timestamp:
- 04/13/2006 06:45:33 PM (17 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/parallelism, xry111/pip3, xry111/rust-wip-20221008
- Children:
- a0d96d25
- Parents:
- dd7ed7b
- Files:
-
- 1 added
- 3 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter01/changelog.xml
rdd7ed7b rd2c332bc 38 38 39 39 <listitem> 40 <para>April 13, 2006</para> 41 <itemizedlist> 42 <listitem> 43 <para>[archaic] - Merged the udev_update branch to trunk.</para> 44 </listitem> 45 </itemizedlist> 46 </listitem> 47 48 <listitem> 40 49 <para>April 12, 2006</para> 41 50 <itemizedlist> … … 43 52 <para>[jhuntwork] - Rewrote section explaining IP Addresses. 44 53 Thanks Bryan Kadzban and Bruce Dubbs. Resolves Ticket 1663.</para> 45 </listitem>46 <listitem>47 <para>[jhuntwork] - Adjust some redundant text in Berkeley DB page.</para>48 54 </listitem> 49 55 <listitem> … … 71 77 72 78 <listitem> 79 <para>April 8, 2006</para> 80 <itemizedlist> 81 <listitem> 82 <para>[jhuntwork] - Added a command to create an empty /etc/mtab file early 83 in chapter 6. This avoids testsuite failures in e2fsprogs and possibly other 84 programs that expect /etc/mtab to be present. Explanation from Dan Nicholson, 85 slightly modified. Also merged the 'Creating Essential Symlinks' section with 86 'Creating passwd, group and log Files'.</para> 87 </listitem> 88 </itemizedlist> 89 </listitem> 90 91 <listitem> 73 92 <para>April 6, 2006</para> 74 93 <itemizedlist> … … 84 103 85 104 <listitem> 105 <para>April 2, 2006</para> 106 <itemizedlist> 107 <listitem> 108 <para>[archaic] - Moved the chowning of /tools to the end of chapter 5 109 and rewrote note about backing up or re-using /tools. Moved the 110 mounting of kernel filesystems before pkgmgt page and rewrote the page 111 to mount --bind /dev and mount all other kernel filesystems while 112 outside chroot. Rewrote note about re-entering chroot and remounting 113 kernel filesystems. Removed /dev from the list of dirs created in 114 chroot and added it before chroot.</para> 115 </listitem> 116 </itemizedlist> 117 </listitem> 118 119 <listitem> 86 120 <para>March 30, 2006</para> 87 121 <itemizedlist> 88 122 <listitem> 89 123 <para>[ken] - Correct my erroneous comment about UTF-8 locales in 90 Man-DB. Thanks to Alexander for explaining it.</para> 124 Man-DB. Thanks to Alexander for explaining it.</para> 125 </listitem> 126 <listitem> 127 <para>[ken] - upgraded to Linux-2.6.16.1, Iproute2-2.6.16-060323, 128 and Udev-088.</para> 91 129 </listitem> 92 130 </itemizedlist> … … 98 136 <listitem> 99 137 <para>[ken] - Upgrade to shadow-4.0.15 and add convert-mans script 100 101 138 to convert its UTF-8 man pages. Thanks to Alexander and Archaic for 139 the script and commands. Fixes tickets #1748 and #1750.</para> 102 140 </listitem> 103 141 </itemizedlist> … … 105 143 106 144 <listitem> 107 <para>March 22, 2006</para> 108 <itemizedlist> 109 <listitem> 110 <para>[archaic] - Updated to lfs-bootscripts-20060321.</para> 111 </listitem> 112 </itemizedlist> 113 </listitem> 145 <para>March 22, 2006</para> 146 <itemizedlist> 147 <listitem> 148 <para>[archaic] - Updated to 149 lfs-bootscripts-udev_update-20060321.</para> 150 </listitem> 151 </itemizedlist> 152 </listitem> 153 154 <listitem> 155 <para>March 21, 2006</para> 156 <itemizedlist> 157 <listitem> 158 <para>[archaic] - Updated the bootscripts. Removed references to 159 hotplug and the bootscripts udev patch. Removed reference to 160 udevstart. Added text and commands for generating Udev bug reports. 161 </para> 162 </listitem> 163 </itemizedlist> 164 </listitem> 114 165 115 166 <listitem> … … 164 215 <para>[matthew] - Upgrade to Man-pages 2.25.</para> 165 216 </listitem> 217 <listitem> 218 <para>[matthew] - Remove an example of poor Udev support as it 219 does not apply to the kernel used in the book. Thanks to Alexander 220 Patrakov.</para> 221 </listitem> 222 <listitem> 223 <para>[matthew] - Upgrade to Linux 2.6.15.6.</para> 224 </listitem> 225 <listitem> 226 <para>[matthew] - Upgrade to udev-087.</para> 227 </listitem> 228 <listitem> 229 <para>[matthew] - Udev's run_program rules require a null device to be 230 present at an early stage, so create one in /lib/udev/devices.</para> 231 </listitem> 166 232 </itemizedlist> 167 233 </listitem> … … 170 236 <para>March 7, 2006</para> 171 237 <itemizedlist> 238 <listitem> 239 <para>[matthew] - Update Udev rules file to load SCSI modules and 240 upload firmware to devices that need it. Improve explanations of 241 device and module handling. Thanks to Alexander Patrakov.</para> 242 </listitem> 172 243 <listitem> 173 244 <para>[archaic] - Replaced the debian-specific groff patch with an … … 191 262 <itemizedlist> 192 263 <listitem> 264 <para>[archaic] - Create the Udev directories before creating the 265 symlinks.</para> 266 </listitem> 267 <listitem> 193 268 <para>[jhuntwork] - Added a description of perl configure flags that 194 269 help perl deal with a lack of groff. Thanks Dan Nicholson.</para> … … 211 286 <itemizedlist> 212 287 <listitem> 288 <para>[matthew] - Use non-deprecated format for accessing MODALIAS 289 keys in the Udev rules file, and prevent the "$" from being 290 expanded by the shell.</para> 291 </listitem> 292 <listitem> 213 293 <para>[matthew] - Add patches 009 and 010 from Bash upstream.</para> 214 294 </listitem> … … 225 305 <para>[matthew] - Upgrade Perl libc patch to prevent Perl from trying 226 306 to find headers on the host system. Fixes bug 1695.</para> 307 </listitem> 308 <listitem> 309 <para>[matthew] - Expand the Udev module handling rule to run for 310 every subsystem, not just USB.</para> 311 </listitem> 312 <listitem> 313 <para>[matthew] - Upgrade to Linux 2.6.15.4.</para> 314 </listitem> 315 <listitem> 316 <para>[matthew] - Upgrade to Udev 085.</para> 227 317 </listitem> 228 318 <listitem> … … 257 347 Linux-Libc-Headers and DB.</para> 258 348 </listitem> 349 <listitem> 350 <para>[matthew] - Create udev specific directories in udev's 351 instructions instead of the more generic creatingdirs.xml. Add 352 "pts" and "shm" directories to 353 <filename class="directory">/lib/udev/devices</filename> so that they 354 can be mounted successfully at boot time.</para> 355 </listitem> 259 356 </itemizedlist> 260 357 </listitem> … … 266 363 <para>[manuel] - Finished the XML indentation plus few tags 267 364 changes.</para> 365 </listitem> 366 </itemizedlist> 367 </listitem> 368 369 <listitem> 370 <para>February 8, 2006</para> 371 <itemizedlist> 372 <listitem> 373 <para>[matthew] - Rewrite the majority of chapter07/udev.xml to 374 reflect the new configuration for handling dynamic device naming and 375 module loading.</para> 376 </listitem> 377 </itemizedlist> 378 </listitem> 379 380 <listitem> 381 <para>February 3, 2006</para> 382 <itemizedlist> 383 <listitem> 384 <para>[matthew] - Create the 385 <filename class="directory">/lib/firmware</filename> directory that 386 can be used by Udev's <command>firmware_helper</command> utility. 387 </para> 388 </listitem> 389 <listitem> 390 <para>[matthew] - Add descriptions of Udev's helper binaries.</para> 391 </listitem> 392 <listitem> 393 <para>[manuel] - Add udev bootscript patch to whatsnew. Removed 394 hotplug from list of packages to download.</para> 395 </listitem> 396 <listitem> 397 <para>[ken] - Add udev bootscript patch to list of patches to 398 download.</para> 399 </listitem> 400 <listitem> 401 <para>[ken] - Correct the size of the udev tarball.</para> 402 </listitem> 403 </itemizedlist> 404 </listitem> 405 406 <listitem> 407 <para>February 2, 2006</para> 408 <itemizedlist> 409 <listitem> 410 <para>[matthew] - Upgrade to Udev-084 and build all its extras to 411 enable custom rules to be written more easily. Also, change the 412 rules file to handle kernel module loading and patch the udev 413 bootscript to work with this version of udev.</para> 414 </listitem> 415 <listitem> 416 <para>[matthew] - Remove the hotplug package and related bootscript 417 Udev will now handle device creation and module loading.</para> 418 </listitem> 419 <listitem> 420 <para>[matthew] - Upgrade to Linux-2.6.15.2.</para> 268 421 </listitem> 269 422 </itemizedlist> -
chapter01/whatsnew.xml
rdd7ed7b rd2c332bc 92 92 <para>Gzip &gzip-version;</para> 93 93 </listitem>--> 94 <!--<listitem>95 <para>Hotplug &hotplug-version;</para>96 </listitem>-->97 94 <listitem> 98 95 <para>IANA-Etc &iana-etc-version;</para> … … 101 98 <para>Inetutils &inetutils-version;</para> 102 99 </listitem>--> 103 < !--<listitem>100 <listitem> 104 101 <para>IPRoute2 &iproute2-version;</para> 105 </listitem> -->102 </listitem> 106 103 <!--<listitem> 107 104 <para>Kbd &kbd-version;</para> … … 271 268 </listitem> 272 269 <listitem> 270 <para>hotplug-2004-09-23</para> 271 </listitem> 272 <listitem> 273 273 <para>inetutils-1.4.2-kernel_headers-1.patch</para> 274 274 </listitem> -
chapter03/packages.xml
rdd7ed7b rd2c332bc 244 244 245 245 <varlistentry> 246 <term>Hotplug (&hotplug-version;) - 40 KB:</term>247 <listitem>248 <para>Download: <ulink249 url="&kernel;linux/utils/kernel/hotplug/hotplug-&hotplug-version;.tar.bz2"/></para>250 </listitem>251 </varlistentry>252 253 <varlistentry>254 246 <term>Iana-Etc (&iana-etc-version;) - 174 KB:</term> 255 247 <listitem> … … 271 263 272 264 <varlistentry> 273 <term>IPRoute2 (&iproute2-version;) - 291KB:</term>265 <term>IPRoute2 (&iproute2-version;) - 377 KB:</term> 274 266 <listitem> 275 267 <para>Home page: <ulink … … 316 308 317 309 <varlistentry> 318 <term>Linux (&linux-version;) - 3 6,522KB:</term>310 <term>Linux (&linux-version;) - 39,884 KB:</term> 319 311 <listitem> 320 312 <para>Home page: <ulink url="http://www.kernel.org/"/></para> … … 523 515 524 516 <varlistentry> 525 <term>Udev (&udev-version;) - 427KB:</term>517 <term>Udev (&udev-version;) - 185 KB:</term> 526 518 <listitem> 527 519 <para>Home page: <ulink -
chapter03/patches.xml
rdd7ed7b rd2c332bc 139 139 140 140 <varlistentry> 141 <term>Linux kernel UTF-8 Composing Patch - 3KB:</term>141 <term>Linux kernel UTF-8 Composing Patch - 11 KB:</term> 142 142 <listitem> 143 143 <para><ulink url="&patches-root;&linux-utf8-patch;"/></para> -
chapter05/chapter05.xml
rdd7ed7b rd2c332bc 43 43 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="util-linux.xml"/> 44 44 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="stripping.xml"/> 45 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="changingowner.xml"/> 45 46 46 47 </chapter> -
chapter06/chapter06.xml
rdd7ed7b rd2c332bc 13 13 14 14 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="introduction.xml"/> 15 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kernfs.xml"/> 15 16 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pkgmgt.xml"/> 16 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kernfs.xml"/>17 17 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="chroot.xml"/> 18 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="changingowner.xml"/>19 18 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="creatingdirs.xml"/> 20 19 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="createfiles.xml"/> 21 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pwdgroup.xml"/>22 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="devices.xml"/>23 20 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="linux-libc-headers.xml"/> 24 21 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="man-pages.xml"/> … … 54 51 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="groff.xml"/> 55 52 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gzip.xml"/> 56 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="hotplug.xml"/>57 53 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="inetutils.xml"/> 58 54 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="iproute2.xml"/> -
chapter06/chroot.xml
rdd7ed7b rd2c332bc 45 45 to <command>bash</command>.</para> 46 46 47 <para>It is important that all the commands throughout the remainder of this48 chapter and the following chapters are run from within the chroot environment.49 If you leave this environment for any reason (rebooting for example), remember50 to first mount the <systemitem class="filesystem">proc</systemitem> and51 <systemitem class="filesystem">devpts</systemitem> file systems (discussed52 in the previous section) and enter chroot again before continuing with the53 installations.</para>54 55 47 <para>Note that the <command>bash</command> prompt will say 56 48 <computeroutput>I have no name!</computeroutput> This is normal because the 57 49 <filename>/etc/passwd</filename> file has not been created yet.</para> 58 50 51 <note> 52 <para>It is important that all the commands throughout the remainder of this 53 chapter and the following chapters are run from within the chroot 54 environment. If you leave this environment for any reason (rebooting for 55 example), ensure that the virtual kernel filesystems are mounted as 56 explained in <xref linkend="ch-system-bindmount"/> and <xref 57 linkend="ch-system-kernfsmount"/> and enter chroot again before continuing 58 with the installation.</para> 59 </note> 60 59 61 </sect1> -
chapter06/createfiles.xml
rdd7ed7b rd2c332bc 9 9 <?dbhtml filename="createfiles.html"?> 10 10 11 <title>Creating Essential Symlinks</title> 11 <title>Creating Essential Files and Symlinks</title> 12 13 <indexterm zone="ch-system-createfiles"> 14 <primary sortas="e-/etc/passwd">/etc/passwd</primary> 15 </indexterm> 16 17 <indexterm zone="ch-system-createfiles"> 18 <primary sortas="e-/etc/group">/etc/group</primary> 19 </indexterm> 20 21 <indexterm zone="ch-system-createfiles"> 22 <primary sortas="e-/var/run/utmp">/var/run/utmp</primary> 23 </indexterm> 24 25 <indexterm zone="ch-system-createfiles"> 26 <primary sortas="e-/var/log/btmp">/var/log/btmp</primary> 27 </indexterm> 28 29 <indexterm zone="ch-system-createfiles"> 30 <primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary> 31 </indexterm> 32 33 <indexterm zone="ch-system-createfiles"> 34 <primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary> 35 </indexterm> 12 36 13 37 <para>Some programs use hard-wired paths to programs which do not exist yet. In … … 21 45 ln -sv bash /bin/sh</userinput></screen> 22 46 47 <para>A proper Linux system maintains a list of the mounted file systems in 48 the file <filename>/etc/mtab</filename>. Normally, this file would be 49 created when we mount a new file system. Since we will not be mounting any 50 file systems inside our chroot environment, create an empty file for 51 utilities that expect the presence of <filename>/etc/mtab</filename>:</para> 52 53 <screen><userinput>touch /etc/mtab</userinput></screen> 54 55 <para>In order for user <systemitem class="username">root</systemitem> to be 56 able to login and for the name <quote>root</quote> to be recognized, there 57 must be relevant entries in the <filename>/etc/passwd</filename> and 58 <filename>/etc/group</filename> files.</para> 59 60 <para>Create the <filename>/etc/passwd</filename> file by running the following 61 command:</para> 62 63 <screen><userinput>cat > /etc/passwd << "EOF" 64 <literal>root:x:0:0:root:/root:/bin/bash</literal> 65 EOF</userinput></screen> 66 67 <para>The actual password for <systemitem class="username">root</systemitem> 68 (the <quote>x</quote> used here is just a placeholder) will be set later.</para> 69 70 <para>Create the <filename>/etc/group</filename> file by running the following 71 command:</para> 72 73 <screen><userinput>cat > /etc/group << "EOF" 74 <literal>root:x:0: 75 bin:x:1: 76 sys:x:2: 77 kmem:x:3: 78 tty:x:4: 79 tape:x:5: 80 daemon:x:6: 81 floppy:x:7: 82 disk:x:8: 83 lp:x:9: 84 dialout:x:10: 85 audio:x:11: 86 video:x:12: 87 utmp:x:13: 88 usb:x:14: 89 cdrom:x:15:</literal> 90 EOF</userinput></screen> 91 92 <para>The created groups are not part of any standard—they are groups 93 decided on in part by the requirements of the Udev configuration in this 94 chapter, and in part by common convention employed by a number of existing 95 Linux distributions. The Linux Standard Base (LSB, available at <ulink 96 url="http://www.linuxbase.org"/>) recommends only that, besides the group 97 <systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0, 98 a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be 99 present. All other group names and GIDs can be chosen freely by the system 100 administrator since well-written programs do not depend on GID numbers, but 101 rather use the group's name.</para> 102 103 <para>To remove the <quote>I have no name!</quote> prompt, start a new 104 shell. Since a full Glibc was installed in <xref 105 linkend="chapter-temporary-tools"/> and the 106 <filename>/etc/passwd</filename> and <filename>/etc/group</filename> 107 files have been created, user name and group name resolution will now 108 work.</para> 109 110 <screen role="nodump"><userinput>exec /tools/bin/bash --login +h</userinput></screen> 111 112 <para>Note the use of the <parameter>+h</parameter> directive. This tells 113 <command>bash</command> not to use its internal path hashing. Without this 114 directive, <command>bash</command> would remember the paths to binaries it has 115 executed. To ensure the use of the newly compiled binaries as soon as they are 116 installed, the <parameter>+h</parameter> directive will be used for the duration 117 of this chapter.</para> 118 119 <para>The <command>login</command>, <command>agetty</command>, and 120 <command>init</command> programs (and others) use a number of log 121 files to record information such as who was logged into the system and 122 when. However, these programs will not write to the log files if they 123 do not already exist. Initialize the log files and give them 124 proper permissions:</para> 125 126 <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp} 127 chgrp -v utmp /var/run/utmp /var/log/lastlog 128 chmod -v 664 /var/run/utmp /var/log/lastlog</userinput></screen> 129 130 <para>The <filename>/var/run/utmp</filename> file records the users 131 that are currently logged in. The <filename>/var/log/wtmp</filename> 132 file records all logins and logouts. The 133 <filename>/var/log/lastlog</filename> file records when 134 each user last logged in. The <filename>/var/log/btmp</filename> file 135 records the bad login attempts.</para> 136 23 137 </sect1> -
chapter06/creatingdirs.xml
rdd7ed7b rd2c332bc 14 14 standard directory tree by issuing the following commands:</para> 15 15 16 <screen><userinput>install -dv /{bin,boot, dev,etc/opt,home,lib,mnt}16 <screen><userinput>install -dv /{bin,boot,etc/opt,home,lib,mnt} 17 17 install -dv /{sbin,srv,usr/local,var,opt} 18 18 install -dv /root -m 0750 -
chapter06/introduction.xml
rdd7ed7b rd2c332bc 56 56 these) that the package installs.</para> 57 57 58 <note>59 <para>At this point, you may wish to keep your finished temporary60 tools for use in future LFS builds by creating a tarball of the61 <filename class="directory">/tools</filename> directory and62 storing it in a safe location.</para>63 </note>64 65 58 </sect1> -
chapter06/iproute2.xml
rdd7ed7b rd2c332bc 26 26 27 27 <seglistitem> 28 <seg>0. 1SBU</seg>29 <seg>4. 3MB</seg>28 <seg>0.2 SBU</seg> 29 <seg>4.8 MB</seg> 30 30 </seglistitem> 31 31 </segmentedlist> -
chapter06/kernfs.xml
rdd7ed7b rd2c332bc 9 9 <?dbhtml filename="kernfs.html"?> 10 10 11 <title> Mounting Virtual Kernel File Systems</title>11 <title>Preparing Virtual Kernel File Systems</title> 12 12 13 < para>Various file systems exported by the kernel are used to communicate to and14 from the kernel itself. These file systems are virtual in that no disk space is15 used for them. The content of the file systems resides in memory.</para>13 <indexterm zone="ch-system-kernfs"> 14 <primary sortas="e-/dev/">/dev/*</primary> 15 </indexterm> 16 16 17 <para>Begin by creating directories onto which the file systems will be 18 mounted:</para> 17 <para>Various file systems exported by the kernel are used to communicate to 18 and from the kernel itself. These file systems are virtual in that no disk 19 space is used for them. The content of the file systems resides in 20 memory.</para> 19 21 20 <screen><userinput>mkdir -pv $LFS/{proc,sys}</userinput></screen> 22 <para>Begin by creating directories onto which the file systems will be 23 mounted:</para> 21 24 22 <para>Now mount the file systems:</para>25 <screen><userinput>mkdir -pv $LFS/{dev,proc,sys}</userinput></screen> 23 26 24 <screen><userinput>mount -vt proc proc $LFS/proc 27 <sect2> 28 <title>Creating Initial Device Nodes</title> 29 30 <para>When the kernel boots the system, it requires the presence of a few 31 device nodes, in particular the <filename 32 class="devicefile">console</filename> and <filename 33 class="devicefile">null</filename> devices. The device nodes will be created 34 on the hard disk so that they are available before <command>udev</command> 35 has been started, and additionally when Linux is started in single user mode 36 (hence the restrictive permissions on <filename 37 class="devicefile">console</filename>). Create the devices by running the 38 following commands:</para> 39 40 <screen><userinput>mknod -m 600 $LFS/dev/console c 5 1 41 mknod -m 666 $LFS/dev/null c 1 3</userinput></screen> 42 43 </sect2> 44 45 <sect2 id="ch-system-bindmount"> 46 <title>Mounting and Populating /dev</title> 47 48 <para>The recommended method of populating the <filename 49 class="directory">/dev</filename> directory with devices is to mount a 50 virtual filesystem (such as <systemitem 51 class="filesystem">tmpfs</systemitem>) on the <filename 52 class="directory">/dev</filename> directory, and allow the devices to be 53 created dynamically on that virtual filesystem as they are detected or 54 accessed. This is generally done during the boot process by Udev. Since 55 this new system does not yet have Udev and has not yet been booted, it is 56 necessary to mount and populate <filename 57 class="directory">/dev</filename> manually. This is accomplished by bind 58 mounting the host system's <filename class="directory">/dev</filename> 59 directory. A bind mount is a special type of mount that allows you to 60 create a mirror of a directory or mount point to some other location. Use 61 the following command to achieve this:</para> 62 63 <screen><userinput>mount --bind /dev $LFS/dev</userinput></screen> 64 65 </sect2> 66 67 <sect2 id="ch-system-kernfsmount"> 68 <title>Mounting Virtual Kernel File Systems</title> 69 70 <para>Now mount the remaining virtual kernel filesystems:</para> 71 72 <screen><userinput>mount -vt devpts devpts $LFS/dev/pts 73 mount -vt tmpfs shm $LFS/dev/shm 74 mount -vt proc proc $LFS/proc 25 75 mount -vt sysfs sysfs $LFS/sys</userinput></screen> 26 76 27 <para>Remember that if for any reason you stop working on the LFS 28 system and start again later, it is important to check that these file 29 systems are mounted again before entering the chroot 30 environment.</para> 31 32 <para>Additional file systems will soon be mounted from within the 33 chroot environment. To keep the host up to date, perform a <quote>fake 34 mount</quote> for each of these now:</para> 35 36 <screen><userinput>mount -vft tmpfs tmpfs $LFS/dev 37 mount -vft tmpfs tmpfs $LFS/dev/shm 38 mount -vft devpts -o gid=4,mode=620 devpts $LFS/dev/pts</userinput></screen> 77 </sect2> 39 78 40 79 </sect1> -
chapter06/pkgmgt.xml
rdd7ed7b rd2c332bc 39 39 the <ulink url="&hints-root;">Hints subproject</ulink> and see if one of them 40 40 fits your need.</para> 41 42 <note>43 <para>As no particular package management technique is mentioned in LFS,44 the commands in the remainder of this book must be performed while logged in45 as user <systemitem class="username">root</systemitem> and no longer as user46 <systemitem class="username">lfs</systemitem>. Also, double check that47 <envar>$LFS</envar> is set.</para>48 </note>49 41 50 42 <sect2> -
chapter06/udev.xml
rdd7ed7b rd2c332bc 27 27 <seglistitem> 28 28 <seg>0.1 SBU</seg> 29 <seg> 3.8 MB</seg>29 <seg>4.8 MB</seg> 30 30 </seglistitem> 31 31 </segmentedlist> … … 44 44 <title>Installation of Udev</title> 45 45 46 <para>Create some devices and directories that Udev cannot handle due to 47 them being required very early in the boot process:</para> 48 49 <screen><userinput>install -dv /lib/{firmware,udev/devices/{pts,shm}} 50 mknod -m0666 /lib/udev/devices/null c 1 3 51 ln -sv /proc/self/fd /lib/udev/devices/fd 52 ln -sv /proc/self/fd/0 /lib/udev/devices/stdin 53 ln -sv /proc/self/fd/1 /lib/udev/devices/stdout 54 ln -sv /proc/self/fd/2 /lib/udev/devices/stderr 55 ln -sv /proc/kcore /lib/udev/devices/core</userinput></screen> 56 46 57 <para>Compile the package:</para> 47 58 48 <screen><userinput>make EXTRAS=extras/run_directory</userinput></screen> 59 <screen><userinput>make EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \ 60 extras/firmware extras/floppy extras/scsi_id \ 61 extras/usb_id extras/volume_id"</userinput></screen> 49 62 50 63 <variablelist> … … 52 65 53 66 <varlistentry> 54 <term><parameter>EXTRAS=extras/run_directory</parameter></term> 55 <listitem> 56 <para>This builds the <command>udev_run_devd</command> and 57 <command>udev_run_hotplugd</command> binaries, which are required 58 for correct handling of hotpluggable devices.</para> 67 <term><parameter>EXTRAS=...</parameter></term> 68 <listitem> 69 <para>This builds several helper binaries that can aid in writing custom 70 Udev rules.</para> 59 71 </listitem> 60 72 </varlistentry> … … 67 79 <para>Install the package:</para> 68 80 69 <screen><userinput>make DESTDIR=/ EXTRAS=extras/run_directory install</userinput></screen> 81 <screen><userinput>make DESTDIR=/ \ 82 EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \ 83 extras/firmware extras/floppy extras/scsi_id \ 84 extras/usb_id extras/volume_id" install</userinput></screen> 70 85 71 86 <variablelist> … … 88 103 <screen><userinput>cp -v ../&udev-config-file; /etc/udev/rules.d/25-lfs.rules</userinput></screen> 89 104 105 <para>Create some rules that work around broken sysfs attribute creation 106 timing in linux-2.6.15:</para> 107 108 <screen><userinput>cat >> /etc/udev/rules.d/10-wait_for_sysfs.rules << "EOF" 109 ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" 110 ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" 111 EOF</userinput></screen> 112 90 113 <para>Install the documentation that explains how to create Udev rules:</para> 91 114 92 115 <screen><userinput>install -m644 -D -v docs/writing_udev_rules/index.html /usr/share/doc/udev-&udev-version;/index.html</userinput></screen> 93 116 94 <!-- Not for the LiveCD --> 95 <!-- Edit Me --> 96 <para>Run the <command>udevstart</command> program to create our full 97 complement of device nodes.</para> 98 99 <screen><userinput>/sbin/udevstart</userinput></screen> 117 <important> 118 119 <para>When Udev is started by the LFS-Bootscripts, a replay of all kernel 120 device events happens. These events tell Udev what devices exist. 121 Sometimes the Udev bootscript doesn't wait long enough for 122 <command>udevd</command> to process all of the replayed events and 123 consequently the devices for those missed events are not created before the 124 script exits. Since <command>udevd</command> is still running in the 125 background, the devices will be created a few milliseconds later, but the 126 next bootscript to run may require a device to exist before it has been 127 created. To avoid such missed events, and to avoid hardcoding an overly 128 long wait time, It is recommended that you run the following commands to 129 aid the LFS development team in debugging these missed events and finding 130 an acceptable solution more quickly.</para> 131 132 <para>First, create a simple C file:</para> 133 134 <screen><userinput>cat > bug.c << EOF 135 <literal>/* Simple event recorder */ 136 #define _GNU_SOURCE 137 #include <sys/types.h> 138 #include <sys/stat.h> 139 #include <fcntl.h> 140 #include <unistd.h> 141 #include <stdlib.h> 142 #include <argz.h> 143 int main(int argc, char * argv[]) 144 { 145 char * envz; 146 size_t len; 147 int bug; 148 bug = open("/dev/bug", O_WRONLY | O_APPEND); 149 if (bug == -1) 150 return 0; 151 setenv("_SEPARATOR", "--------------------------------------", 1); 152 argz_create(environ, &envz, &len); 153 argz_stringify(envz, len, '\n'); 154 envz[len-1]='\n'; 155 write(bug, envz, len); 156 close(bug); 157 free(envz); 158 return 0; 159 }</literal> 160 EOF</userinput></screen> 161 162 <para>Now compile it:</para> 163 164 <screen><userinput>gcc -o /lib/udev/bug bug.c</userinput></screen> 165 166 <para>The next step adds a simple logging rule to run this program.</para> 167 168 <screen><userinput>cat > /etc/udev/rules.d/90-bug.rules << "EOF" 169 <literal>ACTION=="add", RUN+="bug"</literal> 170 EOF</userinput></screen> 171 172 <para>When booting the new LFS system, if any events are missed, a warning 173 message will appear and a <filename>/dev/bugreport</filename> file will be 174 created. The warning message will tell you where to send feedback.</para> 175 176 </important> 100 177 101 178 </sect2> … … 109 186 110 187 <seglistitem> 111 <seg>udev, udev_run_devd, udev_run_hotplugd, udevcontrol, udevd, 112 udevinfo, udevmonitor, udevsend, udevstart, and udevtest</seg> 188 <seg>ata_id, cdrom_id, create_floppy_devices, edd_id, firmware_helper, 189 scsi_id, udevcontrol, udevd, udevinfo, udevmonitor, udevtest, usb_id 190 and vol_id</seg> 113 191 <seg>/etc/udev</seg> 114 192 </seglistitem> … … 120 198 <?dbhtml list-presentation="table"?> 121 199 122 <varlistentry id="udev"> 123 <term><command>udev</command></term> 124 <listitem> 125 <para>Creates device nodes in <filename class="directory">/dev</filename> 126 or renames network interfaces (not in LFS) in response to hotplug 127 events</para> 128 <indexterm zone="ch-system-udev udev"> 129 <primary sortas="b-udev">udev</primary> 130 </indexterm> 131 </listitem> 132 </varlistentry> 133 134 <varlistentry id="udev_run_devd"> 135 <term><command>udev_run_devd</command></term> 136 <listitem> 137 <para>Executes programs and scripts in the <filename 138 class="directory">/etc/dev.d/</filename> directory in response to 139 hotplug events</para> 140 <indexterm zone="ch-system-udev udev_run_devd"> 141 <primary sortas="b-udev_run_devd">udev_run_devd</primary> 142 </indexterm> 143 </listitem> 144 </varlistentry> 145 146 <varlistentry id="udev_run_hotplugd"> 147 <term><command>udev_run_hotplugd</command></term> 148 <listitem> 149 <para>Executes programs and scripts in the <filename 150 class="directory">/etc/hotplug.d/</filename> directory in response 151 to hotplug events</para> 152 <indexterm zone="ch-system-udev udev_run_hotplugd"> 153 <primary sortas="b-udev_run_hotplugd">udev_run_hotplugd</primary> 200 <varlistentry id="ata_id"> 201 <term><command>ata_id</command></term> 202 <listitem> 203 <para>Provides Udev with a unique string and 204 additional information (uuid, label) for an ATA drive</para> 205 <indexterm zone="ch-system-udev ata_id"> 206 <primary sortas="b-ata_id">ata_id</primary> 207 </indexterm> 208 </listitem> 209 </varlistentry> 210 211 <varlistentry id="cdrom_id"> 212 <term><command>cdrom_id</command></term> 213 <listitem> 214 <para>Provides Udev with the capabilities of a 215 CD-ROM or DVD-ROM drive</para> 216 <indexterm zone="ch-system-udev cdrom_id"> 217 <primary sortas="b-cdrom_id">cdrom_id</primary> 218 </indexterm> 219 </listitem> 220 </varlistentry> 221 222 <varlistentry id="create_floppy_devices"> 223 <term><command>create_floppy_devices</command></term> 224 <listitem> 225 <para>Creates all possible floppy devices based on the CMOS type</para> 226 <indexterm zone="ch-system-udev create_floppy_devices"> 227 <primary sortas="b-create_floppy_devices">create_floppy_devices</primary> 228 </indexterm> 229 </listitem> 230 </varlistentry> 231 232 <varlistentry id="edd_id"> 233 <term><command>edd_id</command></term> 234 <listitem> 235 <para>Provides Udev with the EDD ID for a BIOS disk drive</para> 236 <indexterm zone="ch-system-udev edd_id"> 237 <primary sortas="b-edd_id">edd_id</primary> 238 </indexterm> 239 </listitem> 240 </varlistentry> 241 242 <varlistentry id="firmware_helper"> 243 <term><command>firmware_helper</command></term> 244 <listitem> 245 <para>Uploads firmware to devices</para> 246 <indexterm zone="ch-system-udev firmware_helper"> 247 <primary sortas="b-firmware_helper">firmware_helper</primary> 248 </indexterm> 249 </listitem> 250 </varlistentry> 251 252 <varlistentry id="scsi_id"> 253 <term><command>scsi_id</command></term> 254 <listitem> 255 <para>Provides Udev with a unique SCSI identifier 256 based on the data returned from sending a SCSI INQUIRY command to 257 the specified device</para> 258 <indexterm zone="ch-system-udev scsi_id"> 259 <primary sortas="b-scsi_id">scsi_id</primary> 154 260 </indexterm> 155 261 </listitem> … … 170 276 <term><command>udevd</command></term> 171 277 <listitem> 172 <para>A daemon that reorders hotplug events before submitting them to 173 <command>udev</command>, thus avoiding various race conditions</para> 278 <para>A daemon that listens for uevents on the netlink socket, 279 creates devices and runs the configured external programs in 280 response to these uevents</para> 174 281 <indexterm zone="ch-system-udev udevd"> 175 282 <primary sortas="b-udevd">udevd</primary> … … 181 288 <term><command>udevinfo</command></term> 182 289 <listitem> 183 <para>Allows users to query the <command>udev</command>database for290 <para>Allows users to query the Udev database for 184 291 information on any device currently present on the system; it also 185 292 provides a way to query any device in the <systemitem … … 195 302 <term><command>udevmonitor</command></term> 196 303 <listitem> 197 <para>Prints the event received from the kernel and the e vent which198 <command>udev</command>sends out after rule processing</para>304 <para>Prints the event received from the kernel and the environment 305 which Udev sends out after rule processing</para> 199 306 <indexterm zone="ch-system-udev udevmonitor"> 200 307 <primary sortas="b-udevmonitor">udevmonitor</primary> … … 203 310 </varlistentry> 204 311 205 <varlistentry id="udevsend">206 <term><command>udevsend</command></term>207 <listitem>208 <para>Delivers hotplug events to <command>udevd</command></para>209 <indexterm zone="ch-system-udev udevsend">210 <primary sortas="b-udevsend">udevsend</primary>211 </indexterm>212 </listitem>213 </varlistentry>214 215 <varlistentry id="udevstart">216 <term><command>udevstart</command></term>217 <listitem>218 <para>Creates device nodes in <filename class="directory">/dev</filename>219 that correspond to drivers compiled directly into the kernel; it220 performs that task by simulating hotplug events presumably dropped by221 the kernel before invocation of this program (e.g., because the root222 filesystem has not been mounted) and submitting such synthetic hotplug223 events to <command>udev</command></para>224 <indexterm zone="ch-system-udev udevstart">225 <primary sortas="b-udevstart">udevstart</primary>226 </indexterm>227 </listitem>228 </varlistentry>229 230 312 <varlistentry id="udevtest"> 231 313 <term><command>udevtest</command></term> 232 314 <listitem> 233 <para>Simulates a <command>udev</command> run for the given device, 234 and prints out the name of the node the real <command>udev</command> 235 would have created or (not in LFS) the name of the renamed network 236 interface</para> 315 <para>Simulates a uevent for the given device, and prints out the 316 name of the node the real <command>udevd</command> would have created, 317 or the name of the renamed network interface</para> 237 318 <indexterm zone="ch-system-udev udevtest"> 238 319 <primary sortas="b-udevtest">udevtest</primary> … … 241 322 </varlistentry> 242 323 324 <varlistentry id="usb_id"> 325 <term><command>usb_id</command></term> 326 <listitem> 327 <para>Provides Udev with information about USB 328 devices</para> 329 <indexterm zone="ch-system-udev usb_id"> 330 <primary sortas="b-usb_id">usb_id</primary> 331 </indexterm> 332 </listitem> 333 </varlistentry> 334 335 <varlistentry id="vol_id"> 336 <term><command>vol_id</command></term> 337 <listitem> 338 <para>Provides Udev with the label and uuid of a 339 filesystem</para> 340 <indexterm zone="ch-system-udev vol_id"> 341 <primary sortas="b-vol_id">vol_id</primary> 342 </indexterm> 343 </listitem> 344 </varlistentry> 345 243 346 <varlistentry id="etc-udev"> 244 347 <term><filename class="directory">/etc/udev</filename></term> 245 348 <listitem> 246 <para>Contains <command>udev</command>configuation files,349 <para>Contains Udev configuation files, 247 350 device permissions, and rules for device naming</para> 248 351 <indexterm zone="ch-system-udev etc-udev"> -
chapter07/bootscripts.xml
rdd7ed7b rd2c332bc 57 57 58 58 <seglistitem> 59 <seg>checkfs, cleanfs, console, functions, halt, hotplug,ifdown, ifup,59 <seg>checkfs, cleanfs, console, functions, halt, ifdown, ifup, 60 60 localnet, mountfs, mountkernfs, network, rc, reboot, sendsignals, 61 61 setclock, static, swap, sysklogd, template, and udev</seg> … … 126 126 </varlistentry> 127 127 128 <varlistentry id="hotplug-bootscripts">129 <term><command>hotplug</command></term>130 <listitem>131 <para>Loads modules for system devices</para>132 <indexterm zone="ch-scripts-bootscripts hotplug-bootscripts">133 <primary sortas="d-hotplug">hotplug</primary>134 </indexterm>135 </listitem>136 </varlistentry>137 138 128 <varlistentry id="ifdown-bootscripts"> 139 129 <term><command>ifdown</command></term> -
chapter07/network.xml
rdd7ed7b rd2c332bc 23 23 symlinks from all run-level directories (<filename 24 24 class="directory">/etc/rc.d/rc*.d</filename>).</para> 25 26 <sect2> 27 <title>Creating stable names for network interfaces</title> 28 29 <para>Instructions in this section are optional if you have only one 30 network card.</para> 31 32 <para>With Udev and modular network drivers, the network interface numbering 33 is not persistent across reboots by default, because the drivers are loaded 34 in parallel and, thus, in random order. For example, on a computer having 35 two network cards made by Intel and Realtek, the network card manufactured 36 by Intel may become <filename class="devicefile">eth0</filename> and the 37 Realtek card becomes <filename class="devicefile">eth1</filename>. In some 38 cases, after a reboot the cards get renumbered the other way around. To 39 avoid this, create Udev rules that assign stable names to network cards 40 based on their MAC addresses.</para> 41 42 <para>First, find out the MAC addresses of your network cards:</para> 43 44 <screen role="nodump"><userinput>grep -H . /sys/class/net/*/address</userinput></screen> 45 46 <para>For each network card (but not for the loopback interface), 47 invent a descriptive name, such as <quote>realtek</quote>, and create 48 Udev rules similar to the following:</para> 49 50 <screen role="nodump"><userinput>cat > /etc/udev/rules.d/26-network.rules << "EOF" 51 <literal>ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="<replaceable>52:54:00:12:34:56</replaceable>", NAME="<replaceable>realtek</replaceable>" 52 ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="<replaceable>00:a0:c9:78:9a:bc</replaceable>", NAME="<replaceable>intel</replaceable>"</literal> 53 EOF</userinput></screen> 54 55 <para>These rules will always rename the network cards to 56 <quote>realtek</quote> and <quote>intel</quote>, independently of the 57 original numbering provided by the kernel. Use these names instead of 58 <quote>eth0</quote> in the network interface configuration files created 59 below.</para> 60 61 <note> 62 <para>Persistent names must be different from the default network 63 interface names assigned by the kernel.</para> 64 </note> 65 66 </sect2> 25 67 26 68 <sect2> -
chapter07/udev.xml
rdd7ed7b rd2c332bc 24 24 method, whereby a great many device nodes are created under <filename 25 25 class="directory">/dev</filename> (sometimes literally thousands of nodes), 26 regardless of whether the corresponding hardware devices actually exist. This is 27 typically done via a <command>MAKEDEV</command> script, which contains a number 28 of calls to the <command>mknod</command> program with the relevant major and 29 minor device numbers for every possible device that might exist in the world. 30 Using the Udev method, only those devices which are detected by the kernel get 31 device nodes created for them. Because these device nodes will be created each 32 time the system boots, they will be stored on a <systemitem 26 regardless of whether the corresponding hardware devices actually exist. This 27 is typically done via a <command>MAKEDEV</command> script, which contains a 28 number of calls to the <command>mknod</command> program with the relevant 29 major and minor device numbers for every possible device that might exist in 30 the world.</para> 31 32 <para>Using the Udev method, only those devices which are detected by the 33 kernel get device nodes created for them. Because these device nodes will be 34 created each time the system boots, they will be stored on a <systemitem 33 35 class="filesystem">tmpfs</systemitem> file system (a virtual file system that 34 36 resides entirely in system memory). Device nodes do not require much space, so … … 51 53 device names are allowed to be configurable, then the device naming policy 52 54 should be up to a system administrator, not imposed on them by any 53 particular developer(s). The <systemitem class="filesystem">devfs</systemitem> 54 file system also suffers from race conditions that are inherent in its design 55 and cannot be fixed without a substantial revision to the kernel. It has also 56 been marked as deprecated due to a lack of recent maintenance.</para> 57 58 <para>With the development of the unstable 2.5 kernel tree, later released as 59 the 2.6 series of stable kernels, a new virtual filesystem called <systemitem 60 class="filesystem">sysfs</systemitem> came to be. The job of <systemitem 61 class="filesystem">sysfs</systemitem> is to export a view of the system's 62 hardrware configuration to userspace processes. With this userspace-visible 63 representation, the possibility of seeing a userspace replacement for 64 <systemitem class="filesystem">devfs</systemitem> became much more 65 realistic.</para> 55 particular developer(s). The <systemitem 56 class="filesystem">devfs</systemitem> file system also suffers from race 57 conditions that are inherent in its design and cannot be fixed without a 58 substantial revision to the kernel. It has also been marked as deprecated 59 due to a lack of recent maintenance.</para> 60 61 <para>With the development of the unstable 2.5 kernel tree, later released 62 as the 2.6 series of stable kernels, a new virtual filesystem called 63 <systemitem class="filesystem">sysfs</systemitem> came to be. The job of 64 <systemitem class="filesystem">sysfs</systemitem> is to export a view of 65 the system's hardware configuration to userspace processes. With this 66 userspace-visible representation, the possibility of seeing a userspace 67 replacement for <systemitem class="filesystem">devfs</systemitem> became 68 much more realistic.</para> 66 69 67 70 </sect2> … … 70 73 <title>Udev Implementation</title> 71 74 72 <para>The <systemitem class="filesystem">sysfs</systemitem> filesystem was 73 mentioned briefly above. One may wonder how <systemitem 74 class="filesystem">sysfs</systemitem> knows about the devices present on 75 a system and what device numbers should be used for them. Drivers that have 76 been compiled into the kernel directly register their objects with 77 <systemitem class="filesystem">sysfs</systemitem> as they are detected by 78 the kernel. For drivers compiled as modules, this registration will happen 79 when the module is loaded. Once the <systemitem 80 class="filesystem">sysfs</systemitem> filesystem is mounted (on <filename 81 class="directory">/sys</filename>), data which the built-in drivers 82 registered with <systemitem class="filesystem">sysfs</systemitem> are 83 available to userspace processes and to <command>udev</command> for device 84 node creation.</para> 85 86 <para>The <command>S10udev</command> initscript takes care of creating 87 these device nodes when Linux is booted. This script starts by registering 88 <command>/sbin/udevsend</command> as a hotplug event handler. Hotplug events 89 (discussed below) are not usually generated during this stage, but 90 <command>udev</command> is registered just in case they do occur. The 91 <command>udevstart</command> program then walks through the <systemitem 92 class="filesystem">/sys</systemitem> filesystem and creates devices under 93 <filename class="directory">/dev</filename> that match the descriptions. 94 For example, <filename>/sys/class/tty/vcs/dev</filename> contains the 95 string <quote>7:0</quote> This string is used by <command>udevstart</command> 96 to create <filename>/dev/vcs</filename> with major number 97 <emphasis>7</emphasis> and minor <emphasis>0</emphasis>. The names and 98 permissions of the nodes created under the <filename 99 class="directory">/dev</filename> directory are configured according to the 100 rules specified in the files within the <filename 101 class="directory">/etc/udev/rules.d/</filename> directory. These are 102 numbered in a similar fashion to the LFS-Bootscripts package. If 103 <command>udev</command> can't find a rule for the device it is creating, 104 it will default permissions to <emphasis>660</emphasis> and ownership to 105 <emphasis>root:root</emphasis>.</para> 106 107 <para>Once the above stage is complete, all devices that were already present 108 and have compiled-in drivers will be available for use. This leads us to the 109 devices that have modular drivers.</para> 110 111 <para>Earlier, we mentioned the concept of a <quote>hotplug event 112 handler.</quote> When a new device connection is detected by the kernel, 113 the kernel will generate a hotplug event and look at the file 114 <filename>/proc/sys/kernel/hotplug</filename> to determine the userspace 115 program that handles the device's connection. The <command>udev</command> 116 bootscript registered <command>udevsend</command> as this handler. When 117 these hotplug events are generated, the kernel will tell 118 <command>udev</command> to check the <filename 119 class="directory">/sys</filename> filesystem for the information pertaining 120 to this new device and create the <filename class="directory">/dev</filename> 121 entry for it.</para> 122 123 <para>This brings us to one problem that exists with <command>udev</command>, 124 and likewise with <systemitem class="filesystem">devfs</systemitem> before it. 125 It is commonly referred to as the <quote>chicken and egg</quote> problem. Most 126 Linux distributions handle loading modules via entries in 127 <filename>/etc/modules.conf</filename>. Access to a device node causes the 128 appropriate kernel module to load. With <command>udev</command>, this method 129 will not work because the device node does not exist until the module is loaded. 130 To solve this, the <command>S05modules</command> bootscript was added to the 131 LFS-Bootscripts package, along with the 132 <filename>/etc/sysconfig/modules</filename> file. By adding module names to the 133 <filename>modules</filename> file, these modules will be loaded when the 134 computer starts up. This allows <command>udev</command> to detect the devices 135 and create the appropriate device nodes.</para> 136 137 <para>Note that on slower machines or for drivers that create a lot of device 138 nodes, the process of creating devices may take a few seconds to complete. 139 This means that some device nodes may not be immediately accessible.</para> 75 <sect3> 76 <title>Sysfs</title> 77 78 <para>The <systemitem class="filesystem">sysfs</systemitem> filesystem was 79 mentioned briefly above. One may wonder how <systemitem 80 class="filesystem">sysfs</systemitem> knows about the devices present on 81 a system and what device numbers should be used for them. Drivers that 82 have been compiled into the kernel directly register their objects with 83 <systemitem class="filesystem">sysfs</systemitem> as they are detected by 84 the kernel. For drivers compiled as modules, this registration will happen 85 when the module is loaded. Once the <systemitem 86 class="filesystem">sysfs</systemitem> filesystem is mounted (on <filename 87 class="directory">/sys</filename>), data which the built-in drivers 88 registered with <systemitem class="filesystem">sysfs</systemitem> are 89 available to userspace processes and to <command>udevd</command> for device 90 node creation.</para> 91 92 </sect3> 93 94 <sect3> 95 <title>Udev Bootscript</title> 96 97 <para>The <command>S10udev</command> initscript takes care of creating 98 device nodes when Linux is booted. The script starts by unsetting the 99 hotplug event handler from the default of <command>/sbin/hotplug</command> 100 This is done because, instead of the kernel calling out to an external 101 binary, <command>udevd</command> will listen on a netlink socket for 102 hotplug events that the kernel raises. The bootscript copies any static 103 device nodes that exist in <filename 104 class="directory">/lib/udev/devices</filename> to <filename 105 class="directory">/dev</filename>. This is necessary because some devices, 106 directories and symlinks are needed before the dynamic device handling 107 processes are available during the early stages of booting a system. 108 Creating static device nodes in 109 <filename class="directory">/lib/udev/devices</filename> also provides 110 an easy workaround for devices that are not supported by the dynamic 111 device handling infrastructure. The bootscript then starts the Udev 112 daemon, <command>udevd</command>, which will act on any hotplug events it 113 receives. Finally, the bootscript "coldplugs" any devices that 114 have already been registered with the kernel by forcing them to raise 115 hotplug events which <command>udevd</command> will then handle.</para> 116 117 </sect3> 118 119 <sect3> 120 <title>Device Node Creation</title> 121 122 <para>To obtain the right major and minor number for a device, Udev relies 123 on the information provided by <systemitem 124 class="filesystem">sysfs</systemitem> in <filename 125 class="directory">/sys</filename>. For example, 126 <filename>/sys/class/tty/vcs/dev</filename> contains the string 127 <quote>7:0</quote>. This string is used by <command>udevd</command> 128 to create a device node with major number <emphasis>7</emphasis> and minor 129 <emphasis>0</emphasis>. The names and permissions of the nodes created 130 under the <filename class="directory">/dev</filename> directory are 131 determined by rules specified in the files within the <filename 132 class="directory">/etc/udev/rules.d/</filename> directory. These are 133 numbered in a similar fashion to the LFS-Bootscripts package. If 134 <command>udevd</command> can't find a rule for the device it is creating, 135 it will default permissions to <emphasis>660</emphasis> and ownership to 136 <emphasis>root:root</emphasis>. Documentation on the syntax of the Udev 137 rules configuration files are available in 138 <filename>/usr/share/doc/udev-&udev-version;/index.html</filename></para> 139 140 </sect3> 141 142 <sect3> 143 <title>Module Loading</title> 144 145 <para>Device drivers compiled as modules may have aliases built into them. 146 Aliases are visible in the output of the <command>modinfo</command> 147 program and are usually related to the bus-specific identifiers of devices 148 supported by a module. For example, the <emphasis>snd-fm801</emphasis> 149 driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801, 150 and has an alias of <quote>pci:v00001319d00000801sv*sd*bc04sc01i*</quote>. 151 For most devices, the bus driver exports the alias of the driver that 152 would handle the device via <systemitem 153 class="filesystem">sysfs</systemitem>. E.g., the 154 <filename>/sys/bus/pci/devices/0000:00:0d.0/modalias</filename> file 155 might contain the string 156 <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>. 157 The rules that LFS installs will cause <command>udevd</command> to call 158 out to <command>/sbin/modprobe</command> with the contents of the 159 <envar>MODALIAS</envar> uevent environment variable (that should be the 160 same as the contents of the <filename>modalias</filename> file in sysfs), 161 thus loading all modules whose aliases match this string after wildcard 162 expansion.</para> 163 164 <para>In this example, this means that, in addition to 165 <emphasis>snd-fm801</emphasis>, the obsolete (and unwanted) 166 <emphasis>forte</emphasis> driver will be loaded if it is 167 available. See below for ways in which the loading of unwanted drivers can 168 be prevented.</para> 169 170 <para>The kernel itself is also able to load modules for network 171 protocols, filesystems and NLS support on demand.</para> 172 173 </sect3> 174 175 <sect3> 176 <title>Handling Hotpluggable/Dynamic Devices</title> 177 178 <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3 179 player, the kernel recognizes that the device is now connected and 180 generates a hotplug event. This hotplug event is then handled by 181 <command>udevd</command> as described above.</para> 182 183 </sect3> 140 184 141 185 </sect2> 142 186 143 187 <sect2> 144 <title>Handling Hotpluggable/Dynamic Devices</title> 145 146 <para>When you plug in a device, such as a Universal Serial Bus (USB) MP3 147 player, the kernel recognizes that the device is now connected and generates 148 a hotplug event. If the driver is already loaded (either because it was 149 compiled into the kernel or because it was loaded via the 150 <command>S05modules</command> bootscript), <command>udev</command> will be 151 called upon to create the relevant device node(s) according to the 152 <systemitem class="filesystem">sysfs</systemitem> data available in 153 <filename class="directory">/sys</filename>.</para> 154 155 <para>If the driver for the just plugged in device is available as a module but 156 currently unloaded, the Hotplug package will load the appropriate module 157 and make this device available by creating the device node(s) for it.</para> 158 159 </sect2> 160 161 <sect2> 162 <title>Problems with Creating Devices</title> 163 164 <para>There are a few known problems when it comes to automatically creating 165 device nodes:</para> 166 167 <para>1) A kernel driver may not export its data to <systemitem 168 class="filesystem">sysfs</systemitem>.</para> 169 170 <para>This is most common with third party drivers from outside the kernel 171 tree. Udev will be unable to automatically create device nodes for such 172 drivers. Use the <filename>/etc/sysconfig/createfiles</filename> 173 configuration file to manually create the devices. Consult the 174 <filename>devices.txt</filename> file inside the kernel documentation or 175 the documentation for that driver to find the proper major/minor 176 numbers.</para> 177 178 <para>2) A non-hardware device is required. This is most common with 179 the Advanced Linux Sound Architecture (ALSA) project's Open Sound 180 System (OSS) compatibility module. These types of devices can be 181 handled in one of two ways:</para> 182 183 <itemizedlist> 184 185 <listitem> 186 <para>Adding the module names to 187 <filename>/etc/sysconfig/modules</filename></para> 188 </listitem> 189 190 <listitem> 191 <para>Using an <quote>install</quote> line in 192 <filename>/etc/modprobe.conf</filename>. This tells the 193 <command>modprobe</command> command <quote>when loading this module, 194 also load this other module, at the same time.</quote> 195 For example:</para> 196 197 <screen role="nodump"><userinput>install snd-pcm modprobe -i snd-pcm ; modprobe \ 198 snd-pcm-oss ; true</userinput></screen> 199 200 <para>This will cause the system to load both the 201 <emphasis>snd-pcm</emphasis> and <emphasis>snd-pcm-oss</emphasis> 202 modules when any request is made to load the driver 203 <emphasis>snd-pcm</emphasis>.</para> 204 </listitem> 205 206 </itemizedlist> 188 <title>Problems with Loading Modules and Creating Devices</title> 189 190 <para>There are a few possible problems when it comes to automatically 191 creating device nodes.</para> 192 193 <sect3> 194 <title>A kernel module is not loaded automatically</title> 195 196 <para>Udev will only load a module if it has a bus-specific alias and the 197 bus driver properly exports the necessary aliases to <systemitem 198 class="filesystem">sysfs</systemitem>. In other cases, one should 199 arrange module loading by other means. With Linux-&linux-version;, Udev is 200 known to load properly-written drivers for PCI, USB, SCSI, SERIO and 201 FireWire devices.</para> 202 203 <!-- After linux-2.6.16, add INPUT and IDE to the list above --> 204 205 <para>To determine if the device driver you require has the necessary 206 support for Udev, run <command>modinfo</command> with the module name as 207 the argument. Now try locating the device directory under 208 <filename class="directory">/sys/bus</filename> and check whether there is 209 a <filename>modalias</filename> file there.</para> 210 211 <para>If the <filename>modalias</filename> file exists in <systemitem 212 class="filesystem">sysfs</systemitem>, the driver supports the device and 213 can talk to it directly, but doesn't have the alias, it is a bug in the 214 driver. Load the driver without the help from Udev and expect the issue 215 to be fixed later.</para> 216 217 <para>If there is no <filename>modalias</filename> file in the relevant 218 directory under <filename class="directory">/sys/bus</filename>, this 219 means that the kernel developers have not yet added modalias support to 220 this bus type. With Linux-&linux-version;, this is the case with ISA and 221 IDE busses. Expect this issue to be fixed in later kernel versions.</para> 222 223 <!-- Remove IDE from the list above after Linux-2.6.16 --> 224 225 <para>Udev is not intended to load <quote>wrapper</quote> drivers such as 226 <emphasis>snd-pcm-oss</emphasis> and non-hardware drivers such as 227 <emphasis>loop</emphasis> at all.</para> 228 229 </sect3> 230 231 <sect3> 232 <title>A kernel module is not loaded automatically, and Udev is not 233 intended to load it</title> 234 235 <para>If the <quote>wrapper</quote> module only enhances the functionality 236 provided by some other module (e.g., <emphasis>snd-pcm-oss</emphasis> 237 enhances the functionality of <emphasis>snd-pcm</emphasis> by making the 238 sound cards available to OSS applications), configure 239 <command>modprobe</command> to load the wrapper after Udev loads the 240 wrapped module. To do this, add an <quote>install</quote> line in 241 <filename>/etc/modprobe.conf</filename>. For example:</para> 242 243 <screen role="nodump"><literal>install snd-pcm modprobe -i snd-pcm ; modprobe \ 244 snd-pcm-oss ; true</literal></screen> 245 246 <para>If the module in question is not a wrapper and is useful by itself, 247 configure the <command>S05modules</command> bootscript to load this 248 module on system boot. To do this, add the module name to the 249 <filename>/etc/sysconfig/modules</filename> file on a separate line. 250 This works for wrapper modules too, but is suboptimal in that case.</para> 251 252 </sect3> 253 254 <sect3> 255 <title>Udev loads some unwanted module</title> 256 257 <para>Either don't build the module, or blacklist it in 258 <filename>/etc/modprobe.conf</filename> file as done with the 259 <emphasis>forte</emphasis> module in the example below:</para> 260 261 <screen role="nodump"><literal>blacklist forte</literal></screen> 262 263 <para>Blacklisted modules can still be loaded manually with the 264 explicit <command>modprobe</command> command.</para> 265 266 </sect3> 267 268 <sect3> 269 <title>Udev creates a device incorrectly, or makes a wrong symlink</title> 270 271 <para>This usually happens if a rule unexpectedly matches a device. For 272 example, a poorly-writen rule can match by both a SCSI disk (as desired) 273 and the corresponding SCSI generic device (incorrectly) by vendor. 274 Increase the logging verbosity of Udev, find the offending rule by 275 examining the logs and make it more specific.</para> 276 277 </sect3> 278 279 <sect3> 280 <title>Udev rule works unreliably</title> 281 282 <para>This may be another manifestation of the previous problem. If not, 283 and your rule uses <systemitem class="filesystem">sysfs</systemitem> 284 attributes, it may be a kernel timing issue, to be fixed in later kernels. 285 For now, you can work around it by creating a rule that waits for the used 286 <systemitem class="filesystem">sysfs</systemitem> attribute and appending 287 it to the <filename>/etc/udev/rules.d/10-wait_for_sysfs.rules</filename> 288 file. Please notify the LFS Development list if you do so and it 289 helps.</para> 290 291 </sect3> 292 293 <sect3> 294 <title>Udev does not create a device</title> 295 296 <para>Further text assumes that the driver is built statically into the 297 kernel or already loaded as a module, and that you have already checked 298 that Udev doesn't create a misnamed device.</para> 299 300 <para>Udev has no information needed to create a device node if a kernel 301 driver does not export its data to <systemitem 302 class="filesystem">sysfs</systemitem>. 303 This is most common with third party drivers from outside the kernel 304 tree. Create a static device node in 305 <filename>/lib/udev/devices</filename> with the appropriate major/minor 306 numbers (see the file <filename>devices.txt</filename> inside the kernel 307 documentation or the documentation provided by the third party driver 308 vendor). The static device node will be copied to 309 <filename class="directory">/dev</filename> by the 310 <command>S10udev</command> bootscript.</para> 311 312 </sect3> 313 314 <sect3> 315 <title>Device naming order changes randomly after rebooting</title> 316 317 <para>This is due to the fact that Udev, by design, handles uevents and 318 loads modules in parallel, and thus in an unpredictable order. This will 319 never be <quote>fixed</quote>. You should not rely upon the kernel device 320 names being stable. Instead, create your own rules that make symlinks with 321 stable names based on some stable attributes of the device, such as a 322 serial number or the output of various *_id utilities installed by Udev. 323 See also the network interface renaming example in 324 <xref linkend="ch-scripts-network"/>.</para> 325 326 </sect3> 207 327 208 328 </sect2> -
chapter08/kernel.xml
rdd7ed7b rd2c332bc 25 25 26 26 <seglistitem> 27 <seg> 4.20SBU</seg>28 <seg> 181MB</seg>27 <seg>2.4 SBU</seg> 28 <seg>344 MB</seg> 29 29 </seglistitem> 30 30 </segmentedlist> … … 99 99 <screen><userinput>make</userinput></screen> 100 100 101 <para>If using kernel modules, an <filename>/etc/modprobe.conf</filename> file 102 may be needed. Information pertaining to modules and kernel configuration is 103 located in the kernel documentation in the <filename 101 <para>If using kernel modules, an <filename>/etc/modprobe.conf</filename> 102 file may be needed. Information pertaining to modules and kernel 103 configuration is located in <xref linkend="ch-scripts-udev"/> and in the 104 kernel documentation in the <filename 104 105 class="directory">linux-&linux-version;/Documentation</filename> directory. 105 106 Also, <filename>modprobe.conf(5)</filename> may be of interest.</para> 106 107 <para>Be very careful when reading other documentation relating to kernel108 modules because it usually applies to 2.4.x kernels only. As far as we know,109 kernel configuration issues specific to Hotplug and Udev are not documented.110 The problem is that Udev will create a device node only if Hotplug or a111 user-written script inserts the corresponding module into the kernel, and not112 all modules are detectable by Hotplug. Note that statements like the one below113 in the <filename>/etc/modprobe.conf</filename> file do not work with114 Udev:</para>115 116 <screen><literal>alias char-major-XXX some-module</literal></screen>117 118 <para>Because of the complications with Hotplug, Udev, and modules, we119 strongly recommend starting with a completely non-modular kernel120 configuration, especially if this is the first time using Udev.</para>121 107 122 108 <para>Install the modules, if the kernel configuration uses them:</para> -
general.ent
rdd7ed7b rd2c332bc 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <!ENTITY version "SVN-2006041 2">3 <!ENTITY releasedate "April 1 2, 2006">2 <!ENTITY version "SVN-20060413"> 3 <!ENTITY releasedate "April 13, 2006"> 4 4 <!ENTITY milestone "6.2"> 5 5 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> … … 53 53 <!ENTITY grub-version "0.97"> 54 54 <!ENTITY gzip-version "1.3.5"> 55 <!ENTITY hotplug-version "2004_09_23">56 55 <!ENTITY iana-etc-version "2.00"> 57 56 <!ENTITY inetutils-version "1.4.2"> 58 <!ENTITY iproute2-version " 051007">57 <!ENTITY iproute2-version "2.6.16-060323"> 59 58 <!ENTITY kbd-version "1.12"> 60 59 <!ENTITY less-version "394"> 61 <!ENTITY lfs-bootscripts-version " 20060321">60 <!ENTITY lfs-bootscripts-version "udev_update-20060321"> 62 61 <!ENTITY libtool-version "1.5.22"> 63 <!ENTITY linux-version "2.6.1 2.5">62 <!ENTITY linux-version "2.6.16.1"> 64 63 <!ENTITY linux-dl-version "2.6"> 65 64 <!ENTITY linux-libc-headers-version "2.6.12.0"> … … 84 83 <!ENTITY tcl-version "8.4.12"> 85 84 <!ENTITY texinfo-version "4.8"> 86 <!ENTITY udev-version "0 71">87 <!ENTITY udev-config-file "udev-config- 5.rules">85 <!ENTITY udev-version "088"> 86 <!ENTITY udev-config-file "udev-config-6.rules"> 88 87 <!ENTITY util-linux-version "2.12r"> 89 88 <!ENTITY vim-version "6.4"> -
patches.ent
rdd7ed7b rd2c332bc 31 31 <!ENTITY inetutils-man_pages-patch "inetutils-&inetutils-version;-no_server_man_pages-1.patch"> 32 32 33 <!ENTITY linux-utf8-patch "linux-&linux-version;-utf8_input- 2.patch">33 <!ENTITY linux-utf8-patch "linux-&linux-version;-utf8_input-1.patch"> 34 34 35 35 <!ENTITY mktemp-tempfile-patch "mktemp-&mktemp-version;-add_tempfile-3.patch">
Note:
See TracChangeset
for help on using the changeset viewer.