root@0x5ha157:~/blog$ cat 101_hardware_settings.md

LPIC-1: Determine & Configure Hardware

Topic: 101.1 | Author: 0x5ha157 | Status: Study Notes

Before Linux can even boot, it needs to talk to the metal. This topic covers the firmware layer (BIOS/UEFI), how the kernel detects peripherals (PCI/USB), and the virtual filesystems used to query hardware info.

1. Firmware: BIOS vs UEFI

The firmware is the first software to run when you press the power button. It initializes hardware (POST) and hands control over to the bootloader.

Note: Linux handles IRQs and I/O addresses automatically now, but in the exam, you must know that these settings can be manually tweaked in the BIOS/UEFI if conflicts arise.

2. Exploring Hardware: /sys and /proc

Linux exposes hardware details through "virtual" filesystems. These files don't exist on the hard drive; they are generated in RAM by the kernel on the fly.

The /proc Directory

Legacy interface for kernel and process info.

The /sys Directory (sysfs)

Modern, structured view of devices. It organizes hardware by connection type (bus) rather than just a flat list.

3. The Detectives: lspci and lsusb

You rarely read /proc files manually. Instead, we use specific tools to parse that data.

# List PCI devices (Graphics, Network, RAID cards)
$ lspci
00:02.0 VGA compatible controller: Intel Corporation ...
00:14.0 USB controller: Intel Corporation ...

# Detailed view (Verbose)
$ lspci -v

# Show which Kernel Driver is handling the device
$ lspci -k
# List USB devices
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

# Tree view (Shows physical hierarchy)
$ lsusb -t

4. Kernel Modules (Drivers)

Windows has "drivers"; Linux has "Kernel Modules". These are pieces of code (ending in .ko) that can be loaded/unloaded into the kernel on demand to support hardware.

Key Commands:

Configuration: If you need to blacklist a module (stop it from loading) or set custom parameters, you edit files inside /etc/modprobe.d/.

5. Device Management (udev)

When you plug in a USB stick, how does it become /dev/sdb? That is the job of udev.

udev listens for kernel events (via D-Bus) and dynamically creates/removes files in the /dev directory. It follows rules stored in /etc/udev/rules.d/.