Difference between revisions of "Hwdetect"

From ArchWiki
Jump to: navigation, search
(Tips and tricks: add shebang, clean up whitespace)
(Tips and tricks: add header)
Line 31: Line 31:
  
 
== Tips and tricks ==
 
== Tips and tricks ==
 +
 +
=== Unused modules ===
 +
 
To generated a list of modules currently not used, use the following script:
 
To generated a list of modules currently not used, use the following script:
  

Revision as of 23:52, 23 July 2016

hwdetect is a hardware detection script primarily used to load or list modules for use in mkinitcpio.conf. The script makes use of information exported by the sysfs subsystem employed by the Linux kernel.

Installation

Install the hwdetect package.

Usage

See the hwdetect source, or run hwdetect --help.

Examples

You can use the following method to to populate MODULES in mkinitcpio.conf.

# hwdetect --show-modules

The command should have similar output to the following (system-dependant):

SOUND    : pcspkr
OTHER    : 8139cp 8139too ac

Depending on what is used, copy the module names to replace the MODULES section in /etc/mkinitcpio.conf. The system should now boot faster, as some, or all, of the hardware detection and modules dependencies calculations is already stated.

Note:
  • The tool has dedicated output for usage within /etc/mkinitcpio.conf.
  • If any of the module names change because newer kernels have newer modules, or you install new hardware on your computer, you will need to generate the list of modules again and update MODULES.

Tips and tricks

Unused modules

To generated a list of modules currently not used, use the following script:

#!/bin/bash
for m in $(hwdetect --show-modules | cut -d ':' -f 2); do
    if ! grep -sq $(echo $m|tr - _) <(lsmod); then
        echo $m;
    fi
done