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
HAL
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
DBUS
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.
UDEV
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
/sys
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
/proc
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:
/proc/meminfo
/proc/cpuinfo
/proc/mounts
/proc/sys/fs/file-max
/proc/sys/net/ipv4/ipv_forward
To make settings permanent use /etc/sysctl.conf
/dev
Created by UDEV
Contains:
block devices
tty
cdroms
ports
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
kernel modules
- rmmod
- remove kernel modules (deprecated)
- insmod
- insert module into the kernel
- modprobe
- does both
- does both
- /etc/modules
- auto add modules
- /etc/modprobe.d
- add things to the running kernel
device ID-UUID
- /home
- /var
- /root
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.
No comments:
Post a Comment