aboutsummaryrefslogtreecommitdiffstats
path: root/chapter07
diff options
context:
space:
mode:
authorManuel Canales Esparcia <manuel@linuxfromscratch.org>2006-08-03 19:29:29 +0000
committerManuel Canales Esparcia <manuel@linuxfromscratch.org>2006-08-03 19:29:29 +0000
commitc226182dc5ff37f733c895ab16483ebd37c02bcc (patch)
tree82a9abff83df5aa35fec4fd1539091cfb7920ef2 /chapter07
parenta15464dfe656aec48ced77b2ded760f0cc639ad7 (diff)
Ported updates from 6.2 branch.
Small tags fixes. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7758 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter07')
-rw-r--r--chapter07/network.xml54
-rw-r--r--chapter07/symlinks.xml35
2 files changed, 65 insertions, 24 deletions
diff --git a/chapter07/network.xml b/chapter07/network.xml
index 884aeb94f..62f6f2c22 100644
--- a/chapter07/network.xml
+++ b/chapter07/network.xml
@@ -48,26 +48,31 @@
invent a descriptive name, such as <quote>realtek</quote>, and create
Udev rules similar to the following:</para>
-<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/26-network.rules &lt;&lt; "EOF"
-<literal>ACTION=="add", SUBSYSTEM=="net", DRIVER=="?*", SYSFS{address}=="<replaceable>00:e0:4c:12:34:56</replaceable>", NAME="<replaceable>realtek</replaceable>"
-ACTION=="add", SUBSYSTEM=="net", DRIVER=="?*", SYSFS{address}=="<replaceable>00:a0:c9:78:9a:bc</replaceable>", NAME="<replaceable>intel</replaceable>"</literal>
+<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/26-network.rules &lt;&lt; EOF
+<literal>ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="<replaceable>00:e0:4c:12:34:56</replaceable>", \
+ NAME="<replaceable>realtek</replaceable>"
+ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="<replaceable>00:a0:c9:78:9a:bc</replaceable>", \
+ NAME="<replaceable>intel</replaceable>"</literal>
EOF</userinput></screen>
- <para>The DRIVER=="?*" key prevents Udev from attempting to rename 8021Q
- VLAN interfaces (not available without the Vlan package from
- <ulink url="http://www.candelatech.com/~greear/vlan/"/>).
- This is necessary since VLANs have the same MAC address as
- the real network card.</para>
-
<!-- Yes, I know that VLANs are beyond BLFS. This is not the reason to get them
incorrect by default when every distro does this right. -->
-
+
+ <note>
+ <para>Although the examples in this book work properly, be aware
+ that Udev does not recognize the backslash for line continuation.
+ If modifying Udev rules with an editor, be sure to leave each rule
+ on one physical line.</para>
+ </note>
+
<para>If you are going to use the bus position as a key, create
Udev rules similar to the following:</para>
-<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/26-network.rules &lt;&lt; "EOF"
-<literal>ACTION=="add", SUBSYSTEM=="net", BUS=="<replaceable>pci</replaceable>", ID=="<replaceable>0000:00:0c.0</replaceable>", NAME="<replaceable>realtek</replaceable>"
-ACTION=="add", SUBSYSTEM=="net", BUS=="<replaceable>pci</replaceable>", ID=="<replaceable>0000:00:0d.0</replaceable>", NAME="<replaceable>intel</replaceable>"</literal>
+<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/26-network.rules &lt;&lt; EOF
+<literal>ACTION=="add", SUBSYSTEM=="net", BUS=="<replaceable>pci</replaceable>", ID=="<replaceable>0000:00:0c.0</replaceable>", \
+ NAME="<replaceable>realtek</replaceable>"
+ACTION=="add", SUBSYSTEM=="net", BUS=="<replaceable>pci</replaceable>", ID=="<replaceable>0000:00:0d.0</replaceable>", \
+ NAME="<replaceable>intel</replaceable>"</literal>
EOF</userinput></screen>
<para>These rules will always rename the network cards to
@@ -79,6 +84,29 @@ EOF</userinput></screen>
of <quote>eth0</quote> in the network interface configuration files
below.</para>
+ <para>Note that the rules above don't work for every setup. For example,
+ MAC-based rules break when bridges or VLANs are used, because bridges and
+ VLANs have the same MAC address as the network card. One wants to rename
+ only the network card interface, not the bridge or VLAN interface, but the
+ example rule matches both. If you use such virtual interfaces, you have two
+ potential solutions. One is to add the DRIVER=="?*" key after
+ SUBSYSTEM=="net" in MAC-based rules which will stop matching the virtual
+ interfaces. This is known to fail with some older Ethernet cards because
+ they don't have the DRIVER variable in the uevent and thus the rule does
+ not match with such cards. Another solution is to switch to rules that use
+ the bus position as a key.</para>
+
+ <para>The second known non-working case is with wireless cards using the
+ MadWifi or HostAP drivers, because they create at least two interfaces with
+ the same MAC address and bus position. For example, the Madwifi driver
+ creates both an athX and a wifiX interface where X is a digit. To
+ differentiate these interfaces, add an appropriate KERNEL parameter such as
+ KERNEL=="ath*" after SUBSYSTEM=="net".</para>
+
+ <para>There may be other cases where the rules above don't work. Currently,
+ bugs on this topic are still being reported to Linux distributions, and no
+ solution that covers every case is available.</para>
+
</sect2>
<sect2>
diff --git a/chapter07/symlinks.xml b/chapter07/symlinks.xml
index c3e799867..5538aed27 100644
--- a/chapter07/symlinks.xml
+++ b/chapter07/symlinks.xml
@@ -32,14 +32,23 @@
location of the device on the bus. If you are going to use the first
approach, create a file similar to the following:</para>
-<screen role="nodump"><userinput>cat &gt;/etc/udev/rules.d/82-cdrom.rules &lt;&lt;"EOF"
+<screen role="nodump"><userinput>cat &gt;/etc/udev/rules.d/82-cdrom.rules &lt;&lt; EOF
<literal>
# Custom CD-ROM symlinks
-SUBSYSTEM=="block", ENV{ID_MODEL}=="SAMSUNG_CD-ROM_SC-148F", ENV{ID_REVISION}=="PS05", SYMLINK+="cdrom"
-SUBSYSTEM=="block", ENV{ID_MODEL}=="PHILIPS_CDD5301", ENV{ID_SERIAL}=="5VO1306DM00190", SYMLINK+="cdrom1 dvd"
+SUBSYSTEM=="block", ENV{ID_MODEL}=="SAMSUNG_CD-ROM_SC-148F", \
+ ENV{ID_REVISION}=="PS05", SYMLINK+="cdrom"
+SUBSYSTEM=="block", ENV{ID_MODEL}=="PHILIPS_CDD5301", \
+ ENV{ID_SERIAL}=="5VO1306DM00190", SYMLINK+="cdrom1 dvd"
</literal>
EOF</userinput></screen>
+ <note>
+ <para>Although the examples in this book work properly, be aware
+ that Udev does not recognize the backslash for line continuation.
+ If modifying Udev rules with an editor, be sure to leave each rule
+ on one physical line.</para>
+ </note>
+
<para>This way, the symlinks will stay correct even if you move the drives
to different positions on the IDE bus, but the
<filename>/dev/cdrom</filename> symlink won't be created if you replace
@@ -49,17 +58,19 @@ EOF</userinput></screen>
<para>The SUBSYSTEM==&quot;block&quot; key is needed in order to avoid
matching SCSI generic devices. Without it, in the case with SCSI
- CD-ROMs, the symlinks will sometimes point to the correct
+ CD-ROMs, the symlinks will sometimes point to the correct
<filename>/dev/srX</filename> devices, and sometimes to
<filename>/dev/sgX</filename>, which is wrong.</para>
-
+
<para>The second approach yields:</para>
-<screen role="nodump"><userinput>cat &gt;/etc/udev/rules.d/82-cdrom.rules &lt;&lt;"EOF"
+<screen role="nodump"><userinput>cat &gt;/etc/udev/rules.d/82-cdrom.rules &lt;&lt; EOF
<literal>
# Custom CD-ROM symlinks
-SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", ENV{ID_PATH}=="pci-0000:00:07.1-ide-0:1", SYMLINK+="cdrom"
-SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", ENV{ID_PATH}=="pci-0000:00:07.1-ide-1:1", SYMLINK+="cdrom1 dvd"
+SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", \
+ ENV{ID_PATH}=="pci-0000:00:07.1-ide-0:1", SYMLINK+="cdrom"
+SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", \
+ ENV{ID_PATH}=="pci-0000:00:07.1-ide-1:1", SYMLINK+="cdrom1 dvd"
</literal>
EOF</userinput></screen>
@@ -105,11 +116,13 @@ EOF</userinput></screen>
<para>Then write rules that create the symlinks, e.g.:</para>
-<screen role="nodump"><userinput>cat &gt;/etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt;"EOF"
+<screen role="nodump"><userinput>cat &gt;/etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; EOF
<literal>
# Persistent symlinks for webcam and tuner
-KERNEL=="video*", SYSFS{idProduct}=="1910", SYSFS{idVendor}=="0d81", SYMLINK+="webcam"
-KERNEL=="video*", SYSFS{device}=="0x036f", SYSFS{vendor}=="0x109e", SYMLINK+="tvtuner"
+KERNEL=="video*", SYSFS{idProduct}=="1910", SYSFS{idVendor}=="0d81", \
+ SYMLINK+="webcam"
+KERNEL=="video*", SYSFS{device}=="0x036f", SYSFS{vendor}=="0x109e", \
+ SYMLINK+="tvtuner"
</literal>
EOF</userinput></screen>