mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-03-06 06:14:47 +00:00
Move directory to make build easier
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9973 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
166497f2c6
commit
b2b1e1aa5f
@ -28,13 +28,3 @@ sed -i -e s/BOOTSCRIPTS-SIZE/$bootsize/ \
|
|||||||
-e s/BOOTSCRIPTS-INSTALL-KB/$bootinstallsize/ \
|
-e s/BOOTSCRIPTS-INSTALL-KB/$bootinstallsize/ \
|
||||||
-e s/BOOTSCRIPTS-MD5SUM/$bootmd5/ $FILE
|
-e s/BOOTSCRIPTS-MD5SUM/$bootmd5/ $FILE
|
||||||
|
|
||||||
############
|
|
||||||
|
|
||||||
# udev configuration tarball data
|
|
||||||
#udevconfig=$(ls udev-config*.bz2)
|
|
||||||
#udevsize=$(ls -lk $udevconfig | cut -f5 -d" ")
|
|
||||||
#udevmd5=$(md5sum $udevconfig | cut -f1 -d" ")
|
|
||||||
|
|
||||||
#sed -i -e s/UDEV-SIZE/$udevsize/ \
|
|
||||||
# -e s/UDEV-MD5SUM/$udevmd5/ $FILE
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ for s in bootscripts/lfs/init.d/* \
|
|||||||
bootscripts/lfs/sysconfig/* \
|
bootscripts/lfs/sysconfig/* \
|
||||||
bootscripts/lfs/lib/services/* \
|
bootscripts/lfs/lib/services/* \
|
||||||
bootscripts/lfs/sbin/* \
|
bootscripts/lfs/sbin/* \
|
||||||
../udev-lfs/*.rules
|
udev-lfs/*.rules
|
||||||
do
|
do
|
||||||
script=$(basename $s)
|
script=$(basename $s)
|
||||||
|
|
||||||
|
14
udev-lfs/55-lfs.rules
Normal file
14
udev-lfs/55-lfs.rules
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# /etc/udev/rules.d/55-lfs.rules: Rule definitions for LFS.
|
||||||
|
|
||||||
|
# Core kernel devices
|
||||||
|
|
||||||
|
# This causes the system clock to be set as soon as /dev/rtc becomes available.
|
||||||
|
SUBSYSTEM=="rtc", ACTION=="add", MODE="0644", RUN+="/etc/rc.d/init.d/setclock start"
|
||||||
|
KERNEL=="rtc", ACTION=="add", MODE="0644", RUN+="/etc/rc.d/init.d/setclock start"
|
||||||
|
|
||||||
|
# Comms devices
|
||||||
|
|
||||||
|
KERNEL=="ippp[0-9]*", GROUP="dialout"
|
||||||
|
KERNEL=="isdn[0-9]*", GROUP="dialout"
|
||||||
|
KERNEL=="isdnctrl[0-9]*", GROUP="dialout"
|
||||||
|
KERNEL=="dcbri[0-9]*", GROUP="dialout"
|
254
udev-lfs/ChangeLog
Normal file
254
udev-lfs/ChangeLog
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
2010-01-26 Matt Burgess <matthew@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Remove lots of rules that have been merged upstream.
|
||||||
|
* 61-cdrom.rules: Remove as upstream has a replacement.
|
||||||
|
* doc/*: Cleanup and rewrite now that the rules are much simpler.
|
||||||
|
|
||||||
|
2009-09-25 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Make the RTC rule (which runs setclock) work for people
|
||||||
|
that don't use the RTC-class driver -- add another copy of the rule,
|
||||||
|
using KERNEL=="rtc" instead of SUBSYSTEM=="rtc". Also move the ACTION
|
||||||
|
match before the assignment to MODE.
|
||||||
|
|
||||||
|
2009-05-23 Bruce Dubbs <bdubbs@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Set the rtc by udev upon boot. Removed aio device from
|
||||||
|
udev configuration so defaults are used.
|
||||||
|
|
||||||
|
2009-05-16 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Adopt udev permissions for random, urandom, kmsg, and
|
||||||
|
input devices (including psaux, which probably doesn't exist anymore
|
||||||
|
anyway).
|
||||||
|
|
||||||
|
2009-05-16 Matt Burgess <matthew@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Remove the block rule as it was only setting
|
||||||
|
permissions that Udev will set by default
|
||||||
|
* 55-lfs.rules: Remove the rfcomm rule as the group it sets is already
|
||||||
|
included in upstream's rule
|
||||||
|
* 55-lfs-rules: Remove the tape rules as the group they sets is already
|
||||||
|
included in upstream's rules
|
||||||
|
|
||||||
|
2009-03-15 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Remove the ISDN-handling rules (replaced with upstream's
|
||||||
|
version, which has a better match via SUBSYSTEM).
|
||||||
|
* 55-lfs.rules: Replace "uucp" with "dialout" now that udev has decided
|
||||||
|
to standardize on a Debian-like setup (uucp is for UUCP daemons to use
|
||||||
|
for privilege separation; dialout is for users and devices).
|
||||||
|
|
||||||
|
2008-12-07 Bruce Dubbs <bdubbs@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Change one line to use continuation so it does
|
||||||
|
not overflow the book's width.
|
||||||
|
|
||||||
|
2008-12-07 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Remove several rules that are either provided by upstream,
|
||||||
|
or that don't have any effect (there is no /dev/js or /dev/djs according
|
||||||
|
to devices.txt).
|
||||||
|
* 55-lfs.rules, 61-cdrom.rules: Replace ACTION=="add" with "add|change"
|
||||||
|
everywhere, per upstream's general request.
|
||||||
|
|
||||||
|
2008-11-11 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules, 61-cdrom.rules: Fix comments to use the right rule
|
||||||
|
numbers. Thanks to Trent Shea for the fix. Closes #2278.
|
||||||
|
|
||||||
|
2008-10-15 DJ Lucas <dj@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Override default perms on floppy disk devices provided
|
||||||
|
by 50-udev-default.rules. Thanks to Bruce Dubbs for the fix. Closes
|
||||||
|
LFS ticket #2076.
|
||||||
|
|
||||||
|
2008-05-21 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 81-firmware.rules, doc/81-firmware.txt: Remove. This rule is
|
||||||
|
already handled by udev's 50-udev-default.rules file. The docs
|
||||||
|
can be added back later if needed.
|
||||||
|
* Makefile: Don't install the above deleted files.
|
||||||
|
* 55-lfs.rules: Remove the device-mapper rule, since the upstream
|
||||||
|
50-udev-default.rules file handles it properly.
|
||||||
|
|
||||||
|
2008-04-02 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* Makefile: Make the package DESTDIR-friendly by installing the docs
|
||||||
|
into a fixed $(PREFIX)/share/doc/udev-config directory, instead of
|
||||||
|
trying to figure out what version of udev was just installed.
|
||||||
|
|
||||||
|
2007-10-30 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 55-lfs.rules: Since the dialout group was renamed to uucp, delete
|
||||||
|
the rules that override upstream's assignment of the dialout group.
|
||||||
|
Replace "dialout" with "uucp" on the remaining rules.
|
||||||
|
|
||||||
|
2007-10-29 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 51-lfs.rules: Move to 55-lfs.rules.
|
||||||
|
* doc/51-lfs.rules: Move to doc/55-lfs.rules.
|
||||||
|
|
||||||
|
2007-10-27 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 25-lfs.rules: Some rules in here are duplicates of rules from udev's
|
||||||
|
new 50-udev-defaults.rules file; remove them. Override permissions
|
||||||
|
where needed elsewhere (and document overrides in comments).
|
||||||
|
* 26-modprobe.rules: Provided by udev's 80-drivers.rules and built-in
|
||||||
|
modaliases for SCSI device-type modules in 2.6.22+ kernels; remove.
|
||||||
|
|
||||||
|
* 25-lfs.rules: Move to 51-lfs.rules.
|
||||||
|
* 27-firmware.rules: Move to 81-firmware.rules.
|
||||||
|
* 81-cdrom.rules: Move to 61-cdrom.rules.
|
||||||
|
|
||||||
|
* doc/25-lfs.txt: Rename to 51-lfs.txt.
|
||||||
|
* doc/26-modprobe.txt: Rename to 80-drivers.txt, and modify to reflect
|
||||||
|
the upstream rules.
|
||||||
|
* doc/27-firmware.txt: Rename to 81-firmware.txt.
|
||||||
|
* doc/81-cdrom.txt: Rename to 61-cdrom.txt.
|
||||||
|
|
||||||
|
* Makefile: Use new filenames.
|
||||||
|
|
||||||
|
2007-07-31 Dan Nicholson <dnicholson@linuxfromscratch.org>
|
||||||
|
* 25-lfs.rules: Changed the usb_device rule tto create /dev/bus/usb
|
||||||
|
nodes if the usb_device in 2.6.22+ kernels. The rule was also changed
|
||||||
|
to only trigger on "add" events. This change is not backwards
|
||||||
|
compatible with older kernels.
|
||||||
|
|
||||||
|
2007-06-12 Dan Nicholson <dnicholson@linuxfromscratch.org>
|
||||||
|
* 25-lfs.rules: Fix the CPUID nodes from cpu/%n/cpu to cpu/%n/cpuid,
|
||||||
|
which is what's expected in userspace apps such as x86info.
|
||||||
|
|
||||||
|
2007-06-08 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 25-lfs.rules: Add rules for DVB devices (create nodes in /dev/dvb/)
|
||||||
|
and floppies (create extra nodes based on CMOS type), copied from
|
||||||
|
the SuSE rules file. Thanks to Alexander Patrakov for the bugreport.
|
||||||
|
|
||||||
|
2007-03-04 Matthew Burgess <matthew@linuxfromscratch.org>
|
||||||
|
* Makefile: Use `udevd --version' to work out what version of Udev is
|
||||||
|
installed (requires Udev >= 106)
|
||||||
|
|
||||||
|
2007-01-02 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 25-lfs.rules: Change CPU devices (cpu, msr, microcode) to be in
|
||||||
|
/dev/cpu/ and /dev/cpu/N/, to match Documentation/devices.txt.
|
||||||
|
|
||||||
|
2006-10-21 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* Makefile: Add a missing backslash in install-extra-doc.
|
||||||
|
|
||||||
|
* 05-udev-early.rules, 60-persistent-input.rules,
|
||||||
|
60-persistent-storage.rules, 95-udev-late.rules: Remove. The book
|
||||||
|
will install these files from udev's etc/udev/rules.d directory
|
||||||
|
instead.
|
||||||
|
* Makefile: Don't install these rules files after all. Also, only
|
||||||
|
install corresponding docs if requested.
|
||||||
|
|
||||||
|
2006-10-20 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* Makefile: Added; contains targets to install rules and doc files.
|
||||||
|
From Dan Nicholson.
|
||||||
|
|
||||||
|
2006-10-14 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 05-udev-early.rules, 60-persistent-storage.rules: Sync up with
|
||||||
|
upstream sample rules files (from udev-102), except for one rule
|
||||||
|
which is more specific in our tarball and should probably be changed
|
||||||
|
upstream.
|
||||||
|
* doc/60-persistent-storage.txt: Modify to match the changes. Also
|
||||||
|
fix a couple typos.
|
||||||
|
|
||||||
|
* 25-lfs.rules: Remove duplicate rules (ttyS[0-9]* is also matched by
|
||||||
|
tty[BC...S...][0-9]*, and ttyUSB[0-9]* is in there twice).
|
||||||
|
|
||||||
|
* 25-lfs.rules: Fix Alsa device KERNEL rules. Udev uses shell-style
|
||||||
|
glob matching, not regular expressions, so the old rules would match
|
||||||
|
nonsense device names like hw0asdf and pcmDzxcv. As long as the first
|
||||||
|
character after the "fixed" portion was in the list, the rule would
|
||||||
|
match; it wouldn't apply the same character range to later characters.
|
||||||
|
|
||||||
|
* doc/25-lfs.txt: Add a note on interaction between permissions and
|
||||||
|
symlinks.
|
||||||
|
|
||||||
|
2006-10-09 Bryan Kadzban <bryan@linuxfromscrtach.org>
|
||||||
|
* 25-lfs.rules: Fix fb[0-9]* device permissions (should use the default
|
||||||
|
0660).
|
||||||
|
|
||||||
|
* doc/25-lfs.txt: Fix typo: /dev/ptmx is given mode 0666, not 0660.
|
||||||
|
Also tweak the comment about other TTY devices.
|
||||||
|
|
||||||
|
2006-10-04 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 05-udev-early.rules: Remove WAIT_FOR_SYSFS="bus" rule. With kernel
|
||||||
|
2.6.18, this rule is no longer required.
|
||||||
|
|
||||||
|
* doc/05-udev-early.txt: Update to match.
|
||||||
|
|
||||||
|
2006-09-28 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* doc/60-persistent-storage.txt: Explain persistent storage rules, or
|
||||||
|
at least the parts I understand. (I don't use DASD or netblock or
|
||||||
|
several other supported configurations.)
|
||||||
|
|
||||||
|
* doc/81-cdrom.txt: Explain 81-cdrom.rules.
|
||||||
|
|
||||||
|
* doc/95-udev-late.txt: Explain 95-udev-late.rules. Documentation is
|
||||||
|
now finished.
|
||||||
|
|
||||||
|
2006-09-26 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* doc/60-persistent-input.txt: Explain (in probably too much detail)
|
||||||
|
60-persistent-input.rules.
|
||||||
|
|
||||||
|
2006-09-24 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* doc/05-udev-early.txt: Rewrap to fit 80 columns.
|
||||||
|
|
||||||
|
* doc/26-modprobe.txt: Explain 26-modprobe.rules, and modaliases.
|
||||||
|
|
||||||
|
* doc/27-firmware.txt: Explain 27-firmware.rules.
|
||||||
|
|
||||||
|
2006-09-24 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* doc/25-lfs.txt: Explain 25-lfs.rules.
|
||||||
|
|
||||||
|
* 25-lfs.rules: Use SYMLINK+= for isdn/capi20 also.
|
||||||
|
|
||||||
|
2006-09-23 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* doc: New subdirectory to contain documentation of rules
|
||||||
|
* doc/README: New file, top-level documentation
|
||||||
|
* doc/*.txt: New documentation files, one for each rules file. Only
|
||||||
|
05-udev-early.txt has anything in it.
|
||||||
|
|
||||||
|
2006-09-23 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 25-lfs.rules: Add "ignore_device" to OPTIONS for DRI devices, instead
|
||||||
|
of setting NAME to an empty string. This matches the way we ignore
|
||||||
|
devmapper / LVM devices.
|
||||||
|
|
||||||
|
2006-09-22 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 60-persistent-input.rules, 95-udev-late.rules: Import from udev-100.
|
||||||
|
60-persistent-input.rules creates persistent symlinks for input
|
||||||
|
devices, and 95-udev-late.rules enables udevmonitor.
|
||||||
|
|
||||||
|
* 60-persistent-storage.rules: Replace ATTRS{../removable} with just
|
||||||
|
ATTRS{removable} on partition devices. Replace ATTRS{removable}
|
||||||
|
with ATTR{removable} on whole-disk devices.
|
||||||
|
|
||||||
|
2006-09-20 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* 05-early.rules: Missed a rule in the last change. ENV{PHYSDEVBUS}
|
||||||
|
in the rule that waits for the "bus" symlink should be replaced by
|
||||||
|
SUBSYSTEMS.
|
||||||
|
|
||||||
|
2006-09-20 Bryan Kadzban <bryan@linuxfromscratch.org>
|
||||||
|
* Adapted rules to the new matches used in udev-098 and above (e.g.,
|
||||||
|
SYSFS becomes ATTRS). Prevents warnings, and support for the old
|
||||||
|
matches will be removed eventually. These rules will not work with
|
||||||
|
udev-097 and before!
|
||||||
|
* Fixed several bugs in the rules left over from previous udev
|
||||||
|
versions (missing commas, overwriting user symlinks using ="..."
|
||||||
|
instead of +="...", and matching against "*" instead of "?*").
|
||||||
|
|
||||||
|
* Renamed CHANGELOG to ChangeLog, started using pseudo-GNU-format
|
||||||
|
entries. (See standards.info; search it for "changelog" to get
|
||||||
|
the general gist.)
|
||||||
|
|
||||||
|
dnicholson - Jul 14, 2006
|
||||||
|
* Fixed usbdev PROGRAM so that it works with the BusyBox sh. Thanks
|
||||||
|
to Anthony Wright.
|
||||||
|
|
||||||
|
n/a - Jul 12, 2006
|
||||||
|
* Added options so temporary nodes are not created with device-mapper
|
||||||
|
* Adapted cdrom rules to identify CD-ROM drives correctly by adding
|
||||||
|
SUBSYSTEM=="block" test.
|
||||||
|
* Added simple 81-cdrom.rules file to set cdrom group ownership
|
||||||
|
|
||||||
|
n/a - Jun 07, 2006
|
||||||
|
* Removed nvidia rules
|
||||||
|
* Removed bug reporting rule
|
||||||
|
* Moved Debian-based persistent CD-ROM rules to contrib
|
||||||
|
* Adapted firmware rule to udev-093
|
||||||
|
|
||||||
|
n/a - May 15, 2006
|
||||||
|
* Part one of 25-lfs.rules rewrite
|
||||||
|
* Some minor tweaking of the layout
|
||||||
|
|
||||||
|
n/a - May 12, 2006
|
||||||
|
* Initial import of the udev-config directory.
|
||||||
|
* Reorganized and modularized the rules files.
|
||||||
|
* Added explanatory comments
|
311
udev-lfs/Makefile.lfs
Normal file
311
udev-lfs/Makefile.lfs
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
# Custom systemd Makefile that builds/installs udev only for LFS
|
||||||
|
# Bruce Dubbs 2012-07-11
|
||||||
|
|
||||||
|
# vim: tabstop=3
|
||||||
|
|
||||||
|
SHELL=/bin/bash
|
||||||
|
VERSION=188
|
||||||
|
|
||||||
|
ifeq ($(V),)
|
||||||
|
VB = @
|
||||||
|
else
|
||||||
|
VB =
|
||||||
|
endif
|
||||||
|
|
||||||
|
WARN = -Wall -W -Wextra -Wno-inline -Wvla -Wundef -Wformat=2 \
|
||||||
|
-Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs \
|
||||||
|
-Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self \
|
||||||
|
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes \
|
||||||
|
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations \
|
||||||
|
-Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align \
|
||||||
|
-Wstrict-aliasing=2 -Wwrite-strings -Wno-overlength-strings \
|
||||||
|
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result \
|
||||||
|
-Werror=overflow -Wp,-D_FORTIFY_SOURCE=2 -Wno-long-long
|
||||||
|
|
||||||
|
OPTIONS = -O2 -pipe -ffast-math -fno-common -fdiagnostics-show-option \
|
||||||
|
-fno-strict-aliasing -ffunction-sections -fdata-sections -fPIC
|
||||||
|
|
||||||
|
OPTIONS2 := $(OPTIONS) -fvisibility=hidden
|
||||||
|
|
||||||
|
LDFLAGS = -pthread -lrt -Wl,--as-needed -Wl,--gc-sections
|
||||||
|
LDFLAGS2 := $(LDFLAGS) -lblkid -lkmod
|
||||||
|
|
||||||
|
DEF = -include cfg.h \
|
||||||
|
-DSYSCONFDIR=\"/etc\" \
|
||||||
|
-DFIRMWARE_PATH="\"/lib/firmware/updates/\", \"/lib/firmware/\"" \
|
||||||
|
-DUSB_DATABASE=\"/usr/share/misc/usb.ids\" \
|
||||||
|
-DPCI_DATABASE=\"/usr/share/misc/pci.ids\" \
|
||||||
|
-DROOTPREFIX= \
|
||||||
|
-DUDEVLIBEXECDIR=\"/lib/udev\" \
|
||||||
|
-D_LARGEFILE_SOURCE \
|
||||||
|
-D_FILE_OFFSET_BITS=64
|
||||||
|
|
||||||
|
INCLUDE = -I src/libudev -I src/shared -I src -I src/login -I src/systemd
|
||||||
|
|
||||||
|
LIBUDEV_SRCS = libudev-device-private.c \
|
||||||
|
libudev-device.c \
|
||||||
|
libudev-enumerate.c \
|
||||||
|
libudev-list.c \
|
||||||
|
libudev-monitor.c \
|
||||||
|
libudev-queue-private.c \
|
||||||
|
libudev-queue.c \
|
||||||
|
libudev-util.c \
|
||||||
|
libudev.c
|
||||||
|
|
||||||
|
LIBUDEV_OBJS := $(addprefix build/, $(LIBUDEV_SRCS:.c=.o))
|
||||||
|
|
||||||
|
LIBUDEV = libudev
|
||||||
|
LIBUDEV_MAJOR = .1
|
||||||
|
LIBUDEV_MINOR = .0
|
||||||
|
LIBUDEV_PATCH = .2
|
||||||
|
LIBUDEV_SONAME := $(LIBUDEV).so
|
||||||
|
LIBUDEV_LINK_NAME := $(LIBUDEV_SONAME)$(LIBUDEV_MAJOR)
|
||||||
|
LIBUDEV_REAL_NAME := $(LIBUDEV_LINK_NAME)$(LIBUDEV_MINOR)$(LIBUDEV_PATCH)
|
||||||
|
|
||||||
|
COMMON_LIB = udev-local.a
|
||||||
|
|
||||||
|
COMMON_SRCS = log.c \
|
||||||
|
label.c \
|
||||||
|
mkdir.c \
|
||||||
|
cgroup-util.c \
|
||||||
|
strv.c \
|
||||||
|
path-util.c \
|
||||||
|
conf-files.c \
|
||||||
|
hashmap.c \
|
||||||
|
set.c \
|
||||||
|
exit-status.c \
|
||||||
|
util.c \
|
||||||
|
dev-setup.c \
|
||||||
|
sd-login.c \
|
||||||
|
sd-daemon.c
|
||||||
|
|
||||||
|
COMMON_OBJS := $(addprefix build/, $(COMMON_SRCS:.c=.o))
|
||||||
|
|
||||||
|
UDEVD_SRCS = udev-ctrl.c \
|
||||||
|
udev-rules.c \
|
||||||
|
udev-watch.c \
|
||||||
|
udev-event.c \
|
||||||
|
udev-node.c \
|
||||||
|
udev-builtin.c \
|
||||||
|
udev-builtin-blkid.c \
|
||||||
|
udev-builtin-firmware.c \
|
||||||
|
udev-builtin-path_id.c \
|
||||||
|
udev-builtin-hwdb.c \
|
||||||
|
udev-builtin-kmod.c \
|
||||||
|
udev-builtin-uaccess.c \
|
||||||
|
udev-builtin-usb_id.c \
|
||||||
|
udev-builtin-input_id.c
|
||||||
|
|
||||||
|
UDEVD_OBJS := $(addprefix build/, $(UDEVD_SRCS:.c=.o))
|
||||||
|
|
||||||
|
UDEV_ADMIN_SRCS = udevadm.c \
|
||||||
|
udevadm-test.c \
|
||||||
|
udevadm-monitor.c \
|
||||||
|
udevadm-settle.c \
|
||||||
|
udevadm-info.c \
|
||||||
|
udevadm-test-builtin.c \
|
||||||
|
udevadm-trigger.c \
|
||||||
|
udevadm-control.c \
|
||||||
|
udev-rules.c \
|
||||||
|
udev-ctrl.c \
|
||||||
|
udev-event.c \
|
||||||
|
udev-node.c \
|
||||||
|
udev-watch.c \
|
||||||
|
udev-builtin.c \
|
||||||
|
udev-builtin-blkid.c \
|
||||||
|
udev-builtin-firmware.c \
|
||||||
|
udev-builtin-path_id.c \
|
||||||
|
udev-builtin-hwdb.c \
|
||||||
|
udev-builtin-kmod.c \
|
||||||
|
udev-builtin-uaccess.c \
|
||||||
|
udev-builtin-usb_id.c \
|
||||||
|
udev-builtin-input_id.c
|
||||||
|
|
||||||
|
UDEV_ADMIN_OBJS := $(addprefix build/, $(UDEV_ADMIN_SRCS:.c=.o))
|
||||||
|
|
||||||
|
LFS_RULES = 55-lfs.rules
|
||||||
|
|
||||||
|
VPATH = src/login src/udev src/udev/accelerometer \
|
||||||
|
src/udev/scsi_id src/udev/cdrom_id src/udev/v4l_id \
|
||||||
|
src/udev/mtd_probe src/udev/collect src/udev/ata_id \
|
||||||
|
src/libudev src/libsystemd-daemon
|
||||||
|
|
||||||
|
SED_PROCESS = \
|
||||||
|
sed -e 's|@VERSION@|$(VERSION)|g' \
|
||||||
|
-e 's|@prefix@|/usr|g' \
|
||||||
|
-e 's|@exec_prefix@|/usr|g' \
|
||||||
|
-e 's|@udevlibexecdir@|/lib/udev|g' \
|
||||||
|
-e 's|@libdir@|/usr/lib|g' \
|
||||||
|
-e 's|@includedir@|/usr/include|g' \
|
||||||
|
< $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
udev: common \
|
||||||
|
build/$(COMMON_LIB) \
|
||||||
|
build/$(LIBUDEV_REAL_NAME) \
|
||||||
|
build/udevd \
|
||||||
|
build/udevadm \
|
||||||
|
build/accelerometer \
|
||||||
|
build/ata_id \
|
||||||
|
build/cdrom_id \
|
||||||
|
build/scsi_id \
|
||||||
|
build/v4l_id \
|
||||||
|
build/mtd_probe \
|
||||||
|
build/collect \
|
||||||
|
build/udev.pc \
|
||||||
|
build/libudev.pc
|
||||||
|
|
||||||
|
common: udev-lfs-$(VERSION)/cfg.h
|
||||||
|
@mkdir -p build
|
||||||
|
cp udev-lfs-$(VERSION)/cfg.h .
|
||||||
|
|
||||||
|
build/%o: %c
|
||||||
|
@echo CC $<
|
||||||
|
$(VB)gcc -c $(WARN) $(OPTIONS2) $(INCLUDE) $(DEF) -o $@ $<
|
||||||
|
|
||||||
|
# Sources from src/libudev use -fvisibility=hidden
|
||||||
|
build/%o: src/libudev/%c
|
||||||
|
@echo CC $<
|
||||||
|
$(VB)gcc -c $(WARN) $(OPTIONS) $(INCLUDE) $(DEF) -o $@ $<
|
||||||
|
|
||||||
|
# Sources from src/shared use -fvisibility=hidden
|
||||||
|
build/%o: src/shared/%c
|
||||||
|
@echo CC $<
|
||||||
|
$(VB)gcc -c $(WARN) $(OPTIONS) $(INCLUDE) $(DEF) -o $@ $<
|
||||||
|
|
||||||
|
# Build the dynamic library
|
||||||
|
build/$(LIBUDEV_REAL_NAME): $(LIBUDEV_OBJS) build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc -shared -fPIC -DPIC \
|
||||||
|
$(LIBUDEV_OBJS) \
|
||||||
|
build/$(COMMON_LIB) \
|
||||||
|
-Wl,--no-whole-archive -ldl -lrt -O2 \
|
||||||
|
-Wl,--as-needed \
|
||||||
|
-Wl,--gc-sections \
|
||||||
|
-Wl,-soname,$(LIBUDEV_LINK_NAME) \
|
||||||
|
-o build/$(LIBUDEV_REAL_NAME)
|
||||||
|
|
||||||
|
ln -sfn $(LIBUDEV_REAL_NAME) build/$(LIBUDEV_LINK_NAME)
|
||||||
|
ln -sfn $(LIBUDEV_REAL_NAME) build/$(LIBUDEV_SONAME)
|
||||||
|
|
||||||
|
#-Wl,--whole-archive \
|
||||||
|
#-Wl,--version-script=./src/libudev/libudev.sym \
|
||||||
|
|
||||||
|
# Build the static library for internal use
|
||||||
|
build/$(COMMON_LIB): $(COMMON_OBJS) $(LIBUDEV_OBJS) $(UDEVD_OBJS)
|
||||||
|
@echo AR $@
|
||||||
|
$(VB)ar rcs build/$(COMMON_LIB) $(COMMON_OBJS) $(LIBUDEV_OBJS)
|
||||||
|
|
||||||
|
build/udevd: build/$(COMMON_LIB) build/udevd.o
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/udevd.o $(UDEVD_OBJS) -o $@ $(LDFLAGS2) \
|
||||||
|
build/udev-local.a build/$(COMMON_LIB)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/udevadm: $(UDEV_ADMIN_OBJS)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc $(UDEV_ADMIN_OBJS) -o $@ $(LDFLAGS2) build/$(COMMON_LIB) \
|
||||||
|
build/udev-local.a
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/accelerometer: build/accelerometer.o build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/accelerometer.o -o $@ \
|
||||||
|
build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS) -lm
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/scsi_id: build/scsi_id.o build/scsi_serial.o build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/scsi_id.o build/scsi_serial.o -o $@ \
|
||||||
|
build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/ata_id: build/ata_id.o build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/ata_id.o -o $@ build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/cdrom_id: build/cdrom_id.o build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/cdrom_id.o -o $@ build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/v4l_id: build/v4l_id.o build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/v4l_id.o -o $@ build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/mtd_probe: build/mtd_probe.o build/probe_smartmedia.o build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/mtd_probe.o build/probe_smartmedia.o -o $@ \
|
||||||
|
build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/collect: build/collect.o build/$(COMMON_LIB)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc build/collect.o -o $@ build/udev-local.a build/$(COMMON_LIB) $(LDFLAGS)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
build/%pc: %pc.in
|
||||||
|
@echo GEN $@
|
||||||
|
@$(SED_PROCESS)
|
||||||
|
|
||||||
|
install: udev
|
||||||
|
@mkdir -pv $(DESTDIR)/lib/udev/devices/pts $(DESTDIR)/lib/udev/rules.d \
|
||||||
|
$(DESTDIR){,/usr}/lib/firmware $(DESTDIR)/sbin \
|
||||||
|
$(DESTDIR)/usr/lib/pkgconfig $(DESTDIR)/etc/udev/rules.d \
|
||||||
|
$(DESTDIR)/usr/share/doc/udev/lfs $(DESTDIR)/usr/include \
|
||||||
|
$(DESTDIR)/usr/share/man/man{7,8}
|
||||||
|
|
||||||
|
# Copy executables
|
||||||
|
@cp -v build/udevadm $(DESTDIR)/sbin
|
||||||
|
@cp -v build/{udevd,accelerometer,ata_id,cdrom_id,collect,mtd_probe,scsi_id,v4l_id} \
|
||||||
|
$(DESTDIR)/lib/udev
|
||||||
|
@cp -v udev-lfs-$(VERSION)/write* $(DESTDIR)/lib/udev
|
||||||
|
@cp -v udev-lfs-$(VERSION)/*functions $(DESTDIR)/lib/udev
|
||||||
|
|
||||||
|
# Copy and set up library and associated files
|
||||||
|
@cp -v build/{lib,}udev.pc $(DESTDIR)/usr/lib/pkgconfig
|
||||||
|
@cp -v build/$(LIBUDEV_REAL_NAME) $(DESTDIR)/lib
|
||||||
|
|
||||||
|
ln -svfn ../../lib/$(LIBUDEV_REAL_NAME) $(DESTDIR)/usr/lib/$(LIBUDEV_SONAME)
|
||||||
|
ln -svfn $(LIBUDEV_REAL_NAME) $(DESTDIR)/lib/$(LIBUDEV_LINK_NAME)
|
||||||
|
|
||||||
|
# Copy the libudev header
|
||||||
|
@cp -v src/libudev/libudev.h $(DESTDIR)/usr/include
|
||||||
|
|
||||||
|
# Create null device and copy rules
|
||||||
|
@cp -v rules/* $(DESTDIR)/lib/udev/rules.d
|
||||||
|
@rm -v $(DESTDIR)/lib/udev/rules.d/99*
|
||||||
|
@cp -v udev-lfs-$(VERSION)/*lfs.rules $(DESTDIR)/etc/udev/rules.d
|
||||||
|
|
||||||
|
# Copy documentation
|
||||||
|
@cp -v man/udev.7 $(DESTDIR)/usr/share/man/man7
|
||||||
|
@cp -v man/udevadm.8 $(DESTDIR)/usr/share/man/man8
|
||||||
|
@cp -v udev-lfs-$(VERSION)/udevd.8 $(DESTDIR)/usr/share/man/man8/udevd.8
|
||||||
|
@cp -v udev-lfs-$(VERSION)/doc/* $(DESTDIR)/usr/share/doc/udev/lfs
|
||||||
|
|
||||||
|
# Copy misc
|
||||||
|
@cp -v udev-lfs-$(VERSION)/init-net-rules.sh $(DESTDIR)/lib/udev
|
||||||
|
|
||||||
|
include udev-lfs-$(VERSION)/makefile-incl.gudev
|
||||||
|
include udev-lfs-$(VERSION)/makefile-incl.gir
|
||||||
|
include udev-lfs-$(VERSION)/makefile-incl.keymap
|
||||||
|
|
||||||
|
all : udev keymap gudev gir-data
|
||||||
|
install-all: install install-keymap install-gudev install-gir-data
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build
|
||||||
|
rm -f cfg.h
|
||||||
|
rm -f src/gudev/gudevmarshal.h
|
||||||
|
rm -f src/gudev/gudevmarshal.c
|
||||||
|
rm -f src/gudev/gudevenumtypes.h
|
||||||
|
rm -f src/gudev/gudevenumtypes.c
|
||||||
|
rm -f src/udev/keymap/keys.txt
|
||||||
|
rm -f src/udev/keymap/keys-from-name.gperf
|
||||||
|
rm -f src/udev/keymap/keys-from-name.h
|
||||||
|
rm -f src/udev/keymap/keys-to-name.h
|
||||||
|
|
||||||
|
.PHONY: clean build
|
||||||
|
|
42
udev-lfs/README
Normal file
42
udev-lfs/README
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
The udev-lfs set of files is a customization of systemd.
|
||||||
|
In 2012, udev was merged with systemd and a build methodology
|
||||||
|
incompatible with LFS. These files extract the udev
|
||||||
|
code from systemd for LFS.
|
||||||
|
|
||||||
|
These files are distributed in the form of a tar file available
|
||||||
|
from the LFS file mirrors. The tarball is created with:
|
||||||
|
|
||||||
|
mkdir /tmp/udev-lfs-$VERSION
|
||||||
|
cp -av * /tmp/udev-lfs-$VERSION
|
||||||
|
tar -jcf /tmp/udev-lfs-$VERSION.tar.bz2 -C /tmp udev-lfs-$VERSION
|
||||||
|
|
||||||
|
Makefile.lfs - The main LFS Makefile. Builds and installs
|
||||||
|
udev from systemd sources.
|
||||||
|
|
||||||
|
makefile-incl.keymap - BLFS makefile for keymap and supporting files
|
||||||
|
makefile-incl.gudev - BLFS makefile for libgudev
|
||||||
|
makefile-incl.gir - BLFS makefile for GObject files
|
||||||
|
|
||||||
|
|
||||||
|
contrib - Useful rules from debian
|
||||||
|
contrib/debian
|
||||||
|
contrib/debian/83-cdrom-symlinks.rules
|
||||||
|
contrib/debian/write_cd_aliases
|
||||||
|
contrib/debian/81-cdrom.rules
|
||||||
|
|
||||||
|
55-lfs.rules - LFS custom rules
|
||||||
|
write_net_rules - Scripts for LFS rules
|
||||||
|
write_cd_rules
|
||||||
|
rule_generator.functions
|
||||||
|
|
||||||
|
doc - Documentation for LFS installed rules
|
||||||
|
doc/55-lfs.txt
|
||||||
|
doc/README
|
||||||
|
|
||||||
|
cfg.h - Basic info needed for udev compilation
|
||||||
|
|
||||||
|
ChangeLog - Log of changes to 55-lfs-rules
|
||||||
|
|
||||||
|
init-net-rules.sh - A script for establishing persistent network
|
||||||
|
rules before the first LFS boot
|
||||||
|
|
44
udev-lfs/cfg.h
Normal file
44
udev-lfs/cfg.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
#define HAVE_DLFCN_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if XZ is available */
|
||||||
|
#define HAVE_XZ 1
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#define PACKAGE "udev"
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Enable GNU extensions on systems that have them. */
|
||||||
|
# define _GNU_SOURCE 1
|
||||||
|
/* Version number of package */
|
||||||
|
#define VERSION "188"
|
||||||
|
|
3
udev-lfs/contrib/debian/81-cdrom.rules
Normal file
3
udev-lfs/contrib/debian/81-cdrom.rules
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions and get device capabilities
|
||||||
|
|
||||||
|
ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", IMPORT{program}="cdrom_id --export $tempnode", GROUP="cdrom"
|
12
udev-lfs/contrib/debian/83-cdrom-symlinks.rules
Normal file
12
udev-lfs/contrib/debian/83-cdrom-symlinks.rules
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability.
|
||||||
|
|
||||||
|
ACTION!="add", GOTO="cd_aliases_generator_end"
|
||||||
|
SUBSYSTEM!="block", GOTO="cd_aliases_generator_end"
|
||||||
|
ENV{GENERATED}=="?*", GOTO="cd_aliases_generator_end"
|
||||||
|
|
||||||
|
# Fail the uevent if the autogenerated rules cannot be saved
|
||||||
|
ENV{ID_CDROM}=="?*", PROGRAM="/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", RESULT!="2", RUN+="/bin/false", GOTO="cd_aliases_generator_end"
|
||||||
|
|
||||||
|
ENV{ID_CDROM}=="?*", PROGRAM="write_cd_aliases", SYMLINK+="%c"
|
||||||
|
|
||||||
|
LABEL="cd_aliases_generator_end"
|
111
udev-lfs/contrib/debian/write_cd_aliases
Normal file
111
udev-lfs/contrib/debian/write_cd_aliases
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
RULES_FILE="/etc/udev/rules.d/82-persistent-cd.rules"
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
lock_rules_file() {
|
||||||
|
RULES_LOCK="/dev/.udev/.lock-${RULES_FILE##*/}"
|
||||||
|
|
||||||
|
retry=30
|
||||||
|
while ! mkdir $RULES_LOCK 2> /dev/null; do
|
||||||
|
if [ $retry -eq 0 ]; then
|
||||||
|
echo "Cannot lock $RULES_FILE!" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
retry=$(($retry - 1))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
unlock_rules_file() {
|
||||||
|
rmdir $RULES_LOCK || true
|
||||||
|
}
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
find_next_available() {
|
||||||
|
# use echo to convert newlines to spaces
|
||||||
|
local links=`echo $(find_all_symlinks $1)`
|
||||||
|
local basename=${links%%[ 0-9]*}
|
||||||
|
local max=-1
|
||||||
|
for name in $links; do
|
||||||
|
local num=${name#$basename}
|
||||||
|
[ "$num" ] || num=0
|
||||||
|
[ $num -gt $max ] && max=$num
|
||||||
|
done
|
||||||
|
|
||||||
|
max=$(($max + 1))
|
||||||
|
# "name0" actually is just "name"
|
||||||
|
[ $max -eq 0 ] && return
|
||||||
|
echo "$max"
|
||||||
|
}
|
||||||
|
|
||||||
|
find_all_symlinks() {
|
||||||
|
local linkre="$1"
|
||||||
|
local match="$2"
|
||||||
|
|
||||||
|
[ -e $RULES_FILE ] || return
|
||||||
|
|
||||||
|
local search='.*[[:space:],]SYMLINK+="\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$'
|
||||||
|
|
||||||
|
sed -n -e "${match}s/${search}/\1/p" $RULES_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
write_rule() {
|
||||||
|
local match="$1"
|
||||||
|
local link="$2"
|
||||||
|
local comment="$3"
|
||||||
|
|
||||||
|
[ -e "$RULES_FILE" ] || PRINT_HEADER=1
|
||||||
|
{
|
||||||
|
if [ "$PRINT_HEADER" ]; then
|
||||||
|
PRINT_HEADER=
|
||||||
|
echo "# This file was automatically generated by the $0"
|
||||||
|
echo "# program, probably run by the 83-cdrom.rules rules file."
|
||||||
|
echo "#"
|
||||||
|
echo "# You can modify it, as long as you keep each rule on a single line"
|
||||||
|
echo "# and set the \$GENERATED variable."
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "$comment" ] && echo "# $comment"
|
||||||
|
echo "ACTION==\"add\", SUBSYSTEM==\"block\", $match, ENV{ID_CDROM}==\"1\", SYMLINK+=\"$link\", ENV{GENERATED}=\"1\""
|
||||||
|
} >> $RULES_FILE
|
||||||
|
SYMLINKS="$SYMLINKS $link"
|
||||||
|
}
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
if [ -z "$DEVPATH" ]; then
|
||||||
|
echo "Missing \$DEVPATH." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$ID_CDROM" ]; then
|
||||||
|
echo "$DEVPATH is not a CD reader." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prevent parallel processes from modifying the file at the same time.
|
||||||
|
lock_rules_file
|
||||||
|
|
||||||
|
link_num=$(find_next_available 'cdrom[0-9]*')
|
||||||
|
|
||||||
|
#match="ENV{ID_PATH}==\"$ID_PATH\""
|
||||||
|
|
||||||
|
#kernel=${DEVPATH##*/}
|
||||||
|
#match="KERNEL==\"$kernel\""
|
||||||
|
|
||||||
|
id=${PHYSDEVPATH##*/}
|
||||||
|
match="BUS==\"$PHYSDEVBUS\", ID==\"$id\""
|
||||||
|
|
||||||
|
comment="$ID_MODEL ($ID_PATH)"
|
||||||
|
|
||||||
|
write_rule "$match" "cdrom$link_num" "$comment"
|
||||||
|
[ "$ID_CDROM_CD_RW" ] && write_rule "$match" "cdrw$link_num"
|
||||||
|
[ "$ID_CDROM_DVD" ] && write_rule "$match" "dvd$link_num"
|
||||||
|
[ "$ID_CDROM_DVD_RW" ] && write_rule "$match" "dvdrw$link_num"
|
||||||
|
|
||||||
|
unlock_rules_file
|
||||||
|
|
||||||
|
echo $SYMLINKS
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
20
udev-lfs/doc/55-lfs.txt
Normal file
20
udev-lfs/doc/55-lfs.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Purpose of rules file:
|
||||||
|
|
||||||
|
Most of the rules installed by Udev itself create devices with the correct
|
||||||
|
properties. This file contains rules that have not been merged upstream yet.
|
||||||
|
|
||||||
|
Description of rules:
|
||||||
|
|
||||||
|
By default, Udev creates device nodes with UID 0, GID 0, and permissions 0660.
|
||||||
|
|
||||||
|
ISDN-related devices should be owned by the 'dialout' group, hence the following
|
||||||
|
rule (and similar):
|
||||||
|
|
||||||
|
KERNEL=="ippp[0-9]*", GROUP="dialout"
|
||||||
|
|
||||||
|
The RTC-related rules cause the setclock bootscript to be run as soon as the
|
||||||
|
RTC device has been created by Udev, meaning that times in log files, for
|
||||||
|
example, are as accurate as possible as quickly as possible.
|
||||||
|
|
||||||
|
A final word of caution: Any particular rule must be written on one line, and a
|
||||||
|
comma must separate each part of the rule.
|
6
udev-lfs/doc/README
Normal file
6
udev-lfs/doc/README
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
This directory contains documentation for each rule file used in LFS.
|
||||||
|
|
||||||
|
Each .rules file should contain a corresponding .txt file in this directory,
|
||||||
|
which explains both the overall purpose of the rules file, and each type of
|
||||||
|
rule contained therein.
|
||||||
|
|
128
udev-lfs/init-net-rules.sh
Normal file
128
udev-lfs/init-net-rules.sh
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# This script generates rules for persistent network device naming
|
||||||
|
# Data from udev-182 75-persistent-net-generator.rules
|
||||||
|
|
||||||
|
RULES=/etc/udev/rules.d/70-persistent-net.rules
|
||||||
|
DEVICES=$(eval echo /sys/class/net/{eth*,ath*,wlan*[0-9],msh*,ra*,sta*,ctc*,lcs*,hsi*})
|
||||||
|
|
||||||
|
function usage
|
||||||
|
{
|
||||||
|
echo $msg
|
||||||
|
echo "init-net-rules.sh is an LFS-specific script to initialize"
|
||||||
|
echo "$RULES"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
declare -A VENDORS_IGNORED
|
||||||
|
VENDORS_IGNORED['52:54:00:']="kvm"
|
||||||
|
VENDORS_IGNORED['00:0c:29:']="vmware"
|
||||||
|
VENDORS_IGNORED['00:50:56:']="vmware"
|
||||||
|
VENDORS_IGNORED['00:15:5d:']="hyper-v"
|
||||||
|
VENDORS_IGNORED['00:00:00:']="invalid"
|
||||||
|
|
||||||
|
declare -A VENDORS
|
||||||
|
VENDORS['02:07:01:']="Interlan, DEC, etc"
|
||||||
|
VENDORS['02:60:60:']="3com"
|
||||||
|
VENDORS['02:60:8c:']="3Com IBM PC; Imagen. etc"
|
||||||
|
VENDORS['02:a0:c9:']="intel"
|
||||||
|
VENDORS['02:aa:3c:']="Olivetti"
|
||||||
|
VENDORS['02:cf:1f:']="Masscomp, Silicon Graphics, etc"
|
||||||
|
VENDORS['02:e0:3b:']="Gigabit"
|
||||||
|
VENDORS['02:e6:d3:']="BTI"
|
||||||
|
VENDORS['52:54:00:']="Realtek"
|
||||||
|
VENDORS['52:54:4c:']="Novell"
|
||||||
|
VENDORS['52:54:ab:']="Realtek"
|
||||||
|
VENDORS['e2:0c:0f:']="Kingston"
|
||||||
|
VENDORS['00:16:3e:']="Xensource"
|
||||||
|
|
||||||
|
function ignore_if
|
||||||
|
{
|
||||||
|
if [[ "${VENDORS_IGNORED[$VENDOR]}" != "" ]]; then return 0; fi
|
||||||
|
if [[ "${VENDORS[$VENDOR]}" != "" ]]; then return 1; fi
|
||||||
|
|
||||||
|
byte2=$(echo $VENDOR | cut -c2)
|
||||||
|
if echo $byte2 | grep -q "[2367abef]"; then return 0; fi
|
||||||
|
|
||||||
|
return 1 # Default is to not ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
function comment
|
||||||
|
{
|
||||||
|
# Not implemented
|
||||||
|
# SUBSYSTEMS=="pci"
|
||||||
|
# export COMMENT="PCI device $attr{vendor}:$attr{device} ($driver)"
|
||||||
|
|
||||||
|
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*"
|
||||||
|
# export COMMENT="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)"
|
||||||
|
|
||||||
|
# SUBSYSTEMS=="pcmcia",
|
||||||
|
# export COMMENT="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)"
|
||||||
|
|
||||||
|
# SUBSYSTEMS=="ieee1394",
|
||||||
|
# export COMMENT="Firewire device $attr{host_id})"
|
||||||
|
|
||||||
|
# ibmveth likes to use "locally administered" MAC addresses
|
||||||
|
# DRIVERS=="ibmveth",
|
||||||
|
# export COMMENT="ibmveth ($id)"
|
||||||
|
|
||||||
|
# S/390 uses id matches only, do not use MAC address match
|
||||||
|
# SUBSYSTEMS=="ccwgroup",
|
||||||
|
# export COMMENT="S/390 $driver device at $id",
|
||||||
|
# export MATCHID="$id"
|
||||||
|
# export MATCHDRV="$driver"
|
||||||
|
# export MATCHADDR=""
|
||||||
|
|
||||||
|
# Default
|
||||||
|
driver=$(basename $(readlink -f $NIC/device/driver/module))
|
||||||
|
export COMMENT="net device ${driver}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! mountpoint -q /sys; then
|
||||||
|
msg="/sys mut be mounted"
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mountpoint -q /proc; then
|
||||||
|
msg="/proc mut be mounted"
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e $RULES ]; then
|
||||||
|
msg="The rules file already exists"
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ignore Xen virtual interfaces
|
||||||
|
if [ -e /proc/xen ]; then
|
||||||
|
msg="The rules file should not be created in the Xen environment"
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Variables used to communicate with write_net_rules:
|
||||||
|
# INTERFACE simple interface name
|
||||||
|
# MATCHADDR MAC address used for the match
|
||||||
|
# MATCHID bus_id used for the match
|
||||||
|
# MATCHDRV driver name used for the match
|
||||||
|
# MATCHIFTYPE interface type match
|
||||||
|
# COMMENT comment to add to the generated rule
|
||||||
|
# INTERFACE_NAME requested name supplied by external tool
|
||||||
|
# INTERFACE_NEW new interface name returned by rule writer
|
||||||
|
|
||||||
|
for NIC in $DEVICES; do
|
||||||
|
IF=${NIC##*/}
|
||||||
|
if echo $NIC | grep -q '*' ; then continue; fi
|
||||||
|
|
||||||
|
export INTERFACE=${NIC##*/} # Simple interface name
|
||||||
|
export MATCHADDR="$(cat $NIC/address)" # Read MAC address
|
||||||
|
|
||||||
|
VENDOR=$(echo $MATCHADDR | cut -c-9)
|
||||||
|
if ignore_if; then continue; fi
|
||||||
|
|
||||||
|
export MATCHDEVID="$(cat $NIC/dev_id)"
|
||||||
|
export MATCHIFTYPE="$(cat $NIC/type)" # Read interface type
|
||||||
|
comment
|
||||||
|
|
||||||
|
/lib/udev/write_net_rules
|
||||||
|
done
|
||||||
|
|
51
udev-lfs/makefile-incl.gir
Normal file
51
udev-lfs/makefile-incl.gir
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# Custom systemd Makefile include that builds/installs gir only for LFS
|
||||||
|
|
||||||
|
# vim: tabstop=3
|
||||||
|
|
||||||
|
G_IR_INCLUDES = \
|
||||||
|
src/gudev/gudev.h \
|
||||||
|
src/gudev/gudevtypes.h \
|
||||||
|
src/gudev/gudevenums.h \
|
||||||
|
src/gudev/gudevenumtypes.h \
|
||||||
|
src/gudev/gudevclient.h \
|
||||||
|
src/gudev/gudevdevice.h \
|
||||||
|
src/gudev/gudevenumerator.h \
|
||||||
|
src/gudev/gudevclient.c \
|
||||||
|
src/gudev/gudevdevice.c \
|
||||||
|
src/gudev/gudevenumerator.c
|
||||||
|
|
||||||
|
build/GUdev-1.0.gir: gudev
|
||||||
|
@echo G-IR-SCANNER $@
|
||||||
|
$(VB)LD_LIBRARY_PATH=./build g-ir-scanner \
|
||||||
|
$(G_IR_INCLUDES) \
|
||||||
|
-D_GUDEV_COMPILATION \
|
||||||
|
-D_GUDEV_WORK_AROUND_DEV_T_BUG \
|
||||||
|
-I src -I src/gudev \
|
||||||
|
-L./build -lgudev-1.0 -ludev \
|
||||||
|
--quiet \
|
||||||
|
--warn-all \
|
||||||
|
--no-libtool \
|
||||||
|
--include=GObject-2.0 \
|
||||||
|
--pkg-export=gudev-1.0 \
|
||||||
|
--c-include=gudev/gudev.h \
|
||||||
|
--library=gudev-1.0 \
|
||||||
|
--namespace=GUdev \
|
||||||
|
--nsversion=1.0 \
|
||||||
|
--output=$@
|
||||||
|
|
||||||
|
build/GUdev-1.0.typelib: build/GUdev-1.0.gir
|
||||||
|
@echo G-IR-COMPILER $@
|
||||||
|
$(VB)LIBRARY_PATH=./build g-ir-compiler $< > $@
|
||||||
|
|
||||||
|
gir-data: build/GUdev-1.0.gir build/GUdev-1.0.typelib
|
||||||
|
|
||||||
|
install-gir-data: gir-data
|
||||||
|
@mkdir -pv $(DESTDIR)/usr/lib/girepository-1.0 \
|
||||||
|
$(DESTDIR)/usr/share/gir-1.0
|
||||||
|
|
||||||
|
@cp -v build/GUdev-1.0.typelib $(DESTDIR)/usr/lib/girepository-1.0
|
||||||
|
@cp -v build/GUdev-1.0.gir $(DESTDIR)/usr/share/gir-1.0
|
||||||
|
|
||||||
|
clean-gir-data:
|
||||||
|
rm -f build/GUdev-1.0.typelib
|
||||||
|
rm -f build/GUdev-1.0.gir
|
108
udev-lfs/makefile-incl.gudev
Normal file
108
udev-lfs/makefile-incl.gudev
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
# Custom systemd Makefile include that builds/installs gudev only for LFS
|
||||||
|
|
||||||
|
# vim: tabstop=3
|
||||||
|
|
||||||
|
LIBGUDEV_SRCS = \
|
||||||
|
gudevclient.c \
|
||||||
|
gudevdevice.c \
|
||||||
|
gudevenumerator.c \
|
||||||
|
gudevenumtypes.c \
|
||||||
|
gudevmarshal.c
|
||||||
|
|
||||||
|
LIBGUDEV_INCLUDES = \
|
||||||
|
src/gudev/gudev.h \
|
||||||
|
src/gudev/gudevenums.h \
|
||||||
|
src/gudev/gudevenumtypes.h \
|
||||||
|
src/gudev/gudevtypes.h \
|
||||||
|
src/gudev/gudevclient.h \
|
||||||
|
src/gudev/gudevdevice.h \
|
||||||
|
src/gudev/gudevenumerator.h
|
||||||
|
|
||||||
|
LIBGUDEV_OBJS := $(addprefix build/, $(LIBGUDEV_SRCS:.c=.o))
|
||||||
|
|
||||||
|
LIBGUDEV_CFLAGS = \
|
||||||
|
-I src/gudev \
|
||||||
|
-D_POSIX_PTHREAD_SEMANTICS \
|
||||||
|
-D_REENTRANT \
|
||||||
|
-D_GUDEV_COMPILATION \
|
||||||
|
-DG_LOG_DOMAIN=\"GUdev\" \
|
||||||
|
-fvisibility=default \
|
||||||
|
-I /usr/include/glib-2.0 \
|
||||||
|
-I /usr/lib/glib-2.0/include
|
||||||
|
|
||||||
|
LIBGUDEV_LDFLAGS = \
|
||||||
|
-L build -L /usr/lib \
|
||||||
|
-ludev -lgobject-2.0 \
|
||||||
|
-lglib-2.0
|
||||||
|
|
||||||
|
GUDEV_GENERATED = \
|
||||||
|
src/gudev/gudevmarshal.h \
|
||||||
|
src/gudev/gudevmarshal.c \
|
||||||
|
src/gudev/gudevenumtypes.h \
|
||||||
|
src/gudev/gudevenumtypes.c
|
||||||
|
|
||||||
|
LIBGUDEV = libgudev-1.0
|
||||||
|
LIBGUDEV_MAJOR = .0
|
||||||
|
LIBGUDEV_MINOR = .1
|
||||||
|
LIBGUDEV_PATCH = .2
|
||||||
|
LIBGUDEV_SONAME := $(LIBGUDEV).so
|
||||||
|
LIBGUDEV_LINK_NAME := $(LIBGUDEV_SONAME)$(LIBGUDEV_MAJOR)
|
||||||
|
LIBGUDEV_REAL_NAME := $(LIBGUDEV_LINK_NAME)$(LIBGUDEV_MINOR)$(LIBGUDEV_PATCH)
|
||||||
|
|
||||||
|
src/gudev/gudevmarshal.h: src/gudev/gudevmarshal.list
|
||||||
|
@echo GEN $@
|
||||||
|
$(VB)glib-genmarshal $< --prefix=g_udev_marshal --header > $@
|
||||||
|
|
||||||
|
src/gudev/gudevmarshal.c: src/gudev/gudevmarshal.list
|
||||||
|
@echo GEN $@
|
||||||
|
@echo "#include \"gudevmarshal.h\"" > $@
|
||||||
|
$(VB)glib-genmarshal $< --prefix=g_udev_marshal --body >> $@
|
||||||
|
|
||||||
|
src/gudev/gudevenumtypes.h: src/gudev/gudevenumtypes.h.template src/gudev/gudevenums.h
|
||||||
|
@echo GEN $@
|
||||||
|
$(VB)glib-mkenums --template $^ > $@
|
||||||
|
|
||||||
|
src/gudev/gudevenumtypes.c: src/gudev/gudevenumtypes.c.template src/gudev/gudevenums.h
|
||||||
|
@echo GEN $@
|
||||||
|
$(VB)glib-mkenums --template $^ > $@
|
||||||
|
|
||||||
|
build/%o: src/gudev/%c $(GUDEV_GENERATED) common
|
||||||
|
@echo CC $<
|
||||||
|
$(VB)gcc -c $(LIBGUDEV_CFLAGS) $(WARN) $(OPTIONS) $(INCLUDE) $(DEF) -o $@ $<
|
||||||
|
|
||||||
|
build/$(LIBGUDEV_REAL_NAME): $(LIBGUDEV_OBJS) build/udev-local.a build/$(LIBUDEV_REAL_NAME)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc -shared -Wl,--export-dynamic -Wl,-soname,$(LIBGUDEV_LINK_NAME) \
|
||||||
|
-o build/$(LIBGUDEV_REAL_NAME) $(LIBGUDEV_OBJS) $(LIBGUDEV_LDFLAGS)
|
||||||
|
|
||||||
|
ln -sfn $(LIBGUDEV_REAL_NAME) build/$(LIBGUDEV_LINK_NAME)
|
||||||
|
ln -sfn $(LIBGUDEV_REAL_NAME) build/$(LIBGUDEV_SONAME)
|
||||||
|
|
||||||
|
build/gudev-1.0.pc: src/gudev/gudev-1.0.pc.in
|
||||||
|
@echo GEN $@
|
||||||
|
@$(SED_PROCESS)
|
||||||
|
|
||||||
|
gudev: build/$(LIBGUDEV_REAL_NAME) build/gudev-1.0.pc
|
||||||
|
|
||||||
|
clean-gudev:
|
||||||
|
rm -f src/gudev/gudevmarshal.h
|
||||||
|
rm -f src/gudev/gudevmarshal.c
|
||||||
|
rm -f src/gudev/gudevenumtypes.h
|
||||||
|
rm -f src/gudev/gudevenumtypes.c
|
||||||
|
rm -f $(LIBGUDEV_OBJS)
|
||||||
|
rm -f build/libgudev-1.0.so*
|
||||||
|
|
||||||
|
install-gudev: gudev
|
||||||
|
@mkdir -pv $(DESTDIR)/usr/include/gudev-1.0/gudev \
|
||||||
|
$(DESTDIR)/usr/lib/pkgconfig \
|
||||||
|
$(DESTDIR)/usr/share/gtk-doc/html/gudev
|
||||||
|
|
||||||
|
@cp -v $(LIBGUDEV_INCLUDES) $(DESTDIR)/usr/include/gudev-1.0/gudev
|
||||||
|
@cp -v build/$(LIBGUDEV_REAL_NAME) $(DESTDIR)/usr/lib
|
||||||
|
|
||||||
|
@ln -svfn $(LIBGUDEV_REAL_NAME) $(DESTDIR)/usr/lib/$(LIBGUDEV_SONAME)
|
||||||
|
@ln -svfn $(LIBGUDEV_REAL_NAME) $(DESTDIR)/usr/lib/$(LIBGUDEV_LINK_NAME)
|
||||||
|
|
||||||
|
@cp -v build/gudev-1.0.pc $(DESTDIR)/usr/lib/pkgconfig
|
||||||
|
@cp -v docs/gudev/html/* $(DESTDIR)/usr/share/gtk-doc/html/gudev
|
||||||
|
|
151
udev-lfs/makefile-incl.keymap
Normal file
151
udev-lfs/makefile-incl.keymap
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
# Custom systemd Makefile include that builds/installs keymap tool only for LFS
|
||||||
|
|
||||||
|
# vim: tabstop=3
|
||||||
|
|
||||||
|
KEYMAPS = \
|
||||||
|
keymaps/acer \
|
||||||
|
keymaps/acer-aspire_5720 \
|
||||||
|
keymaps/acer-aspire_8930 \
|
||||||
|
keymaps/acer-aspire_5920g \
|
||||||
|
keymaps/acer-aspire_6920 \
|
||||||
|
keymaps/acer-travelmate_c300 \
|
||||||
|
keymaps/asus \
|
||||||
|
keymaps/compaq-e_evo \
|
||||||
|
keymaps/dell \
|
||||||
|
keymaps/dell-latitude-xt2 \
|
||||||
|
keymaps/everex-xt5000 \
|
||||||
|
keymaps/fujitsu-amilo_li_2732 \
|
||||||
|
keymaps/fujitsu-amilo_pa_2548 \
|
||||||
|
keymaps/fujitsu-amilo_pro_edition_v3505 \
|
||||||
|
keymaps/fujitsu-amilo_pro_v3205 \
|
||||||
|
keymaps/fujitsu-amilo_si_1520 \
|
||||||
|
keymaps/fujitsu-esprimo_mobile_v5 \
|
||||||
|
keymaps/fujitsu-esprimo_mobile_v6 \
|
||||||
|
keymaps/genius-slimstar-320 \
|
||||||
|
keymaps/hewlett-packard \
|
||||||
|
keymaps/hewlett-packard-2510p_2530p \
|
||||||
|
keymaps/hewlett-packard-compaq_elitebook \
|
||||||
|
keymaps/hewlett-packard-pavilion \
|
||||||
|
keymaps/hewlett-packard-presario-2100 \
|
||||||
|
keymaps/hewlett-packard-tablet \
|
||||||
|
keymaps/hewlett-packard-tx2 \
|
||||||
|
keymaps/ibm-thinkpad-usb-keyboard-trackpoint \
|
||||||
|
keymaps/inventec-symphony_6.0_7.0 \
|
||||||
|
keymaps/lenovo-3000 \
|
||||||
|
keymaps/lenovo-ideapad \
|
||||||
|
keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \
|
||||||
|
keymaps/lenovo-thinkpad_x6_tablet \
|
||||||
|
keymaps/lenovo-thinkpad_x200_tablet \
|
||||||
|
keymaps/lg-x110 \
|
||||||
|
keymaps/logitech-wave \
|
||||||
|
keymaps/logitech-wave-cordless \
|
||||||
|
keymaps/logitech-wave-pro-cordless \
|
||||||
|
keymaps/maxdata-pro_7000 \
|
||||||
|
keymaps/medion-fid2060 \
|
||||||
|
keymaps/medionnb-a555 \
|
||||||
|
keymaps/micro-star \
|
||||||
|
keymaps/module-asus-w3j \
|
||||||
|
keymaps/module-ibm \
|
||||||
|
keymaps/module-lenovo \
|
||||||
|
keymaps/module-sony \
|
||||||
|
keymaps/module-sony-old \
|
||||||
|
keymaps/module-sony-vgn \
|
||||||
|
keymaps/olpc-xo \
|
||||||
|
keymaps/onkyo \
|
||||||
|
keymaps/oqo-model2 \
|
||||||
|
keymaps/samsung-other \
|
||||||
|
keymaps/samsung-90x3a \
|
||||||
|
keymaps/samsung-sq1us \
|
||||||
|
keymaps/samsung-sx20s \
|
||||||
|
keymaps/toshiba-satellite_a100 \
|
||||||
|
keymaps/toshiba-satellite_a110 \
|
||||||
|
keymaps/toshiba-satellite_m30x \
|
||||||
|
keymaps/zepto-znote
|
||||||
|
|
||||||
|
KEYMAPS_FR = \
|
||||||
|
keymaps-force-release/dell-touchpad \
|
||||||
|
keymaps-force-release/dell-xps \
|
||||||
|
keymaps-force-release/hp-other \
|
||||||
|
keymaps-force-release/samsung-other \
|
||||||
|
keymaps-force-release/samsung-90x3a \
|
||||||
|
keymaps-force-release/common-volume-keys
|
||||||
|
|
||||||
|
KEYMAP_DEPS = common src/udev/keymap/keys-from-name.h src/udev/keymap/keys-to-name.h
|
||||||
|
|
||||||
|
src/udev/keymap/keys.txt:
|
||||||
|
@echo GEN $@
|
||||||
|
$(VB)awk '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ \
|
||||||
|
{ \
|
||||||
|
if ($$2 != "KEY_MAX") { print $$2 } \
|
||||||
|
}' \
|
||||||
|
/usr/include/linux/input.h | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@
|
||||||
|
|
||||||
|
src/udev/keymap/keys-from-name.gperf: src/udev/keymap/keys.txt
|
||||||
|
@echo GEN $@
|
||||||
|
$(VB)awk 'BEGIN \
|
||||||
|
{ \
|
||||||
|
print "struct key \
|
||||||
|
{ \
|
||||||
|
const char* name; \
|
||||||
|
unsigned short id; \
|
||||||
|
};"; \
|
||||||
|
\
|
||||||
|
print "%null-strings"; print "%%"; \
|
||||||
|
} \
|
||||||
|
{ \
|
||||||
|
print $$1 ", " $$1 \
|
||||||
|
}' $< > $@
|
||||||
|
|
||||||
|
src/udev/keymap/keys-from-name.h: src/udev/keymap/keys-from-name.gperf
|
||||||
|
@echo GEN $@
|
||||||
|
$(VB)gperf -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C $< > $@
|
||||||
|
|
||||||
|
src/udev/keymap/keys-to-name.h: src/udev/keymap/keys.txt
|
||||||
|
@echo GEN $@
|
||||||
|
$(VB)awk 'BEGIN \
|
||||||
|
{ \
|
||||||
|
print "const char* const key_names[KEY_CNT] = { " \
|
||||||
|
} \
|
||||||
|
{ \
|
||||||
|
print "[" $$1 "] = \"" $$1 "\"," \
|
||||||
|
} \
|
||||||
|
END{print "};" \
|
||||||
|
}' $< > $@
|
||||||
|
|
||||||
|
build/keymap: src/udev/keymap/keymap.c build/$(COMMON_LIB) $(KEYMAP_DEPS)
|
||||||
|
@echo LINK $@
|
||||||
|
$(VB)gcc $< -o $@ -I src/udev/keymap $(WARN) $(OPTIONS2) $(INCLUDE) $(DEF) \
|
||||||
|
build/$(COMMON_LIB) $(LDFLAGS)
|
||||||
|
$(VB)strip --strip-unneeded $@
|
||||||
|
|
||||||
|
keymap: build/keymap
|
||||||
|
|
||||||
|
install-keymap: keymap
|
||||||
|
@mkdir -pv $(DESTDIR)/lib/udev/keymaps/force-release \
|
||||||
|
$(DESTDIR)/lib/udev/rules.d \
|
||||||
|
$(DESTDIR)/usr/share/doc/udev
|
||||||
|
|
||||||
|
@cp -v build/keymap $(DESTDIR)/lib/udev
|
||||||
|
|
||||||
|
@cp -v $(KEYMAPS) $(DESTDIR)/lib/udev/keymaps
|
||||||
|
@cp -v $(KEYMAPS_FR) $(DESTDIR)/lib/udev/keymaps/force-release
|
||||||
|
|
||||||
|
@cp -v src/udev/keymap/*.rules $(DESTDIR)/lib/udev/rules.d
|
||||||
|
@cp -v src/udev/keymap/findkeyboards $(DESTDIR)/lib/udev
|
||||||
|
|
||||||
|
@cp -v src/udev/keymap/*.txt $(DESTDIR)/usr/share/doc/udev
|
||||||
|
|
||||||
|
@sed -e 's|@udevlibexecdir@|/lib/udev|g' \
|
||||||
|
src/udev/keymap/keyboard-force-release.sh.in \
|
||||||
|
> $(DESTDIR)/lib/udev/keyboard-force-release.sh
|
||||||
|
|
||||||
|
@chmod 0755 $(DESTDIR)/lib/udev/keyboard-force-release.sh
|
||||||
|
|
||||||
|
clean-keymap:
|
||||||
|
rm -f src/udev/keymap/keys.txt
|
||||||
|
rm -f src/udev/keymap/keys-from-name.gperf
|
||||||
|
rm -f src/udev/keymap/keys-from-name.h
|
||||||
|
rm -f src/udev/keymap/keys-to-name.h
|
||||||
|
rm -f build/keymap
|
||||||
|
|
||||||
|
.PHONY: clean-keymap
|
115
udev-lfs/rule_generator.functions
Normal file
115
udev-lfs/rule_generator.functions
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
# functions used by the udev rule generator
|
||||||
|
|
||||||
|
# Copyright (C) 2006 Marco d'Itri <md@Linux.IT>
|
||||||
|
# Updated for LFS by Bruce Dubbs <bdubbs@linuxfromscratch.org>
|
||||||
|
# Hardcoded RUNDIR
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
PATH='/usr/bin:/bin:/usr/sbin:/sbin'
|
||||||
|
|
||||||
|
# Read a single line from file $1 in the $DEVPATH directory.
|
||||||
|
# The function must not return an error even if the file does not exist.
|
||||||
|
sysread() {
|
||||||
|
local file="$1"
|
||||||
|
[ -e "/sys$DEVPATH/$file" ] || return 0
|
||||||
|
local value
|
||||||
|
read value < "/sys$DEVPATH/$file" || return 0
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
sysreadlink() {
|
||||||
|
local file="$1"
|
||||||
|
[ -e "/sys$DEVPATH/$file" ] || return 0
|
||||||
|
readlink -f /sys$DEVPATH/$file 2> /dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return true if a directory is writeable.
|
||||||
|
writeable() {
|
||||||
|
if ln -s test-link $1/.is-writeable 2> /dev/null; then
|
||||||
|
rm -f $1/.is-writeable
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a lock file for the current rules file.
|
||||||
|
lock_rules_file() {
|
||||||
|
RUNDIR=/run/udev
|
||||||
|
[ -e "$RUNDIR" ] || return 0
|
||||||
|
|
||||||
|
RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}"
|
||||||
|
|
||||||
|
retry=30
|
||||||
|
while ! mkdir $RULES_LOCK 2> /dev/null; do
|
||||||
|
if [ $retry -eq 0 ]; then
|
||||||
|
echo "Cannot lock $RULES_FILE!" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
retry=$(($retry - 1))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
unlock_rules_file() {
|
||||||
|
[ "$RULES_LOCK" ] || return 0
|
||||||
|
rmdir $RULES_LOCK || true
|
||||||
|
}
|
||||||
|
|
||||||
|
# Choose the real rules file if it is writeable or a temporary file if not.
|
||||||
|
# Both files should be checked later when looking for existing rules.
|
||||||
|
choose_rules_file() {
|
||||||
|
RUNDIR=/run/udev
|
||||||
|
local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}"
|
||||||
|
[ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1
|
||||||
|
|
||||||
|
if writeable ${RULES_FILE%/*}; then
|
||||||
|
RO_RULES_FILE='/dev/null'
|
||||||
|
else
|
||||||
|
RO_RULES_FILE=$RULES_FILE
|
||||||
|
RULES_FILE=$tmp_rules_file
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return the name of the first free device.
|
||||||
|
raw_find_next_available() {
|
||||||
|
local links="$1"
|
||||||
|
|
||||||
|
local basename=${links%%[ 0-9]*}
|
||||||
|
local max=-1
|
||||||
|
for name in $links; do
|
||||||
|
local num=${name#$basename}
|
||||||
|
[ "$num" ] || num=0
|
||||||
|
[ $num -gt $max ] && max=$num
|
||||||
|
done
|
||||||
|
|
||||||
|
local max=$(($max + 1))
|
||||||
|
# "name0" actually is just "name"
|
||||||
|
[ $max -eq 0 ] && return
|
||||||
|
echo "$max"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Find all rules matching a key (with action) and a pattern.
|
||||||
|
find_all_rules() {
|
||||||
|
local key="$1"
|
||||||
|
local linkre="$2"
|
||||||
|
local match="$3"
|
||||||
|
|
||||||
|
local search='.*[[:space:],]'"$key"'"('"$linkre"')".*'
|
||||||
|
echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \
|
||||||
|
$RO_RULES_FILE \
|
||||||
|
$([ -e $RULES_FILE ] && echo $RULES_FILE) \
|
||||||
|
2>/dev/null)
|
||||||
|
}
|
115
udev-lfs/udevd.8
Normal file
115
udev-lfs/udevd.8
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
.\" Title: systemd-udevd.service
|
||||||
|
.\" Author: Kay Sievers <kay@vrfy.org>
|
||||||
|
.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
|
||||||
|
.\" Date: 07/20/2012
|
||||||
|
.\" Manual: systemd-udevd.service
|
||||||
|
.\" Source: systemd
|
||||||
|
.\" Language: English
|
||||||
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
.\" Manually updated for udev only for LFS by BRuce Dubbs
|
||||||
|
.\" <bdubbs@linuxfromscratch.org>
|
||||||
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
.\"
|
||||||
|
.TH "UDEVD" "8" "" "systemd (LFS modified man page)" "udevd"
|
||||||
|
.\" -----------------------------------------------------------------
|
||||||
|
.\" * Define some portability stuff
|
||||||
|
.\" -----------------------------------------------------------------
|
||||||
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
.\" http://bugs.debian.org/507673
|
||||||
|
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||||||
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
.ie \n(.g .ds Aq \(aq
|
||||||
|
.el .ds Aq '
|
||||||
|
.\" -----------------------------------------------------------------
|
||||||
|
.\" * set default formatting
|
||||||
|
.\" -----------------------------------------------------------------
|
||||||
|
.\" disable hyphenation
|
||||||
|
.nh
|
||||||
|
.\" disable justification (adjust text to left margin only)
|
||||||
|
.ad l
|
||||||
|
.\" -----------------------------------------------------------------
|
||||||
|
.\" * MAIN CONTENT STARTS HERE *
|
||||||
|
.\" -----------------------------------------------------------------
|
||||||
|
.SH "NAME"
|
||||||
|
udevd \- Device event managing daemon
|
||||||
|
.SH "SYNOPSIS"
|
||||||
|
.PP
|
||||||
|
.HP \w'\fB/usr/lib/udevd\fR\ 'u
|
||||||
|
\fB/lib/udev/udevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\fR] [\fB\-\-children\-max=\fR] [\fB\-\-exec\-delay=\fR] \ [\fB\-\-resolve\-names=early|late|never\fR] [\fB\-\-version\fR] [\fB\-\-help\fR]
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
.PP
|
||||||
|
udevd listens to kernel uevents\&. For every event, udevd executes matching instructions specified in udev rules\&. See
|
||||||
|
\fBudev\fR(7)\&.
|
||||||
|
.PP
|
||||||
|
The behavior of the running daemon can be changed with
|
||||||
|
\fBudevadm control\fR\&.
|
||||||
|
.SH "OPTIONS"
|
||||||
|
.PP
|
||||||
|
\fB\-\-daemon\fR
|
||||||
|
.RS 4
|
||||||
|
Detach and run in the background\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fB\-\-debug\fR
|
||||||
|
.RS 4
|
||||||
|
Print debug messages to stderr\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fB\-\-children\-max=\fR
|
||||||
|
.RS 4
|
||||||
|
Limit the number of parallel executed events\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fB\-\-exec\-delay=\fR
|
||||||
|
.RS 4
|
||||||
|
Number of seconds to delay the execution of RUN instructions\&. This might be useful when debugging system crashes during coldplug cause by loading non\-working kernel modules\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fB\-\-resolve\-names=\fR
|
||||||
|
.RS 4
|
||||||
|
Specify when udevd should resolve names of users and groups\&. When set to
|
||||||
|
\fBearly\fR
|
||||||
|
(the default) names will be resolved when the rules are parsed\&. When set to
|
||||||
|
\fBlate\fR
|
||||||
|
names will be resolved for every event\&. When set to
|
||||||
|
\fBnever\fR
|
||||||
|
names will never be resolved and all devices will be owned by root\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fB\-\-version\fR
|
||||||
|
.RS 4
|
||||||
|
Print version number\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fB\-\-help\fR
|
||||||
|
.RS 4
|
||||||
|
Print help text\&.
|
||||||
|
.RE
|
||||||
|
.SH "ENVIRONMENT"
|
||||||
|
.PP
|
||||||
|
\fIUDEV_LOG=\fR
|
||||||
|
.RS 4
|
||||||
|
Set the logging priority\&.
|
||||||
|
.RE
|
||||||
|
.SH "KERNEL COMMAND LINE"
|
||||||
|
.PP
|
||||||
|
The parameters starting with "rd\&.", will be read when udev is used in an initrd\&.
|
||||||
|
.PP
|
||||||
|
\fIudev\&.log\-priority=\fR, \fIrd\&.udev\&.log\-priority=\fR
|
||||||
|
.RS 4
|
||||||
|
Set the logging priority\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fIudev\&.children\-max=\fR, \fIrd\&.udev\&.children\-max=\fR
|
||||||
|
.RS 4
|
||||||
|
Limit the number of parallel executed events\&.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
\fIudev\&.exec\-delay=\fR, \fIrd\&.udev\&.exec\-delay=\fR
|
||||||
|
.RS 4
|
||||||
|
Number of seconds to delay the execution of RUN instructions\&. This might be useful when debugging system crashes during coldplug cause by loading non\-working kernel modules\&.
|
||||||
|
.RE
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.PP
|
||||||
|
\fBudev\fR(7),
|
||||||
|
\fBudevadm\fR(8)
|
126
udev-lfs/write_cd_rules
Executable file
126
udev-lfs/write_cd_rules
Executable file
@ -0,0 +1,126 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# This script is run if an optical drive lacks a rule for persistent naming.
|
||||||
|
#
|
||||||
|
# It adds symlinks for optical drives based on the device class determined
|
||||||
|
# by cdrom_id and used ID_PATH to identify the device.
|
||||||
|
|
||||||
|
# (C) 2006 Marco d'Itri <md@Linux.IT>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# debug, if UDEV_LOG=<debug>
|
||||||
|
if [ -n "$UDEV_LOG" ]; then
|
||||||
|
if [ "$UDEV_LOG" -ge 7 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules"
|
||||||
|
|
||||||
|
. /lib/udev/rule_generator.functions
|
||||||
|
|
||||||
|
find_next_available() {
|
||||||
|
raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")"
|
||||||
|
}
|
||||||
|
|
||||||
|
write_rule() {
|
||||||
|
local match="$1"
|
||||||
|
local link="$2"
|
||||||
|
local comment="$3"
|
||||||
|
|
||||||
|
{
|
||||||
|
if [ "$PRINT_HEADER" ]; then
|
||||||
|
PRINT_HEADER=
|
||||||
|
echo "# This file was automatically generated by the $0"
|
||||||
|
echo "# program, run by the cd-aliases-generator.rules rules file."
|
||||||
|
echo "#"
|
||||||
|
echo "# You can modify it, as long as you keep each rule on a single"
|
||||||
|
echo "# line, and set the \$GENERATED variable."
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "$comment" ] && echo "# $comment"
|
||||||
|
echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\""
|
||||||
|
} >> $RULES_FILE
|
||||||
|
SYMLINKS="$SYMLINKS $link"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$DEVPATH" ]; then
|
||||||
|
echo "Missing \$DEVPATH." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$ID_CDROM" ]; then
|
||||||
|
echo "$DEVPATH is not a CD reader." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" ]; then
|
||||||
|
METHOD="$1"
|
||||||
|
else
|
||||||
|
METHOD='by-path'
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$METHOD" in
|
||||||
|
by-path)
|
||||||
|
if [ -z "$ID_PATH" ]; then
|
||||||
|
echo "$DEVPATH not supported by path_id. by-id may work." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
RULE="ENV{ID_PATH}==\"$ID_PATH\""
|
||||||
|
;;
|
||||||
|
|
||||||
|
by-id)
|
||||||
|
if [ "$ID_SERIAL" ]; then
|
||||||
|
RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\""
|
||||||
|
elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then
|
||||||
|
RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\""
|
||||||
|
else
|
||||||
|
echo "$DEVPATH not supported by ata_id. by-path may work." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Invalid argument (must be either by-path or by-id)." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Prevent concurrent processes from modifying the file at the same time.
|
||||||
|
lock_rules_file
|
||||||
|
|
||||||
|
# Check if the rules file is writeable.
|
||||||
|
choose_rules_file
|
||||||
|
|
||||||
|
link_num=$(find_next_available 'cdrom[0-9]*')
|
||||||
|
|
||||||
|
match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE"
|
||||||
|
|
||||||
|
comment="$ID_MODEL ($ID_PATH)"
|
||||||
|
|
||||||
|
write_rule "$match" "cdrom$link_num" "$comment"
|
||||||
|
[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \
|
||||||
|
write_rule "$match" "cdrw$link_num"
|
||||||
|
[ "$ID_CDROM_DVD" ] && \
|
||||||
|
write_rule "$match" "dvd$link_num"
|
||||||
|
[ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \
|
||||||
|
write_rule "$match" "dvdrw$link_num"
|
||||||
|
echo >> $RULES_FILE
|
||||||
|
|
||||||
|
unlock_rules_file
|
||||||
|
|
||||||
|
echo $SYMLINKS
|
||||||
|
|
||||||
|
exit 0
|
141
udev-lfs/write_net_rules
Executable file
141
udev-lfs/write_net_rules
Executable file
@ -0,0 +1,141 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# This script is run to create persistent network device naming rules
|
||||||
|
# based on properties of the device.
|
||||||
|
# If the interface needs to be renamed, INTERFACE_NEW=<name> will be printed
|
||||||
|
# on stdout to allow udev to IMPORT it.
|
||||||
|
|
||||||
|
# variables used to communicate:
|
||||||
|
# MATCHADDR MAC address used for the match
|
||||||
|
# MATCHID bus_id used for the match
|
||||||
|
# MATCHDEVID dev_id used for the match
|
||||||
|
# MATCHDRV driver name used for the match
|
||||||
|
# MATCHIFTYPE interface type match
|
||||||
|
# COMMENT comment to add to the generated rule
|
||||||
|
# INTERFACE_NAME requested name supplied by external tool
|
||||||
|
# INTERFACE_NEW new interface name returned by rule writer
|
||||||
|
|
||||||
|
# Copyright (C) 2006 Marco d'Itri <md@Linux.IT>
|
||||||
|
# Copyright (C) 2007 Kay Sievers <kay.sievers@vrfy.org>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# debug, if UDEV_LOG=<debug>
|
||||||
|
if [ -n "$UDEV_LOG" ]; then
|
||||||
|
if [ "$UDEV_LOG" -ge 7 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
|
||||||
|
|
||||||
|
. /lib/udev/rule_generator.functions
|
||||||
|
|
||||||
|
interface_name_taken() {
|
||||||
|
local value="$(find_all_rules 'NAME=' $INTERFACE)"
|
||||||
|
if [ "$value" ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
find_next_available() {
|
||||||
|
raw_find_next_available "$(find_all_rules 'NAME=' "$1")"
|
||||||
|
}
|
||||||
|
|
||||||
|
write_rule() {
|
||||||
|
local match="$1"
|
||||||
|
local name="$2"
|
||||||
|
local comment="$3"
|
||||||
|
|
||||||
|
{
|
||||||
|
if [ "$PRINT_HEADER" ]; then
|
||||||
|
PRINT_HEADER=
|
||||||
|
echo "# This file was automatically generated by the $0"
|
||||||
|
echo "# program, run by the persistent-net-generator.rules rules file."
|
||||||
|
echo "#"
|
||||||
|
echo "# You can modify it, as long as you keep each rule on a single"
|
||||||
|
echo "# line, and change only the value of the NAME= key."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
[ "$comment" ] && echo "# $comment"
|
||||||
|
echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\""
|
||||||
|
} >> $RULES_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$INTERFACE" ]; then
|
||||||
|
echo "missing \$INTERFACE" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prevent concurrent processes from modifying the file at the same time.
|
||||||
|
lock_rules_file
|
||||||
|
|
||||||
|
# Check if the rules file is writeable.
|
||||||
|
choose_rules_file
|
||||||
|
|
||||||
|
# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces
|
||||||
|
if [ "$MATCHADDR" ]; then
|
||||||
|
match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MATCHDRV" ]; then
|
||||||
|
match="$match, DRIVERS==\"$MATCHDRV\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MATCHDEVID" ]; then
|
||||||
|
match="$match, ATTR{dev_id}==\"$MATCHDEVID\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MATCHID" ]; then
|
||||||
|
match="$match, KERNELS==\"$MATCHID\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MATCHIFTYPE" ]; then
|
||||||
|
match="$match, ATTR{type}==\"$MATCHIFTYPE\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$match" ]; then
|
||||||
|
echo "missing valid match" >&2
|
||||||
|
unlock_rules_file
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basename=${INTERFACE%%[0-9]*}
|
||||||
|
match="$match, KERNEL==\"$basename*\""
|
||||||
|
|
||||||
|
if [ "$INTERFACE_NAME" ]; then
|
||||||
|
# external tools may request a custom name
|
||||||
|
COMMENT="$COMMENT (custom name provided by external tool)"
|
||||||
|
if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then
|
||||||
|
INTERFACE=$INTERFACE_NAME;
|
||||||
|
echo "INTERFACE_NEW=$INTERFACE"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# if a rule using the current name already exists, find a new name
|
||||||
|
if interface_name_taken; then
|
||||||
|
INTERFACE="$basename$(find_next_available "$basename[0-9]*")"
|
||||||
|
# prevent INTERFACE from being "eth" instead of "eth0"
|
||||||
|
[ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0
|
||||||
|
echo "INTERFACE_NEW=$INTERFACE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
write_rule "$match" "$INTERFACE" "$COMMENT"
|
||||||
|
|
||||||
|
unlock_rules_file
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user