Bruce Dubbs wrote:
Alexander E. Patrakov wrote:
So I propose to ditch the script from LFS and optionally move it to BLFS
or to a hint. LFS should provide readers with instructions to create the
relevant rules manually:
# Begin 82-persistent-cd.rules
# SAMSUNG_CD-ROM_SC-148F (pci-0000:00:07.1-ide-0:1)
ACTION=="add", BUS=="ide", ID=="0.1", SYMLINK+="cdrom"
# PHILIPS_CDD5301 (pci-0000:00:07.1-ide-1:1)
ACTION=="add", BUS=="ide", ID=="1.1", SYMLINK+="cdrom1"
ACTION=="add", BUS=="ide", ID=="1.1", SYMLINK+="cdrw1"
ACTION=="add", BUS=="ide", ID=="1.1", SYMLINK+="dvd1"
# End 82-persistent-cd.rules
I like this approach. It is actually fairly educational, not terribly
complex, and is not that different in concept from having the users fill
in their own fstab.
I do think there needs to be more comments into the appropriate values
of ID and how it would vary on individual systems. A comment on the
actual name of the device that udev sets would also be appropriate.
The rules above were just a copy-and-paste from the generated file. You can
certainly use any other attributes that won't change.
home:~# udevinfo -q all -n /dev/hdd
P: /block/hdd
N: hdd
S: disk/by-id/ata-PHILIPS_CDD5301_5VO1306DM00190
S: disk/by-path/pci-0000:00:07.1-ide-1:1
S: cdrom1
S: cdrw
S: dvd
E: ID_CDROM=1
E: ID_CDROM_CD_R=1
E: ID_CDROM_CD_RW=1
E: ID_CDROM_DVD=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: ID_CDROM_RAM=1
E: ID_TYPE=cd
E: ID_MODEL=PHILIPS_CDD5301
E: ID_SERIAL=5VO1306DM00190
E: ID_REVISION=B1.1
E: ID_BUS=ata
E: ID_PATH=pci-0000:00:07.1-ide-1:1
E: GENERATED=1
(look at lines beginning with E:, they represent environment variables)
home:~# udevinfo -a -p /block/hdd
udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.
looking at device '/block/hdd':
KERNEL=="hdd"
SUBSYSTEM=="block"
SYSFS{stat}==" 0 0 0 0 0 0
0 0 0 0 0"
SYSFS{size}=="8388604"
SYSFS{removable}=="1"
SYSFS{range}=="1"
SYSFS{dev}=="22:64"
looking at device '/devices/pci0000:00/0000:00:07.1/ide1/1.1':
ID=="1.1"
BUS=="ide"
DRIVER=="ide-cdrom"
looking at device '/devices/pci0000:00/0000:00:07.1/ide1':
ID=="ide1"
BUS==""
DRIVER==""
looking at device '/devices/pci0000:00/0000:00:07.1':
ID=="0000:00:07.1"
BUS=="pci"
DRIVER=="VIA_IDE"
SYSFS{modalias}=="pci:v00001106d00000571sv00001458sd00005002bc01sc01i8a"
SYSFS{local_cpus}=="1"
SYSFS{irq}=="0"
SYSFS{class}=="0x01018a"
SYSFS{subsystem_device}=="0x5002"
SYSFS{subsystem_vendor}=="0x1458"
SYSFS{device}=="0x0571"
SYSFS{vendor}=="0x1106"
looking at device '/devices/pci0000:00':
ID=="pci0000:00"
BUS==""
DRIVER==""
that's even more variables to look for. Therefore, _any_ of the rules below will
result in /dev/cdrom1 -> hdd symlink on my system:
ACTION=="add", BUS=="ide", ID=="1.1", SYMLINK+="cdrom1"
ACTION=="add", ENV{ID_CDROM}=="1", ENV{ID_PATH}=="pci-0000:00:07.1-ide-1:1",
SYMLINK+="cdrom1"
ACTION=="add", ENV{ID_CDROM}=="1", ENV{ID_MODEL}=="PHILIPS_CDD5301",
SYMLINK+="cdrom1"
Or even, if one doesn't have add-on IDE boards (so that all of the IDE channels
are managed by one driver):
KERNEL=="hdd", SYMLINK+="cdrom1"
--
Alexander E. Patrakov
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page