In order to have a better understanding of GNU Linux we would need to understand it’s ways of seeing the hardware devices attached to the system.
- Determine Settings:
- HAL, dbus, udev
- /sys, /proc, /dev
- lsmod, lsusb, lspci
- Configure Settings:
- Set device ID
- Kernel Modules
- Adding / Removing devices
1.1 HAL, dbus, udev
Hardware Abstraction Layer, HAL abstracts the concept of a device. For instance a network card from vendor X is abstracted by HAL as a NIC with a name of eth0 (if it’s the only card in the system). So the system does not care about brand but what is the device’s purpouse
HAL runs a daemon called hald
This is communication channel between HAL and the Desktop Manager installed (GDM, KDE, XDM, etc.). For instance if we plug in a USB device (camera, scanner, printer, whatever), DBUS can tell that it found a device but will not tell you the brand. The DBUS is a way of traversinf information from the desktop envrionment to HAL, it’s a communication methodology, or a communication pathway.
In traditional UNIX and LINUX file-systems you would have a huge list of files such as: /dev/sda, /dev/sdb, /dev/sdc.. you had to guess where the device was plugged in. When the system starts up it will create these devices on the fly.
UDEV also allows for rules to be created and based on serial #, type of device, …. it can be mounted as a custom device (/dev/whoaaaa)
1.2 /sys, /proc, /dev
This is directory where HAL keeps the database of all that is connected
user@debian:~$ ls /sys/
block class devices fs kernel power bus dev firmware hypervisor module
user@debian:~$ ls /sys/bus/
ac97 gameport i2c pci_express pnp serio usb acpi hid pci platform scsi spi
This is a virutal directory, held in RAM, the current running kernel keeps it’s running commands, the files are read-write attributes, changes are temoprary and only root can change them
Files of intrest:
To make settings permanent use /etc/sysctl.conf
Created by UDEV
1.3 lsmod, lspci, lsusb
If ls is the normal listing command then lsmod lists kernel modules, lspci lists pci devices, lsusb lists usb devices
root hubs are the USB themselves
2. Configure settings
- remove kernel modules (deprecated)
- insert module into the kernel
- does both
- does both
- auto add modules
- add things to the running kernel
You can mount these specific folders if they are on different partitions based on the UUID, when you mount the thing instead of using /dev/sda, you use a unique number ex.
/dev/disk/by-uuid/fd267fa3-83b6-4cda-a705-d567632fb3a7 / ext3 rw,relatime,errors=remount-ro,data=ordered 0 0
you can mount a device based on it's unique value.
Post a Comment