Understanding Computer Hardware

«« Previous
Next »»

Understanding Computer Hardware becomes topic 4.2 of the LPI Linux Essentials certification exam. Whilst we investigate this objective we will dive headlong into how Linux talks with the computer’s hardware. This will include the video where we will take a tour of driver management within Linux. Looking at the Linux command line tools:

◉ modprobe
◉ lsmod
◉ modifo
◉ hwinfo

The procfs


Firstly we can look at how the /proc directory, also known as the procfs, which holds so much information about the running system. Taking a look at the /proc/partitions file we will see that it lists are partitions, perhaps this is more easily shown with the command  fdisk. This is feature of both Linux and the procfs. Developers will write commands to format and extract information stored within files in the procfs.

Computer Hardware, LPIC-1 Exam, LPIC-2 Exam, LPIC-3 Exam

Another fine example of this is to use the command lsmod. Used to list the loaded Kernel modules. This command reads from the file /proc/modules and formats the data for us.

Computer Hardware, LPIC-1 Exam, LPIC-2 Exam, LPIC-3 Exam

Kernel Modules


Kernel Modules act as the interface between the Operating System and the hardware. Some people will refer to these modules as drivers. As the hardware is detected the driver is usually automatically loaded; however we can manually load and unload modules with the command modprobe. Which is in turn an interface to the commands insmod and rmmod.

To load the parallel port driver we could use:

modprobe parport_pc

Alternatively, we could use insmod:

insmod <full path to module>.ko

It is the full path that becomes problematic and why modprobe is such a useful tool.  To unload drivers we use the -r option with modprobe, yes you have guessed the -r is remove. We can also use rmmod but we do not need the full path to remove a module.

modinfo parport_pc

or

rmmod parport_pc

To obtain information on a driver such as its purpose, author and options we can use the modinfo. The module does not need to be loaded to see this information.

modinfo parport_pc

Using HWINFO


Another useful command is hwinfo, we can take a look at:

◉ hwinfo --help
◉ hwinfo --netcard
◉ hwinfo --gfxcard

The command hwinfo list the hardware and the driver used to access the hardware, including the command and any options used in loading the driver. hwinfo is a very useful reporting and diagnostics tool that you shouldn’t overlook.


«« Previous
Next »»

0 comments:

Post a Comment