+ All Categories
Home > Documents > Linux Hardware Management

Linux Hardware Management

Date post: 10-Apr-2018
Category:
Upload: sergey-kryazhev
View: 221 times
Download: 0 times
Share this document with a friend

of 26

Transcript
  • 8/8/2019 Linux Hardware Management

    1/26

  • 8/8/2019 Linux Hardware Management

    2/26

    Agenda

    Traditional UNIX h/w support

    UDEV HAL What's next ???

  • 8/8/2019 Linux Hardware Management

    3/26

    Devices on UNIX

    UNIX isolates user and applications fromhardware.

    Under UNIX almost every hardware device treated

    as a file (Device file).

    Device file allows software to interact with devicedriver using standart system calls.

    /dev directory contains device files.

  • 8/8/2019 Linux Hardware Management

    4/26

    Devices on UNIX

    Device files: Character devices. Relate to devices throughwhich the system transmits data one characterat a time.

    /dev/ttyS0 Block devices. Relate to devices through which

    the system moves data in the form of blocks. /dev/sdao Pseudo devices. Do not have correspond

    physical devices. /dev/null

  • 8/8/2019 Linux Hardware Management

    5/26

    Devices on UNIX

    Each device file has major and minor numbers. Major number identifies the device driver.

    Minor number identifies a particular device.

    brw-r----- 1 root disk 8, 0 14 2008 hdabrw-r----- 1 root disk 8, 1 14 2008 hda1crw-rw---- 1 root uucp 4, 64 14 2008 ttyS0crw-rw---- 1 root uucp 4, 65 14 2008 ttyS1

  • 8/8/2019 Linux Hardware Management

    6/26

    Devices on UNIX

    How to create device file ?mknod filename [b] [c] major minor

    How to find major number ?/proc/devices- list of character and block devices

    sorted by major number

    Minor number ???Depends on particular driver.

  • 8/8/2019 Linux Hardware Management

    7/26

    Static /dev issues

    Two many device files

    Deficiency of the major and minor numbers

    Ambiguity

  • 8/8/2019 Linux Hardware Management

    8/26

    devfs

    devfs is a specific implementation of a devicefile system on Unix-like operating systems,used for presenting device files.

    Totally in kernel.

    Present on Linux till 2.6.15

  • 8/8/2019 Linux Hardware Management

    9/26

    UDEV

    udev - userspace device management

    udev provides a dynamic device directory containingonly the files for actually present devices.

    Runs as a daemon udevd

    udev creates device files according to naming rules./lib/udev/rules.d (/etc/udev/rules.d/)

  • 8/8/2019 Linux Hardware Management

    10/26

    UDEV

    Receives directly from the kernel using netlinkinterface.

    Uses sysfs (/sys directory) to get device attributes.

  • 8/8/2019 Linux Hardware Management

    11/26

    UDEV

    How to write naming rule file?

    There are two kind of keys, match and assignment keys.

    Examples:KERNEL=="sd[0-9]*",NAME="flash/%n"

    KERNEL=="sd[a-z]",PROGRAM="check_cd.sh %M %m",

    NAME="%c{1}", SYMLINK="cdrom"

    KERNEL=="lp*", SUBSYSTEMS=="usb",

    ATTRS{idVendor}=="03f0", ATTRS{product}=="hp

    LaserJet 1000", SYMLINK+="hplj1000-%n", RUN+="/

    usr/sbin/hplj1000"

  • 8/8/2019 Linux Hardware Management

    12/26

    D-Bus

    A message bus system (IPC)

    Language independent (C/C++, Python,

    Perl, etc)

    Simple way for applications to talk to one

    Provides a system and session bus

  • 8/8/2019 Linux Hardware Management

    13/26

    D-Bus

    Acts as a user-space daemon (bus).

    Bus types: system session

    Message types: Method calls Responces

    Signals

  • 8/8/2019 Linux Hardware Management

    14/26

    D-Bus

    Service(Application) are found by nameorg.gnome.Rhytmbox

    A service can export multiple objects/org/gnome/Rhytmbox

    Each object implements at least one interfaceorg.gnome.Rhythmbox.Player

    Interface provides methods

    next()

  • 8/8/2019 Linux Hardware Management

    15/26

    HAL

    Hardware Abstraction Layer for UNIX-likesystems.

    A library for enumerating the physical hardware in a

    system

    A toolkit for enumerating the physical and logicaldevices in a system

    A platform for discovering and configuring hardware

  • 8/8/2019 Linux Hardware Management

    16/26

    HAL

    HAL is a daemon responsible for discovering,enumerating and access to hardware on thecomputer.

    It aims to allow desktop applications to discover anduse the hardware of the host system through asimple, portable and abstract API

    Applications communicate with HAL through theD-Bus IPC mechanism.

  • 8/8/2019 Linux Hardware Management

    17/26

    HAL

    On a formal level, a device object is comprised by UDI

    This is an identifier, the Unique Device Identifer, that is uniquefor a device object , no other device object can have the same UDIat the same time. Properties

    Each device object got a set of properties which are key/valuepairs. The key is an ASCII string while the value.

    UDI = '/org/freedesktop/Hal/devices/disk1'|---block.device /dev/sda1

    |---block.is_volume 1|---info.capabilities volume,block|---volume.label WORK `|---volume.uuid 0717-AD77

  • 8/8/2019 Linux Hardware Management

    18/26

    HAL

  • 8/8/2019 Linux Hardware Management

    19/26

    HAL

    Device Information Files (.fdi files) - mechanismfor associating information with devices.

    How to use HAL ? DBUS

    libHal

  • 8/8/2019 Linux Hardware Management

    20/26

    HAL hardware management overview

  • 8/8/2019 Linux Hardware Management

    21/26

    HAL is in maintenance mode - no newfeatures are added.

    All future development focuses on Software/DeviceKit-disks Software/DeviceKit-power

    NetworkManager PulseAudio udev

    HAL Deprecation.

  • 8/8/2019 Linux Hardware Management

    22/26

    DeviceKit

    DeviceKit a better HAL

    Designed to deliver same features as HALProvide a D-Bus based APIParallel installable with HAL

    Another DBUS objectorg.freedesktop.DeviceKit

  • 8/8/2019 Linux Hardware Management

    23/26

    DeviceKit

  • 8/8/2019 Linux Hardware Management

    24/26

    Storage Subsystem Daemon

    DeviceKit-disks Consumes udev information Started on demand

    High-level API w/ progress reporting

    DeviceKit-disks

    Mount, Unmount, Eject, Poll, FsckPartitioning, Formatting, FS LabelATA SMART monitoring

    MD-RAID (Create, Start/Stop, Check, )Drive spindown

  • 8/8/2019 Linux Hardware Management

    25/26

    DeviceKit-disks

  • 8/8/2019 Linux Hardware Management

    26/26

    Comments ???


Recommended