Read LPI Linux Certification in a Nutshell Online

Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger

Tags: #Reference:Computers

LPI Linux Certification in a Nutshell (4 page)

Device Management Definitions

Hotplugging is often taken to mean the opposite of
coldplugging—in other words, the ability of a computer
system to add or remove hardware without powering the system down.
Examples of devices that are coldpluggable include PCI (some PCI
chipsets have hotplug support, but these are very expensive and almost
exclusively used in server systems), ISA devices, and PATA
devices.

In most computer systems, CPUs and memory are coldpluggable, but
it is common for high-end servers and mainframes to feature hotplug
capability of these
components
.

sysfs
is a RAM-based
filesystem initially based on
ramfs. It provides a means to export kernel data
structures, their attributes, and the linkages between them to the user
space.
sysfs
contains several
directory hierarchies showing the available hardware devices and
attributes of the modules/drivers. It can be accessed by running:

#
mount -t sysfs sysfs /sys

The udev process uses
sysfs
to
get the information it needs about the hardware and creates dynamic
device files as kernel modules are loaded. The directory
/etc/udev.d
holds all the rules to be applied
when adding or removing a device.

D-Bus is an application that uses
sysfs
to implement a message bus daemon. It is
used for broadcasting system events such as “new hardware device added”
or “printer queue changed” and is normally launched by an init script
called
messagebus
.

The hald process is the daemon that maintains a database of the
devices connected to the system in real time. The daemon connects to the
D-Bus system message bus to provide an API that applications can use to
discover, monitor, and invoke operations on devices.

Name

lsmod

Syntax
lsmod [
options
]
Description

The
lsmod
command displays all
the information available about currently loaded modules. Reviewing
your loaded modules is often the first step in identifying possible
problems, such as driver conflicts (quite frequently found with USB
device drivers). This information can also be found in
/proc/modules
.
lsmod
has
only two options, neither of them affecting its operation.

Options
-h, --help

Display help information.

-V, --version

Display the version.

The output of
lsmod
is a series of
columns identifying the module name, its size, its use number, and
its status. A sample of
lsmod
output looks like
this:

Module                  Size  Used by    Not tainted
vfat 12844 0 (autoclean)
fat 38328 0 (autoclean) [vfat]
nfs 79960 0 (autoclean)
ide-scsi 11984 0 (autoclean)
ide-cd 35196 0 (autoclean)
cdrom 33440 0 (autoclean) [ide-cd]
tuner 11680 1 (autoclean)
tvaudio 14940 0 (autoclean) (unused)
bttv 73568 0 (autoclean)
videodev 8192 2 (autoclean) [bttv]
radeon 114244 28
agpgart 46752 3
parport_pc 18756 1 (autoclean)
lp 8868 0 (autoclean)
parport 36480 1 (autoclean) [parport_pc lp]
Name

lsdev

Syntax
lsdev
Description

The
lsdev
command displays
information about your system’s hardware, such as interrupt
addresses and I/O ports. The command is useful for obtaining
information prior to installing devices that may have hardware
addressing conflicts, such as ISA devices. This command uses DMA
files in
/proc
to also report I/O addresses and
IRQ and DMA channel information. There are no options for
lsdev
.

The output of
lsdev
is very simple,
similar to
lsmod
. It lists information in four
columns: device name, DMA address, IRQ address, and I/O ports. The
following is some sample output from
lsdev
:

Device            DMA   IRQ  I/O Ports
------------------------------------------------
ATI c800-c8ff
bttv 10
Creative e800-e81f ec00-ec07
dma 0080-008f
dma1 0000-001f
dma2 00c0-00df
e100 e000-e03f
EMU10K1 11 e800-e81f
fpu 00f0-00ff
ide0 14 01f0-01f7 03f6-03f6 fc00-fc07
ide1 15 0170-0177 0376-0376 fc08-fc0f
Intel e000-e03f
keyboard 1 0060-006f
ohci1394 12
PCI 0cf8-0cff c000-cfff
Name

lspci

Syntax
lspci [
options
]
Description

The
lspci
command displays
information about your system’s PCI buses and your installed PCI
devices. This information is found primarily within
/proc
.

Options
-t

Show a treelike diagram containing all buses, bridges,
devices, and connections between them.

-vv

Very verbose mode.

Name

lsmod

Syntax
lsmod
Description

For each kernel module loaded, display its name, size,
use count, and a list of other referring modules. This command
yields the same information as is available in
/proc/modules
.

Example

Here,
lsmod
shows that quite a few kernel
modules are loaded, including filesystem (
vfat,
fat
), networking (
3c59x
), and sound
(
soundcore, mpu401
, etc.) modules, among
others:

#
lsmod
Module Size Used by
radeon 112996 24
agpgart 45824 3
parport_pc 18756 1 (autoclean)
lp 8868 0 (autoclean)
parport 36480 1 (autoclean) [parport_pc lp]
e100 59428 1
ohci1394 19976 0 (unused)
ieee1394 48300 0 [ohci1394]
scsi_mod 106168 0
evdev 5696 0 (unused)
printer 8832 0
wacom 7896 0 (unused)
emu10k1 68104 1
ac97_codec 13512 0 [emu10k1]
sound 73044 0 [emu10k1]
soundcore 6276 7 [emu10k1 sound]
keybdev 2912 0 (unused)
mousedev 5428 1
hid 21700 0 (unused)
input 5824 0 [evdev wacom keybdev mousedev hid]
ehci-hcd 19432 0 (unused)
usb-uhci 25964 0 (unused)
usbcore 77760 1 [printer wacom hid ehci-hcd usb-uhci]
ext3 87240 3
jbd 51156 3 [ext3]
Name

insmod

Syntax
insmod [
options
]
module
Description

Insert a module into the running kernel. The module is
located automatically and inserted. You must be logged in as the
superuser to insert modules.

Frequently used options
-s

Direct output to syslog instead of
stdout
.

-v

Set verbose mode.

Example

The
msdos
filesystem module is
installed into the running kernel. In this example, the kernel was
compiled with modular support for the
msdos
filesystem type, a typical configuration for a Linux distribution
for i386 hardware. To verify that you have this module, check for
the existence of
/lib/modules/
kernel-version
/fs/msdos.o
:

#
insmod msdos
/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol \
fat_add_cluster_Rsmp_eb84f594
/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol \
fat_cache_inval_inode_Rsmp_6da1654e
/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol \
fat_scan_Rsmp_d61c58c7
( ... additional errors omitted ... )
/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol \
fat_date_unix2dos_Rsmp_83fb36a1
#
echo $?

This
insmod msdos
command yields a series
of unresolved symbol messages and an exit status of 1, indicating an
error. This is the same sort of message that might be seen when
attempting to link a program that referenced variables or functions
unavailable to the linker. In the context of a module insertion,
such messages indicate that the functions are not available in the
kernel. From the names of the missing symbols, you can see that the
fat
module is required to support the
msdos
module, so it is inserted first:

#
insmod fat

Now the
msdos
module can be
loaded:

#
insmod msdos

Use the
modprobe
command to automatically
determine these dependencies and install prerequisite modules
first.

Name

rmmod

Syntax
rmmod [
options
]
modules
Description

The
rmmod
command is used to
remove modules from the running kernel. You must be logged in as the
superuser to remove modules, and the command will fail if the module
is in use or being referred to by another module.

Frequently used options
-a

Remove all unused modules.

-s

Direct output to syslog instead of
stdout
.

Example

Starting with both the
fat
and
msdos
modules loaded, remove the
fat
module (which is used by the
msdos
module):

#
lsmod
Module Size Used by
msdos 8348 0 (unused)
fat 25856 0 [msdos]
#
rmmod fat
rmmod: fat is in use

In this example, the
lsmod
command fails
because the
msdos
module is dependent on the
fat
module. So, to unload the
fat
module, the
msdos
module must be unloaded first:

#
rmmod msdos
#
rmmod fat

The
modprobe -r
command can be used to
automatically determine these dependencies and remove modules and
their prerequisites.

Name

modinfo

Syntax
modinfo [
options
]
module_object_file
Description

Display information about a module from its
module_object_file
. Some modules contain
no information at all, some have a short one-line description, and
others have a fairly descriptive message.

Options
-a

Display the module’s author.

-d

Display the module’s description.

-p

Display the typed parameters that a module
supports.

Examples

In these examples,
modinfo
is run using
modules compiled for a multiprocessing (SMP) kernel Version 2.2.5.
Your kernel version, and thus the directory hierarchy containing
modules, will be different.

#
modinfo -d /lib/modules/2.2.5-15smp/misc/zftape.o
zftape for ftape v3.04d 25/11/97 - VFS interface for the
Linux floppy tape driver. Support for QIC-113
compatible volume table and builtin compression
(lzrw3 algorithm)
#
modinfo -a /lib/modules/2.2.5-15smp/misc/zftape.o
(c) 1996, 1997 Claus-Justus Heine
([email protected])
#
modinfo -p /lib/modules/2.2.5-15smp/misc/ftape.o
ft_fdc_base int, description "Base address of FDC
controller."
Ft_fdc_irq int, description "IRQ (interrupt channel)
to use."
ft_fdc_dma int, description "DMA channel to use."
ft_fdc_threshold int, description "Threshold of the FDC
Fifo."
Ft_fdc_rate_limit int, description "Maximal data rate
for FDC."
ft_probe_fc10 int, description "If non-zero, probe for a
Colorado FC-10/FC-20 controller."
ft_mach2 int, description "If non-zero, probe for a
Mountain MACH-2 controller."
ft_tracing int, description "Amount of debugging output,
0 <= tracing <= 8, default 3."

Other books

Relentless by Anna Wells
The Barefoot Princess by Christina Dodd
Ashlyn's Radio by Heather Doherty, Norah Wilson
The Rogue Hunter by Lynsay Sands
Trick or Treat by Richie Tankersley Cusick
Love Lies Bleeding by Remmy Duchene
Gansett After Dark by Marie Force
The Smuggler's Captive Bride by Dodd, Christina
Blackmail Earth by Bill Evans


readsbookonline.com Copyright 2016 - 2024