A Novel about my FreeBSD journey

Drivers on FreeBSD

By default, FreeBSD does not load all possible drivers; it must be instructed to load the drivers specific to our hardware.

For example, for a list of unloaded drivers, we can use the following command:

$: doas dmesg | grep "no driver attached"

pci12: <network> at device 0.0 (no driver attached)
pci0: <multimedia, HDA> at device 27.0 (no driver attached)
pci0: <seria bus, SMBus> at device 31.3 (no driver attached)
pci9: <base peripheral, SD host controller> at device 0.1 (no driver attached)
pci9: <mass storage> at device 0.2 (no driver attached)

What stands out here: an audio chip (multimedia HDA), a network card, the WLAN in my case (network), an SMBus chipset (serial bus, SMBus), and an SD card reader.

Loading the driver of the SD card reader

$: doas sysrc kld_list+="mmc mmcsd sdhci"

audio

The most common audio drivers have been enabled by default since 9.0. If it doesn't, we load a “meta” driver that loads all the audio drivers, and then we look at the one that is accepted:

$: doas kldload snd_driver
$: doas cat /dev/sndstat

FreeBSD Audio Driver (newpcm: 64bit 2007061600 / amd64)

Installed devices:
pcm0: <Intel 82801H High Definition Audio Controller> at memory 0xf6dfc000 irq 21 kld snd_hda [20080420_0052] [MPSAFE] (1p: 1v / 1r: 1v channels duplex default)

In this case, the snd_hda drivers match. This driver has been included as standard in the generic kernel since version 9.0, but for an older version, loading must be declared using the old method:

$: doas sysrc kld_list+="snd_hda"

Or, since 9.0, adding its name to the kld_list variable in the /etc/rc.conf file.

Bluetooth

To use the loudspeakers / Bluetooth headsets, these must be transferred via the virtual_oss package. We can install the whole thing with the following command:

$: doas pkg inst virtual_oss virtual_oss_ctl

SMBus

We load and check whether the driver loaded correctly:

$: doas kldload ichsmb

$: doas dmesg | grep smbus

smbus0: <System Management Bus> on ichsmb0

We add this module to the list of modules to be loaded automatically:

$: doas sysrc kld_list+="smbus"

ACPI-specific instructions

Very useful on laptops, there are ACPI modules that are manufacturer-specific. Here is the list of modules available on FreeBSD 11:

acpi_asus.ko => Asus laptop extras

acpi_dock.ko => Laptop docking station device driver

acpi_fujitsu.ko => Fujitsu laptop extras

acpi_hp.ko => ACPI extras driver for HP laptops

acpi_ibm.ko => ACPI extras driver for IBM laptops

acpi_panasonic.ko => ACPI hotkey driver for Panasonic laptops

acpi_sony.ko => ACPI notebook controller driver for Sony laptops

acpi_toshiba.ko => Toshiba HCI interface

acpi_video.ko => ACPI Video Extension's driver

acpi_wmi.ko => ACPI to WMI mapping driver (loaded by others if necessary)

To add the variable kldload based on our hardware. For example, for my IBM laptop, I use acpiibm.ko and acpi_video.ko.

Power saving mode

This saves the battery:

$: doas echo "hw.pci.do_power_nodriver=3" >> /etc/sysctl.conf

Discuss...