6.47. Hotplug-2004_09_23

The Hotplug package contains scripts that react upon hotplug events generated by the kernel. Such events correspond to every change in the kernel state visible in the sysfs filesystem, e.g., the addition and removal of hardware. This package also detects existing hardware during boot and inserts the relevant modules into the running kernel.

Approximate build time: 0.01 SBU
Required disk space: 460 KB
Installation depends on: Bash, Coreutils, Find, Gawk, and Make

6.47.1. Installation of Hotplug

Install the Hotplug package:

make install

Copy a file that the “install” target omits.

cp etc/hotplug/pnp.distmap /etc/hotplug

Remove the init script that Hotplug installs since we are going to be using the script included in the LFS-Bootscripts package:

rm -rf /etc/init.d

Network device hotplugging is not yet supported by the LFS-Bootscripts package. For that reason, remove the network hotplug agent:

rm -f /etc/hotplug/net.agent

Create a directory for storing firmware that can be loaded by hotplug:

mkdir /lib/firmware

6.47.2. Contents of Hotplug

Installed program: hotplug
Installed scripts: /etc/hotplug/*.rc, /etc/hotplug/*.agent
Installed files: /etc/hotplug/hotplug.functions, /etc/hotplug/blacklist, /etc/hotplug/{pci,usb}, /etc/hotplug/usb.usermap, /etc/hotplug.d, and /var/log/hotplug/events

Short Descriptions

hotplug

This script is called by default by the Linux kernel when something changes in its internal state (e.g., a new device is added or an existing device is removed)

/etc/hotplug/*.rc

These scripts are used for cold plugging, i.e., detecting and acting upon hardware already present during system startup. They are called by the hotplug initscript included in the LFS-Bootscripts package. The *.rc scripts try to recover hotplug events that were lost during system boot because, for example, the root filesystem was not mounted by the kernel

/etc/hotplug/*.agent

These scripts are called by hotplug in response to different types of hotplug events generated by the kernel. Their action is to insert corresponding kernel modules and call any user-provided scripts

/etc/hotplug/blacklist

This file contains the list of modules that should never be inserted into the kernel by the Hotplug scripts

/etc/hotplug/hotplug.functions

This file contains common functions used by other scripts in the Hotplug package

/etc/hotplug/{pci,usb}

These directories contain user-written handlers for hotplug events

/etc/hotplug/usb.usermap

This file contains rules that determine which user-defined handlers to call for each USB device, based on its vendor ID and other attributes

/etc/hotplug.d

This directory contains programs (or symlinks to them) that are interested in receiving hotplug events. For example, Udev puts its symlink here during installation

/lib/firmware

This directory contains the firmware for devices that need to have their firmware loaded before use

/var/log/hotplug/events

This file contains all the events that hotplug has called since bootup