Basic knowledge of Linux Hardware Management

Source: Internet
Author: User
Tags dmesg
Article Title: Basic knowledge of Linux Hardware Management. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1. Identification of hardware in Linux;

In the LinuxSir. Org discussion area, we often see some brothers describe their hardware as follows: "My display card is made of XXX brands. What should I do if Linux does not support it ?". In fact, this is the worst description, and there is no way for everyone to help; because Linux's Hardware recognition is based on the chipset manufacturer rather than the hardware brand; most of the hardware manufacturers are OEM, which means that they cannot produce the main chip of the hardware, but they will take it from the main chip manufacturer and weld it to their own circuit board. This is the OEM process;

No matter what hardware is identified by the chipset manufacturer, rather than the brand on which the market sees it. For example, we can see a variety of video cards on the market, in fact, let's take a look at their chips, mostly from ATI and NVIDIA. All ATI and NVIDIA drivers are developed by ATI and NVIDIA. So when we ask a question, we need to say that the hardware chip is the only identifier of the driver, not the brand !!!

Therefore, when looking for a hardware driver, we must find the driver based on the information of the hardware master chip;

2. Tools for viewing hardware information in Linux;

In Linux, there is no tool to view the hardware chip information. It should be said that the Linux tool can view the hardware information more clearly. The following describes several common tools; the most commonly used tool is lspci; the other tools are just a bit of knowledge;

1. lspci lists all PCI devices;

Lspci-list all PCI devices, mainly used to list PCI devices on the machine, such as sound cards, video cards, cats, and NICs. The integrated motherboard devices can also be listed. lspci reads the hwdata database, hwdata is provided by the software package hwdata; there are about the following files;

[Beinan @ localhost ~] # Rpm-ql hwdata-0.158-1.
/Etc/hotplug/blacklist
/Etc/pcmcia
/Etc/pcmcia/config
/Usr/X11R6/lib/X11/Cards
/Usr/share/doc/hwdata-0.158
/Usr/share/doc/hwdata-0.158/COPYING
/Usr/share/doc/hwdata-0.158/LICENSE
/Usr/share/hwdata
/Usr/share/hwdata/CardMonitorCombos
/Usr/share/hwdata/Cards
/Usr/share/hwdata/MonitorsDB
/Usr/share/hwdata/pci. ids
/Usr/share/hwdata/pcitable
/Usr/share/hwdata/upgradelist
/Usr/share/hwdata/usb. ids

Lspci has two common parameters:-B and-v. lspci also lists the usb interfaces;

Example:

[Root @ localhost beinan] # lspci-B
. 0 Host bridge: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
. 1 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
. 3 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
. 0 VGA compatible controller: Intel Corporation 82852/855 GM Integrated Graphics Device (rev 02)
. 1 Display controller: Intel Corporation 82852/855 GM Integrated Graphics Device (rev 02)
00: 1d. 0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) usb uhci Controller #1 (rev 03)
00: 1d. 1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) usb uhci Controller #2 (rev 03)
00: 1d. 2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) usb uhci Controller #3 (rev 03)
00: 1d. 7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 03)
00: 1e. 0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 83)
00: 1f. 0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 03)
00: 1f. 1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 03)
00: 1f. 3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 03)
00: 1f. 5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) ac'97 Audio Controller (rev 03)
00: 1f. 6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC '97 Modem Controller (rev 03)
. 0 Ethernet controller: Realtek semiconduco., Ltd. RTL-8139/8139C/8139C + (rev 10)
. 0 carw.bridge: Texas Instruments PCIxx21/x515 carw.controller
. 2 FireWire (IEEE 1394): Texas Instruments OHCI Compliant IEEE 1394 Host Controller
. 3 Unknown mass storage controller: Texas Instruments PCIxx21 Integrated FlashMedia Controller
. 4 Class 0805: Texas Instruments PCI6411, PCI6421, PCI6611, PCI6621, PCI7411, PCI7421, PCI7611, PCI7621 Secure Digital (SD)

Analyze What devices are available on this machine. Check whether the devices are applicable to our applications;

. 0 VGA compatible controller: Intel Corporation 82852/855 GM Integrated Graphics Device (rev 02)
. 1 Display controller: Intel Corporation 82852/855 GM Integrated Graphics Device (rev 02) Note: This is a Display card;
USB Controller indicates the USB interface. We can see three of these devices. My laptop has exactly three USB interfaces;
Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) ac'97 Audio Controller (rev 03) Note: This is a sound card;
Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) ac'97 Modem Controller (rev 03) Note: This is a cat;
Ethernet controller: Realtek semiconduco., Ltd. RTL-8139/8139C/8139C + (rev 10) Note: This is the NIC, the chip is 8139;
FireWire (IEEE 1394): Texas Instruments OHCI Compliant IEEE 1394 Host Controller note: this is information about the 1394 Interface. In fact, my notebook also has this interface;

So what is the use of this information? If some devices on the machine do not support this function well, we can search for this information on Google. For example, I feel that my sound card is faulty, you can search for the solution based on the sound card information. Based on the information, you can go to the hardware chipset official website to find the answer or driver;

If you want to know more about the hardware, you can use lspci-v to view it;

[Root @ localhost beinan] # lspci-v

For example, we can use lspci-v to check the irq interruption of the hardware. For example, if the NIC is not easy to use, is there a conflict with the irq? If you do not know how to solve the hardware driver problem, you need to paste the entire segment of the lspci-v hardware information, which is the only solution to the problem; therefore, it is extremely important to learn to ask questions;

Some system releases and lsusb tools. Please try them yourself;

2. Storage Device viewing and operation tools;

We can see that the main tools for storage devices are fdisk, parted, and cfdisk. fdisk is the most commonly used and convenient tool. parted should be a supplement. This tool is not very mature at present;

See:

Introduction to Linux commands for viewing disk partitions, file systems, usage, and related tools
How to Use fdisk for instance explanation

3. view the corresponding files in the/proc directory to obtain some hardware information;

We will notice this line when viewing/etc/fstab;

/Dev/proc defaults 0 0

Proc looks like a file system. In fact, it is not a real file system. It is "proc-process information pseudo-filesystem ", the process information disguising the file system;
"The proc filesystem is a pseudo-filesystem which is used as an interface to kernel data
Structures. It is commonly mounted at/proc. Most of it is read-only, but some files allow
Kernel variables to be changed ."

I will try to translate it and then understand it based on/proc. As an interface for kernel data structure, the proc file system refers to some kernel information (such as hardware information, including CPU, Nic, display card, memory, file system, and SCSI device ....) in the proc file system, the proc is written to the/proc directory by the mont; in the/proc directory, most of the big data files are read-only, but some data changes according to kernel changes; the data in the/proc directory is subject to frequent changes. Each process in the system has a PID, which can be found in/proc; we can also view the process through ps-aux | more;

We can use the cat command to read files in the/proc directory, such as cpu information;

[Root @ localhost beinan] # cat/proc/cpuinfo

You need to check the details. It is also necessary to understand/proc;

4. dmesg

Dmesg is a tool used to display the system control information of the kernel buffer. For example, information about the system at startup is written to/var/log/

Note: The dmesg tool is not used to view the hardware chipset ID, but it allows us to know some hardware parameters in the machine, write hardware-related logs to the/var/log/message * Or/var/log/boot * file;

If we use this tool to view some hardware information, this tool is too informative and requires patience;

[Root @ localhost beinan] # dmesg

[Root @ localhost beinan] # dmesg-c note: the buffer zone is cleared and will be automatically generated the next time it is started;

5. hwbrowser

Hwbrowser is the graphical browser of your current hardware configuration. This tool is graphic. The system may not be installed by default. You must install it. In Fedora 4.0, if yum or apt can be used, the following command should be used for installation;

[Root @ localhost beinan] # yum install hwbrowser
Or
[Root @ localhost beinan] # apt install hwbrowser
[Root @ localhost beinan] # hwbrowser

Of course, you can also find the rpm package on rpmfind.net or freshrpms.net to install

[Root @ localhost beinan] # rpm-ivh hwbrowser *. rpm

We recommend that you install the software package Update Tool yum and apt to automatically resolve dependencies;

6. lshal and hal-device-manager

The hardware information can also be known through lshal and hal-device-manager. However, this tool is a bit difficult for new users, but I still need to introduce it;

[Root @ localhost beinan] # lshal

Hwbrowser is the graphical interface of lshal. The system may not be installed by default. This toolkit is a Fedora extension package and needs to be installed. In Fedora 4.0, if yum or apt can be used, the following command should be used for installation;

[Root @ localhost beinan] # yum install hal-device-manager
Or
[Root @ localhost beinan] # apt install hal-device-manager
[Root @ localhost beinan] # hal-device-manager

Of course, you can also find the rpm package on rpmfind.net or freshrpms.net to install

[Root @ localhost beinan] # rpm-ivh hal-device-manager *. rpm

We recommend that you install the software package Update Tool yum and apt to automatically resolve dependencies;

3. Different hardware have different configuration tools and corresponding configuration files;

Different hardware has different configuration tools and corresponding configuration files. For example, the configuration file for the display and display card is/etc/X11/xorg. conf, for older Linux versions should be/etc/X11/X86Config or X86Config-4, the xorg or X86 configuration files also include the configuration and control of the mouse and keyboard in the X Desktop Environment;

The sound card configuration file is/etc/modprobe. conf or/etc/modules. conf;

The file system configuration file is/etc/fstab;

Sound Card Configuration tool, generally alsaconf

Of course, different releases also have corresponding hardware configuration or management tools. For example, Fedora Core 4.0 has the following hardware configuration or management tools;

[Root @ localhost beinan] # system-config-mouse
[Root @ localhost beinan] # system-config-network-tui
[Root @ localhost beinan] # gnome-system-monitor
[Root @ localhost beinan] # system-config-network
[Root @ localhost beinan] # system-config-printer-gui
[Root @ localhost beinan] # system-config-soundcard
[Root @ localhost beinan] # setup

Of course, these graphical tools are not omnipotent, and their functions still have great limitations. Therefore, most of the hardware configurations are operated in text mode;

4. The hardware driver is supported by the kernel, but where is the driver stored?

The hardware driver must be supported by the kernel, whether we install the driver ourselves or the driver that comes with the kernel. If the hardware driver is supported by the kernel module, the driver directory is located in/lib/modules/kernel version/kernel/directory or/lib/modules/kernel version/kernel/drivers directory;

[Root @ localhost beinan] # uname-r
2.6.11-1.1369 _ FC4
[Root @ localhost beinan] # ls/lib/modules/2.6.11-1.1369 _ FC4/kernel
Arch crypto drivers fs lib net sound

Note: The driver is only supported by the module method in the kernel, or the driver we have installed is located in the/lib/modules/directory. If the driver is directly placed in the kernel, it will not appear in the directory related to the/lib/modules driver;

5. What should I do if the hardware is not supported by the system?

If a Linux system does not support your hardware, there are two solutions: one is to download the driver and install it by yourself. Most of the Linux drivers are developed by the open-source community, the vendor provides a relatively small number of resources; sometimes it may also need to re-compile the kernel, mainly depending on what the internal description file of the driver says. Because the driver was originally supported by the kernel, compiling the kernel is also extremely normal;

It is worth noting that if we want to re-compile the kernel, we 'd better understand the hardware, such as the mouse, optical drive, soft drive, USB device, hard drive, file system ...... you must carefully check the information;

Postscript:

Linux's support for hardware is much better than in previous years, such as sound card, Nic, and display card (non-3D acceleration. If it is 3D acceleration, download the vendor driver, if the vendor does not provide the hardware, most of them cannot be developed because the vendor does not disclose hardware-related parameters, right ?); For some hardware, we still need to install the driver or compile the kernel;

The open-source community is very active in the development of hardware drivers for Linux, but vendors seldom provide non-Windows drivers. Most Linux drivers are contributed by the open-source community; some people may say that Windows Hardware drivers are the easiest, but I don't think so. I have a sound card for the ISA interface, which sounds strange in windows 98 and winme, there is no driver in windows 2000. But in Linux, it supports very well. Oh...

Linux is not what we originally said about hardware. The older the old the hardware, the better the job to run, and the support for new Linux devices may have just been released by the manufacturer, someone has studied the open-source community. The solution can also be found in the open-source community. However, some hardware vendors do not provide driver development parameters, information, and so on. Therefore, the open-source community is sometimes helpless with such hardware, however, the number of such devices seems to be relatively small. Most hardware supports Linux;

If you encounter hardware problems, you may wish to solve them through the clues I mentioned above. Currently, there are not many problems. As long as you take a closer look and learn how to search by Google, most problems can still be solved.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.