Difference between revisions of "Hwdetect"

From ArchWiki
Jump to: navigation, search
(Example: {ic|/etc/mkinitcpio.conf}} -> mkinitcpio.conf)
(remove rc.conf mentions, style, avoid redundancy)
Line 2: Line 2:
 
[[ja:Hwdetect]]
 
[[ja:Hwdetect]]
 
[[tr:hwdetect]]
 
[[tr:hwdetect]]
[https://projects.archlinux.org/svntogit/packages.git/tree/hwdetect/trunk/hwdetect hwdetect] is a hardware detection script primarily used to load or list modules for use in [[rc.conf]] or [[mkinitcpio.conf]]. The script makes use of information exported by the [[Wikipedia:Sysfs|sysfs]] subsystem employed by the Linux kernel.
+
[https://projects.archlinux.org/svntogit/packages.git/tree/hwdetect/trunk/hwdetect 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 [[Wikipedia:Sysfs|sysfs]] subsystem employed by the Linux kernel.
  
 
== Installation ==
 
== Installation ==
  
The {{Pkg|hwdetect}} package is available from the [[official repositories]].
+
Install the {{Pkg|hwdetect}} package.
  
==Usage==
+
== Usage ==
  
The latest usage information can be found [https://projects.archlinux.org/svntogit/packages.git/tree/hwdetect/trunk/hwdetect here] or by running {{ic|hwdetect --help}}.
+
See the [https://projects.archlinux.org/svntogit/packages.git/tree/hwdetect/trunk/hwdetect hwdetect source], or run {{ic|hwdetect --help}}.
 +
 
 +
=== Examples ===
 +
 
 +
You can use the following method to to populate {{Ic|MODULES}} in [[mkinitcpio.conf]].
  
== Example ==
 
You can use the following method to disable {{Ic|MOD_AUTOLOAD}} in [[rc.conf]], or to populate {{Ic|MODULES}} in [[mkinitcpio.conf]]. This should improve boot times, as time will not be spent discovering modules.
 
 
  # hwdetect --show-modules
 
  # hwdetect --show-modules
  
The command should output something similar to the following (of course, output depends on the system):
+
The command should have similar output to the following (system-dependant):
 +
 
 
  SOUND    : pcspkr
 
  SOUND    : pcspkr
 
  OTHER    : 8139cp 8139too ac
 
  OTHER    : 8139cp 8139too ac
  
Depending on what is used, copy the module names to replace the {{ic|MODULES}} section in {{ic|/etc/rc.conf}}, or in {{ic|/etc/mkinitcpio.conf}}. For {{ic|/etc/rc.conf}}, also change {{Ic|MOD_AUTOLOAD}} from "yes" to "no". The system should now boot faster, as some, or all, of the hardware detection and modules dependencies calculations is already stated.
+
Depending on what is used, copy the module names to replace the {{ic|MODULES}} section in {{ic|/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 {{ic|/etc/mkinitcpio.conf}}.}}
+
{{Note|
 +
* The tool has dedicated output for usage within {{ic|/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 {{ic|MODULES}}.}}
  
{{Note|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 {{ic|MODULES}}.}}
+
== Tips and tricks ==
  
== Tips ==
 
 
To generated a list of modules currently not used, run:
 
To generated a list of modules currently not used, run:
 +
 
  # hwdetect --modules-not-loaded
 
  # hwdetect --modules-not-loaded
  
 
or use the following script:
 
or use the following script:
 +
 
{{hc|modules-not-loaded|<nowiki>
 
{{hc|modules-not-loaded|<nowiki>
 
eval $(hwdetect --modules)
 
eval $(hwdetect --modules)

Revision as of 20:32, 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

    To generated a list of modules currently not used, run:

    # hwdetect --modules-not-loaded
    

    or use the following script:

    modules-not-loaded
    eval $(hwdetect --modules)
    for m in ${MODULES[*]}; do
        if ! grep -sq $(echo $m|tr - _) <(lsmod); then
            echo $m;
        fi
    done