1*4882a593SmuzhiyunWhen building a target filesystem, it is desirable to not have to 2*4882a593Smuzhiyunbecome root and then run 'mknod' a thousand times. Using a device 3*4882a593Smuzhiyuntable you can create device nodes and directories "on the fly". 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunYou can do all sorts of interesting things with a device table file. 6*4882a593SmuzhiyunFor example, if you want to adjust the permissions on a particular 7*4882a593Smuzhiyunfile you can just add an entry like: 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun /sbin/foobar f 2755 0 0 - - - - - 10*4882a593Smuzhiyun 11*4882a593Smuzhiyunand (assuming the file /sbin/foobar exists) it will be made setuid 12*4882a593Smuzhiyunroot (regardless of what its permissions are on the host filesystem. 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunFurthermore, you can use a single table entry to create a many device 15*4882a593Smuzhiyunminors. For example, if I wanted to create /dev/hda and 16*4882a593Smuzhiyun/dev/hda[0-15] I could just use the following two table entries: 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun /dev/hda b 640 0 0 3 0 0 0 - 19*4882a593Smuzhiyun /dev/hda b 640 0 0 3 1 1 1 15 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunDevice table entries take the form of: 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count> 24*4882a593Smuzhiyun 25*4882a593Smuzhiyunwhere name is the file name, type can be one of: 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun f: A regular file 28*4882a593Smuzhiyun d: Directory 29*4882a593Smuzhiyun c: Character special device file 30*4882a593Smuzhiyun b: Block special device file 31*4882a593Smuzhiyun p: Fifo (named pipe) 32*4882a593Smuzhiyun 33*4882a593Smuzhiyunuid is the user id for the target file, gid is the group id for the 34*4882a593Smuzhiyuntarget file. The rest of the entries (major, minor, etc) apply only 35*4882a593Smuzhiyunto device special files. 36