Ignore:
Timestamp:
May 14, 2014, 1:21:04 AM (10 years ago)
Author:
Chris Staub <chris@…>
Branches:
clfs-3.0.0-sysvinit, sysvinit
Children:
056e32f4
Parents:
db71344
Message:

Created sysvinit branch

Location:
BOOK/bootscripts/common
Files:
5 added
5 moved

Legend:

Unmodified
Added
Removed
  • BOOK/bootscripts/common/eudev.xml

    rdb71344 r82fc053  
    66]>
    77
    8 <sect1 id="ch-scripts-udev">
    9   <?dbhtml filename="udev.html"?>
     8<sect1 id="ch-scripts-eudev">
     9  <?dbhtml filename="eudev.html"?>
    1010
    1111  <title>Device and Module Handling on a CLFS System</title>
    1212
    13   <indexterm zone="ch-scripts-udev">
    14     <primary sortas="a-systemd">Systemd</primary>
    15     <secondary>udev usage</secondary>
     13  <indexterm zone="ch-scripts-eudev">
     14    <primary sortas="a-Eudev">Eudev</primary>
     15    <secondary>usage</secondary>
    1616  </indexterm>
    1717
    18   <para>In <xref linkend="chapter-building-system"/>, we installed systemd,
    19   which contains systemd-udevd, previously known as Udev. Before we go into
    20   the details regarding how this works, a brief history of previous methods of
    21   handling devices is in order.</para>
     18  <para>In <xref linkend="chapter-building-system"/>, we installed the Eudev
     19  package. Before we go into the details regarding how this works,
     20  a brief history of previous methods of handling devices is in
     21  order.</para>
    2222
    2323  <para>Linux systems in general traditionally use a static device creation
     
    3030  the world.</para>
    3131
    32   <para>Using the Udev method, only those devices which are detected by the
     32  <para>Using the Eudev method, only those devices which are detected by the
    3333  kernel get device nodes created for them. Because these device nodes will be
    3434  created each time the system boots, they will be stored on a <systemitem
     
    7171
    7272  <sect2>
    73     <title>Udev Implementation</title>
     73    <title>Eudev Implementation</title>
    7474
    7575    <sect3>
     
    9393
    9494    <sect3>
     95      <title>Eudev Bootscript</title>
     96
     97      <para>The <command>S10udev</command> initscript takes care of creating
     98      device nodes when Linux is booted. The script unsets the uevent handler
     99      from the default of <command>/sbin/hotplug</command>.  This is done
     100      because the kernel no longer needs to call out to an external binary.
     101      Instead <command>udevd</command> will listen on a netlink socket for
     102      uevents that the kernel raises. Next, 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 <filename
     109      class="directory">/lib/udev/devices</filename> also provides an easy
     110      workaround for devices that are not supported by the dynamic device
     111      handling infrastructure. The bootscript then starts the Eudev daemon,
     112      <command>udevd</command>, which will act on any uevents it receives.
     113      Finally, the bootscript forces the kernel to replay uevents for any
     114      devices that have already been registered and then waits for
     115      <command>udevd</command> to handle them.</para>
     116
     117    </sect3>
     118
     119    <sect3>
    95120      <title>Device Node Creation</title>
    96121
    97       <para>To obtain the right major and minor number for a device, Udev relies
     122      <para>To obtain the right major and minor number for a device, Eudev relies
    98123      on the information provided by <systemitem
    99124      class="filesystem">sysfs</systemitem> in <filename
     
    104129      <emphasis>0</emphasis>. The names and permissions of the nodes created
    105130      under the <filename class="directory">/dev</filename> directory are
    106       determined by rules specified in the files within the
    107       <filename class="directory">/lib/udev/rules.d</filename> and <filename
    108       class="directory">/etc/udev/rules.d/</filename> directories. These files
    109       have names that start with numbers, and are evaluated in numerical order.
    110       If <command>udevd</command> can't find a rule for the device it is
    111       creating, it will default permissions to <emphasis>660</emphasis> and
    112       ownership to <emphasis>root:root</emphasis>. </para>
     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 CLFS-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 Eudev
     137      rules configuration files is available in
     138      <filename>/usr/share/doc/udev/writing_udev_rules/index.html</filename></para>
    113139
    114140    </sect3>
     
    129155      might contain the string
    130156      <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>.
    131       The default rules provided by Udev will cause <command>udevd</command>
     157      The default rules provided by Eudev will cause <command>udevd</command>
    132158      to call out to <command>/sbin/modprobe</command> with the contents of the
    133159      <envar>MODALIAS</envar> uevent environment variable (that should be the
     
    168194      <title>A kernel module is not loaded automatically</title>
    169195
    170       <para>Udev will only load a module if it has a bus-specific alias and the
     196      <para>Eudev will only load a module if it has a bus-specific alias and the
    171197      bus driver properly exports the necessary aliases to <systemitem
    172198      class="filesystem">sysfs</systemitem>. In other cases, one should
    173       arrange module loading by other means. With Linux-&linux-version;, Udev is
     199      arrange module loading by other means. With Linux-&linux-version;, Eudev is
    174200      known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI,
    175201      SERIO and FireWire devices.</para>
    176202
    177203      <para>To determine if the device driver you require has the necessary
    178       support for Udev, run <command>modinfo</command> with the module name as
     204      support for Eudev, run <command>modinfo</command> with the module name as
    179205      the argument.  Now try locating the device directory under
    180206      <filename class="directory">/sys/bus</filename> and check whether there is
     
    184210      class="filesystem">sysfs</systemitem>, the driver supports the device and
    185211      can talk to it directly, but doesn't have the alias, it is a bug in the
    186       driver. Load the driver without the help from Udev and expect the issue
     212      driver. Load the driver without the help from Eudev and expect the issue
    187213      to be fixed later.</para>
    188214
     
    193219      busses. Expect this issue to be fixed in later kernel versions.</para>
    194220
    195       <para>Udev is not intended to load <quote>wrapper</quote> drivers such as
     221      <para>Eudev is not intended to load <quote>wrapper</quote> drivers such as
    196222      <emphasis>snd-pcm-oss</emphasis> and non-hardware drivers such as
    197223      <emphasis>loop</emphasis> at all.</para>
     
    200226
    201227    <sect3>
    202       <title>A kernel module is not loaded automatically, and Udev is not
     228      <title>A kernel module is not loaded automatically, and Eudev is not
    203229      intended to load it</title>
    204230
     
    207233      enhances the functionality of <emphasis>snd-pcm</emphasis> by making the
    208234      sound cards available to OSS applications), configure
    209       <command>modprobe</command> to load the wrapper after Udev loads the
    210       wrapped module. To do this, add an <quote>install</quote> line to a file
    211       in <filename>/etc/modprobe.d</filename>. For example:</para>
     235      <command>modprobe</command> to load the wrapper after Eudev loads the
     236      wrapped module. To do this, add an <quote>install</quote> line in
     237      <filename>/etc/modprobe.conf</filename>. For example:</para>
    212238
    213239<screen role="nodump"><literal>install snd-pcm /sbin/modprobe -i snd-pcm ; \
    214240    /sbin/modprobe snd-pcm-oss ; true</literal></screen>
    215241
    216     </sect3>
    217 
    218     <sect3>
    219       <title>Udev loads some unwanted module</title>
     242      <para>If the module in question is not a wrapper and is useful by itself,
     243      configure the <command>S05modules</command> bootscript to load this
     244      module on system boot. To do this, add the module name to the
     245      <filename>/etc/sysconfig/modules</filename> file on a separate line.
     246      This works for wrapper modules too, but is suboptimal in that case.</para>
     247
     248    </sect3>
     249
     250    <sect3>
     251      <title>Eudev loads some unwanted module</title>
    220252
    221253      <para>Either don't build the module, or blacklist it in
    222       <filename>/etc/modprobe.d</filename> file as done with the
     254      <filename>/etc/modprobe.conf</filename> file as done with the
    223255      <emphasis>forte</emphasis> module in the example below:</para>
    224256
     
    231263
    232264    <sect3>
    233       <title>Udev creates a device incorrectly, or makes a wrong symlink</title>
     265      <title>Eudev creates a device incorrectly, or makes a wrong symlink</title>
    234266
    235267      <para>This usually happens if a rule unexpectedly matches a device. For
     
    242274
    243275    <sect3>
    244       <title>Udev rule works unreliably</title>
     276      <title>Eudev rule works unreliably</title>
    245277
    246278      <para>This may be another manifestation of the previous problem. If not,
     
    256288
    257289    <sect3>
    258       <title>Udev does not create a device</title>
     290      <title>Eudev does not create a device</title>
    259291
    260292      <para>Further text assumes that the driver is built statically into the
    261293      kernel or already loaded as a module, and that you have already checked
    262       that Udev doesn't create a misnamed device.</para>
    263 
    264       <para>Udev has no information needed to create a device node if a kernel
     294      that Eudev doesn't create a misnamed device.</para>
     295
     296      <para>Eudev has no information needed to create a device node if a kernel
    265297      driver does not export its data to <systemitem
    266298      class="filesystem">sysfs</systemitem>.
     
    279311      <title>Device naming order changes randomly after rebooting</title>
    280312
    281       <para>This is due to the fact that Udev, by design, handles uevents and
     313      <para>This is due to the fact that Eudev, by design, handles uevents and
    282314      loads modules in parallel, and thus in an unpredictable order. This will
    283315      never be <quote>fixed</quote>. You should not rely upon the kernel device
    284316      names being stable. Instead, create your own rules that make symlinks with
    285317      stable names based on some stable attributes of the device, such as a
    286       serial number or the output of various *_id utilities installed by Udev.
     318      serial number or the output of various *_id utilities installed by Eudev.
    287319      See <xref linkend="ch-scripts-symlinks"/> and
    288320      <xref linkend="chapter-network"/> for examples.</para>
  • BOOK/bootscripts/common/locale.xml

    rdb71344 r82fc053  
    1111
    1212  <indexterm zone="ch-scripts-locale">
    13     <primary sortas="e-/etc/locale.conf">/etc/locale.conf</primary>
     13    <primary sortas="e-/etc/profile">/etc/profile</primary>
    1414  </indexterm>
    1515
    16   <para>The <filename>/etc/locale.conf</filename> below sets some environment
    17   variables necessary for native language support. Setting them properly
    18   results in:</para>
     16  <para>The base <filename>/etc/profile</filename> below sets some
     17  environment variables necessary for native language support. Setting
     18  them properly results in:</para>
    1919
    2020  <itemizedlist>
     
    2323    </listitem>
    2424    <listitem>
    25       <para>Correct classification of characters into letters, digits and other
    26       classes. This is necessary for <command>bash</command> to properly accept
    27       non-ASCII characters in command lines in non-English locales</para>
     25      <para>Correct classification of characters into letters, digits and
     26      other classes. This is necessary for <command>bash</command> to
     27      properly accept non-ASCII characters in command lines in non-English
     28      locales</para>
    2829    </listitem>
    2930    <listitem>
     
    3839  </itemizedlist>
    3940
     41  <para>This script also sets the <envar>INPUTRC</envar> environment variable
     42  that makes Bash and Readline use the <filename>/etc/inputrc</filename> file
     43  created earlier.</para>
     44
    4045  <para>Replace <replaceable>[ll]</replaceable> below with the
    4146  two-letter code for the desired language (e.g., <quote>en</quote>) and
    4247  <replaceable>[CC]</replaceable> with the two-letter code for the
    43   appropriate country (e.g., <quote>GB</quote> or <quote>US</quote>).
     48  appropriate country (e.g., <quote>GB</quote>).
    4449  <replaceable>[charmap]</replaceable> should be replaced with the
    45   canonical charmap for your chosen locale. Optional modifiers such as
    46   <quote>@euro</quote> may also be present.</para>
     50  canonical charmap for your chosen locale.</para>
    4751
    4852  <para>The list of all locales supported by Glibc can be obtained by running
     
    6771
    6872  <para>This results in a final locale setting of <quote>en_US.UTF-8</quote>.
    69   It is important that the locale found using the heuristic above is tested
    70   prior to it being added to <filename>/etc/locale.conf</filename>:</para>
     73  It is important that the locale found using the heuristic above is tested prior
     74  to it being added to the Bash startup files:</para>
    7175
    72 <screen role="nodump"><userinput>LC_ALL=[locale name] locale territory
     76<screen role="nodump"><userinput>LC_ALL=[locale name] locale territory 
    7377LC_ALL=[locale name] locale language
    7478LC_ALL=[locale name] locale charmap
     
    104108
    105109  <para>Other packages can also function incorrectly (but may not necessarily
    106   display any error messages) if the locale name does not meet their
    107   expectations. In those cases, investigating how other Linux distributions
    108   support your locale might provide some useful information.</para>
     110  display any error messages) if the locale name does not meet their expectations.
     111  In those cases, investigating how other Linux distributions support your locale
     112  might provide some useful information.</para>
    109113
    110114  <para>Once the proper locale settings have been determined, create the
    111   <filename>/etc/locale.conf</filename> file:</para>
     115  <filename>/etc/profile</filename> file:</para>
    112116
    113 <screen><userinput>cat &gt; /etc/locale.conf &lt;&lt; "EOF"
    114 <literal># Begin /etc/locale.conf
     117<screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
     118<literal># Begin /etc/profile
    115119
    116 LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable><replaceable>[@modifiers]</replaceable>
     120export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable>
     121export INPUTRC=/etc/inputrc
    117122
    118 # End /etc/locale.conf</literal>
     123# End /etc/profile</literal>
    119124EOF</userinput></screen>
    120125
    121   <para>Note that you can modify <filename>/etc/locale.conf</filename> with
    122   systemd's <command>localectl</command> utility. To use
    123   <command>localectl</command> for the example above, run:</para>
    124 
    125 <screen role="nodump"><userinput>localectl set-locale LANG="<replaceable>[ll]_[CC][charmap][@modifiers]</replaceable>"</userinput></screen>
    126 
    127   <para>You can also specify other language specific environment variables such
    128   as <envar>LANG</envar>, <envar>LC_CTYPE</envar>, <envar>LC_NUMERIC</envar> or
    129   any other environment variable from <command>locale</command> output. Just
    130   separate them with a space. An example where <envar>LANG</envar> is set as
    131   en_US.UTF-8 but <envar>LC_CTYPE</envar> is set as just en_US is:</para>
    132 
    133 <screen role="nodump"><userinput>localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US"</userinput></screen>
    134 
    135   <note><para>Please note that <command>localectl</command> command can
    136   be used  only on a system booted with systemd.</para></note>
    137126  <para>Setting the keyboard layout, screen font, and locale-related
    138127  environment variables are the only internationalization steps needed to
  • BOOK/bootscripts/common/profile.xml

    rdb71344 r82fc053  
    3838  <para>The files <filename>/etc/profile</filename> and
    3939  <filename>~/.bash_profile</filename> are read when the shell is
    40   invoked as an interactive login shell. Create a base
    41   <filename>/etc/profile</filename> that will setup locale information and load
    42   any bash auto completion files that may be on the system. This script also
    43   sets the <envar>INPUTRC</envar> environment variable that makes Bash and
    44   Readline use <filename>/etc/inputrc</filename>.</para>
    45 
    46 <screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
    47 <literal># Begin /etc/profile
    48 
    49 source /etc/locale.conf
    50 for f in /etc/bash_completion.d/*.sh; do source $f; done; unset f
    51 export INPUTRC=/etc/inputrc
    52 
    53 # End /etc/profile</literal>
    54 EOF</userinput></screen>
     40  invoked as an interactive login shell. In the next section, a base
     41  <filename>/etc/profile</filename> will be created to set up locale
     42  information.</para>
    5543
    5644</sect1>
  • BOOK/bootscripts/common/symlinks.xml

    rdb71344 r82fc053  
    4545    <note>
    4646      <para>Although the examples in this book work properly, be aware
    47       that Udev does not recognize the backslash for line continuation.
    48       If modifying Udev rules with an editor, be sure to leave each rule
     47      that Eudev does not recognize the backslash for line continuation.
     48      If modifying Eudev rules with an editor, be sure to leave each rule
    4949      on one physical line.</para>
    5050    </note>
     
    8989    <title>Dealing with duplicate devices</title>
    9090
    91     <para>As explained in <xref linkend="ch-scripts-udev"/>, the order in
     91    <para>As explained in <xref linkend="ch-scripts-eudev"/>, the order in
    9292    which devices with the same function appear in
    9393    <filename class="directory">/dev</filename> is essentially random.
     
    134134    device.</para>
    135135
     136    <para>More information on writing Eudev rules can be found in
     137    <filename>/usr/share/doc/udev/writing_udev_rules/index.html</filename>.</para>
     138
    136139 </sect2>
    137140
Note: See TracChangeset for help on using the changeset viewer.