📄 readme
字号:
it to maintain compatibility entries. It is almost certain that youwill require this. Note that the kernel creates a compatibility entryfor the root device, so you don't need initrd.Note that you no longer need to mount devpts if you use Unix98 PTYs,as devfs can manage /dev/pts itself. This saves you some RAM, as youdon't need to compile and install devpts. Note that some versions ofglibc have a bug with Unix98 pty handling on devfs systems. Contactthe glibc maintainers for a fix. Glibc 2.1.3 has the fix.Note also that apart from editing /etc/fstab, other things will needto be changed if you *don't* install devfsd. Some software (like the Xserver) hard-wire device names in their source. It really is mucheasier to install devfsd so that compatibility entries are created.You can then slowly migrate your system to using the new device names(for example, by starting with /etc/fstab), and then limiting thecompatibility entries that devfsd creates.MAKE SURE YOU INSTALL DEVFSD BEFORE YOU BOOT A DEVFS-ENABLED KERNEL!Now that devfs has gone into the 2.3.46 kernel, I'm getting a lot ofreports back. Many of these are because people are trying to runwithout devfsd, and hence some things break. Please just run devfsd ifthings break. I want to concentrate on real bugs rather thanmisconfiguration problems at the moment. If people are willing to fixbugs/false assumptions in other code (i.e. glibc, X server) and submitthat to the respective maintainers, that would be great.All the way with DevfsThe devfs kernel patch creates a rationalised device tree. As statedabove, if you want to keep using the old /dev naming scheme,you just need to configure devfsd appopriately (see the manpage). People who prefer the old names can ignore this section. Forthose of us who like the rationalised names and an uncluttered/dev, read on.If you don't run devfsd, or don't enable compatibility entrymanagement, then you will have to configure your system to use the newnames. For example, you will then need to edit your/etc/fstab to use the new disc naming scheme. If you want tobe able to boot non-devfs kernels, you will need compatibilitysymlinks in the underlying disc-based /dev pointing back tothe old-style names for when you boot a kernel without devfs.You can selectively decide which devices you want compatibilityentries for. For example, you may only want compatibility entries forBSD pseudo-terminal devices (otherwise you'll have to patch you Clibrary or use Unix98 ptys instead). It's just a matter of putting inthe correct regular expression into /dev/devfsd.conf.There are other choices of naming schemes that you may prefer. Forexample, I don't use the kernel-suppliednames, because they are too verbose. A common misconception isthat the kernel-supplied names are meant to be used directly inconfiguration files. This is not the case. They are designed toreflect the layout of the devices attached and to provide easyclassification.If you like the kernel-supplied names, that's fine. If you don't thenyou should be using devfsd to construct a namespace more to yourliking. Devfsd has built-in code to construct anamespace that is both logical and easy tomanage. In essence, it creates a convenient abbreviation of thekernel-supplied namespace.You are of course free to build your own namespace. Devfsd has all theinfrastructure required to make this easy for you. All you need do iswrite a script. You can even write some C code and devfsd can load theshared object as a callable extension.Other IssuesThe init programmeAnother thing to take note of is whether your init programmecreates a Unix socket /dev/telinit. Some versions of initcreate /dev/telinit so that the telinit programme cancommunicate with the init process. If you have such a system you needto make sure that devfs is mounted over /dev *before* initstarts. In other words, you can't leave the mounting of devfs to/etc/rc, since this is executed after init. Otherversions of init require a named pipe /dev/initctlwhich must exist *before* init starts. Once again, you need tomount devfs and then create the named pipe *before* initstarts.The default behaviour now is not to mount devfs onto /dev atboot time for 2.3.x and later kernels. You can correct this with the"devfs=mount" boot option. This solves any problems with init,and also prevents the dreaded:Cannot open initial consolemessage. For 2.2.x kernels where you need to apply the devfs patch,the default is to mount.If you have automatic mounting of devfs onto /dev then youmay need to create /dev/initctl in your boot scripts. Thefollowing lines should suffice:mknod /dev/initctl pkill -SIGUSR1 1 # tell init that /dev/initctl now existsAlternatively, if you don't want the kernel to mount devfs onto/dev then you could use the following procedure is aguideline for how to get around /dev/initctl problems:# cd /sbin# mv init init.real# cat > init#! /bin/shmount -n -t devfs none /devmknod /dev/initctl pexec /sbin/init.real $*[control-D]# chmod a+x initNote that newer versions of init create /dev/initctlautomatically, so you don't have to worry about this.Module autoloadingYou will need to configure devfsd to enable moduleautoloading. The following lines should be placed in your/etc/devfsd.conf file:LOOKUP .* MODLOADAs of devfsd-v1.3.10, a generic /etc/modules.devfsconfiguration file is installed, which is used by the MODLOADaction. This should be sufficient for most configurations. If yourequire further configuration, edit your /etc/modules.conffile.Mounting root off a devfs deviceIf you wish to mount root off a devfs device when you pass the"devfs=only" boot option, then you need to pass in the "root="option to the kernel when booting. If you use LILO, then you must havethis in lilo.conf:append = "root=<device>"Surprised? Yep, so was I. It turns out if you have (as most peopledo):root = <device>then LILO will determine the device number of and will writethat device number into a special place in the kernel image beforestarting the kernel, and the kernel will use that device number tomount the root filesystem. So, using the "append" variety ensures thatLILO passes the root filesystem device as a string, which devfs canthen use.Note that this isn't an issue if you don't pass "devfs=only".TTY issuesThe ttyname(3) function in some versions of the C library makesfalse assumptions about device entries which are symbolic links. Thetty(1) programme is one that depends on this function. I'vewritten a patch to libc 5.4.43 which fixes this. This has beenincluded in libc 5.4.44 and a similar fix is in glibc 2.1.3.Kernel Naming SchemeThe kernel provides a default naming scheme. This scheme is designedto make it easy to search for specific devices or device types, and toview the available devices. Some device types (such as hard discs),have a directory of entries, making it easy to see what devices ofthat class are available. Often, the entries are symbolic links into adirectory tree that reflects the topology of available devices. Thetopological tree is useful for finding how your devices are arranged.Disc DevicesAll discs, whether SCSI, IDE or whatever, are placed under the/dev/discs hierarchy: /dev/discs/disc0 first disc /dev/discs/disc1 second discEach of these entries is a symbolic link to the directory for thatdevice. The device directory contains: disc for the whole disc part* for individual partitionsCD-ROM DevicesAll CD-ROMs, whether SCSI, IDE or whatever, are placed under the/dev/cdroms hierarchy: /dev/cdroms/cdrom0 first CD-ROM /dev/cdroms/cdrom1 second CD-ROMEach of these entries is a symbolic link to the real device entry forthat device.Tape DevicesAll tapes, whether SCSI, IDE or whatever, are placed under the/dev/tapes hierarchy: /dev/tapes/tape0 first tape /dev/tapes/tape1 second tapeEach of these entries is a symbolic link to the directory for thatdevice. The device directory contains: mt for mode 0 mtl for mode 1 mtm for mode 2 mta for mode 3 mtn for mode 0, no rewind mtln for mode 1, no rewind mtmn for mode 2, no rewind mtan for mode 3, no rewindSCSI DevicesTo uniquely identify any SCSI device requires the followinginformation: controller (host adapter) bus (SCSI channel) target (SCSI ID) unit (Logical Unit Number)All SCSI devices are placed under /dev/scsi (assuming devfsis mounted on /dev). Hence, a SCSI device with the followingparameters: c=1,b=2,t=3,u=4 would appear as: /dev/scsi/host1/bus2/target3/lun4 device directoryInside this directory, a number of device entries may be created,depending on which SCSI device-type drivers were installed.See the section on the disc naming scheme to see what entries the SCSIdisc driver creates.See the section on the tape naming scheme to see what entries the SCSItape driver creates.The SCSI CD-ROM driver creates: cdThe SCSI generic driver creates: genericIDE DevicesTo uniquely identify any IDE device requires the followinginformation: controller bus (aka. primary/secondary) target (aka. master/slave) unitAll IDE devices are placed under /dev/ide, and uses a similarnaming scheme to the SCSI subsystem.XT Hard DiscsAll XT discs are placed under /dev/xd. The first XT disc hasthe directory /dev/xd/disc0.TTY devicesThe tty devices now appear as: New name Old-name Device Type -------- -------- ----------- /dev/tts/{0,1,...} /dev/ttyS{0,1,...} Serial ports /dev/cua/{0,1,...} /dev/cua{0,1,...} Call out devices /dev/vc/{0,1,...} /dev/tty{1...63} Virtual consoles /dev/vcc/{0,1,...} /dev/vcs{1...63} Virtual consoles /dev/pty/m{0,1,...} /dev/ptyp?? PTY masters /dev/pty/s{0,1,...} /dev/ttyp?? PTY slavesRAMDISCSThe RAMDISCS are placed in their own directory, and are named thus: /dev/rd/{0,1,2,...}Meta DevicesThe meta devices are placed in their own directory, and are namedthus: /dev/md/{0,1,2,...}Floppy discsFloppy discs are placed in the /dev/floppy directory.Loop devicesLoop devices are placed in the /dev/loop directory.Sound devicesSound devices are placed in the /dev/sound directory(audio, sequencer, ...).Devfsd Naming SchemeDevfsd provides a naming scheme which is a convenient abbreviation ofthe kernel-supplied namespace. In somecases, the kernel-supplied naming scheme is quite convenient, sodevfsd does not provide another naming scheme. The convenience namesthat devfsd creates are in fact the same names as the original devfskernel patch created (before Linus mandated the Big Name Change).In order to configure devfsd to create these convenience names, thefollowing lines should be placed in your /etc/devfsd.conf:REGISTER .* MKNEWCOMPATUNREGISTER .* RMNEWCOMPATThis will cause devfsd to create (and destroy) symbolic links whichpoint to the kernel-supplied names.SCSI Hard DiscsAll SCSI discs are placed under /dev/sd (assuming devfs ismounted on /dev). Hence, a SCSI disc with the followingparameters: c=1,b=2,t=3,u=4 would appear as: /dev/sd/c1b2t3u4 for the whole disc /dev/sd/c1b2t3u4p5 for the 5th partition /dev/sd/c1b2t3u4p5s6 for the 6th slice in the 5th partitionSCSI TapesAll SCSI tapes are placed under /dev/st. A similar namingscheme is used as for SCSI discs. A SCSI tape with theparameters:c=1,b=2,t=3,u=4 would appear as: /dev/st/c1b2t3u4m0 for mode 0 /dev/st/c1b2t3u4m1 for mode 1 /dev/st/c1b2t3u4m2 for mode 2 /dev/st/c1b2t3u4m3 for mode 3 /dev/st/c1b2t3u4m0n for mode 0, no rewind /dev/st/c1b2t3u4m1n for mode 1, no rewind /dev/st/c1b2t3u4m2n for mode 2, no rewind /dev/st/c1b2t3u4m3n for mode 3, no rewindSCSI CD-ROMsAll SCSI CD-ROMs are placed under /dev/sr. A similar namingscheme is used as for SCSI discs. A SCSI CD-ROM with theparameters:c=1,b=2,t=3,u=4 would appear as: /dev/sr/c1b2t3u4SCSI Generic DevicesAll SCSI CD-ROMs are placed under /dev/sg. A similar namingscheme is used as for SCSI discs. A SCSI generic device with theparameters:c=1,b=2,t=3,u=4 would appear as: /dev/sg/c1b2t3u4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -