HAL (software)

This article is about a UNIX-like operating system subsystem. For the general concept and the Windows NT kernel HALs, see Hardware abstraction.

本文是关于一个类 UNIX 操作系统子系统的。有关一般概念和 Windows NT 内核 HAL,请参阅硬件抽象

This article needs to be updated. Please help update this article to reflect recent events or newly available information. (January 2022)

HAL
Stable release

0.5.14 / November 30, 2009; 12 years ago

Operating system LinuxFreeBSDNetBSDOpenSolarisSolaris
Platform UNIX
Type System software
License GNU General Public License and Academic Free License
Website freedesktop.org/wiki/Software/hal/

HAL (Hardware Abstraction Layer or rather Hardware Annotation Library) is a software subsystem for UNIX-like operating systems providing hardware abstraction.

HAL is now deprecated on most Linux distributions and on FreeBSD. Functionality is being merged into udev on Linux as of 2008–2010 and devd on FreeBSD.[citation needed] Previously, HAL was built on top of udev.[citation needed]

HAL硬件抽象层或更确切地说是硬件注释库)是一个软件子系统,用于提供硬件抽象的类 UNIX操作系统。

HAL 现在在大多数 Linux 发行版和 FreeBSD 上已弃用。从 2008 年到 2010 年,功能被合并到Linux 上的udev和 FreeBSD 上的 devd 中。[需要引用]以前,HAL 是建立在 udev 之上的。[需要引用]

Some other OS-es which don't have an alternative like udev or devd still use HAL.

The purpose of the hardware abstraction layer was to allow desktop applications to discover and use the hardware of the host system through a simple, portable and abstract API, regardless of the type of the underlying hardware.[1]

扫描二维码关注公众号,回复: 16127997 查看本文章

HAL for Linux OS was originally envisioned by Havoc Pennington. It became a freedesktop.org project, and was a key part of the software stack of the GNOME and KDE desktop environments. It is free software, dual-licensed under both the GNU General Public License and the Academic Free License.[2]

HAL is unrelated to the concept of Windows NT kernel HALs, which handle some platform-specific core functionality within the kernel, such as interrupt routing.

其他一些没有 udev 或 devd 等替代品的操作系统仍然使用 HAL。

硬件抽象层的目的是允许桌面应用程序通过简单、可移植抽象的API发现和使用主机系统的硬件,而不管底层硬件的类型。[1]

HAL for Linux OS 最初是由Havoc Pennington设想的。它成为了一个freedesktop.org项目,并且是GNOMEKDE 桌面环境软件堆栈的关键部分。它是自由软件,根据GNU 通用公共许可证学术自由许可证双重许可。[2]

HAL 与Windows NT内核 HAL的概念无关,后者在内核中处理一些特定于平台的核心功能,例如中断路由。

Contents

Rationale

Traditionally, the operating system kernel was responsible for providing an abstract interface to the hardware the system ran on. Applications used the system call interface, or performed file I/O on device nodes in order to communicate with hardware through these abstractions. This sufficed for the simple hardware of early desktop computing.

Computer hardware, however, has increased in complexity and the abstractions provided by Unix kernels have not kept pace with the proliferating number of device and peripheral types now common on both server and desktop computers. Most modern buses have also become hotplug-capable and can have non-trivial topologies. As a result, devices are discovered or change state in ways which can be difficult to track through the system call interface or Unix IPC. The complexity of doing so forces application authors to re-implement hardware support logic.[1]

Some devices also require privileged helper programs to prepare them for use. These must often be invoked in ways that can be awkward to express with the Unix permissions model (for example, allowing users to join wireless networks only if they are logged into the video console).[1] Application authors resort to using setuid binaries or run service daemons to provide their own access control and privilege separation, potentially introducing security holes each time.

基本原理

传统上,操作系统 内核负责为运行系统的硬件提供抽象接口。应用程序使用系统调用接口,或在设备节点上执行文件I/O,以便通过这些抽象与硬件进行通信。这对于早期桌面计算的简单硬件来说已经足够了。

然而,计算机硬件的复杂性增加了,Unix 内核提供的抽象跟不上现在在服务器和台式计算机上常见的设备和外围设备类型的数量激增。大多数现代总线也具有热插拔功能,并且可以具有非平凡的拓扑结构。结果,设备以难以通过系统调用接口或 Unix IPC 跟踪的方式被发现或更改状态。这样做的复杂性迫使应用程序作者重新实现硬件支持逻辑。[1]

一些设备还需要特权帮助程序来准备它们以供使用。这些通常必须以难以用 Unix 权限模型表达的方式调用(例如,仅当用户登录到视频控制台时才允许他们加入无线网络)。[1] 应用程序作者求助于使用setuid二进制文件或运行服务守护程序来提供自己的访问控制和权限分离,每次都可能引入安全漏洞。

Design

HAL is a single daemon responsible for discovering, enumerating and mediating access to most of the hardware on the host computer. Applications communicate with HAL through the D-Bus IPC mechanism, which abstracts the hardware behind an object-based RPC mechanism.

Each logical hardware device is represented as a D-Bus object, and its bus address is used as a unique identifier. Devices include abstractions like disk partitions and visible wireless networks. The device's functionality is exposed through D-Bus interfaces, and its state accessed through properties, a set of key-value pairs.

HAL broadcasts hardware events as signals on these objects; applications can listen for signals and react to the hardware events that they signify — events such as a digital camera being plugged in, an optical disc spinning up or a laptop computer closing its lid.[3][4]

设计

HAL 是一个单一的守护进程,负责发现、枚举和调解对主机上大多数硬件的访问。应用程序通过D-Bus IPC机制与 HAL 进行通信,该机制将硬件抽象为基于对象的 RPC机制。

每个逻辑硬件设备都表示为一个 D-Bus 对象,其总线地址用作唯一标识符。设备包括磁盘分区和可见无线网络等抽象。设备的功能通过 D-Bus接口公开,其状态通过属性访问,一组键值对。

HAL在这些对象上广播硬件事件作为信号;应用程序可以监听信号并对它们表示的硬件事件做出反应——例如插入数码相机光盘旋转或笔记本电脑合上盖子等事件。[3] [4]

Implementations and obsolescence

On Linux, HAL uses /sys (a virtual file system for Linux systems) to discover hardware and listen for kernel hotplug events. Some Linux distributions also provide a udev rule to allow the udev daemon to notify HAL whenever new device nodes appear.

实现和过时

在 Linux 上,HAL 使用/sysLinux系统的虚拟文件系统)来发现硬件并监听内核热插拔事件。一些 Linux 发行版还提供udev规则,以允许 udev 守护程序在出现新设备节点时通知 HAL。

Deprecated

As of 2011, Linux distributions such as Ubuntu,[5] Debian,[6] and Fedora and on FreeBSD,[7] and projects such as KDE,[8] GNOME and X.org are in the process of deprecating HAL as it has "become a large monolithic unmaintainable mess".[5] The process is largely complete, but some use of HAL remains – Debian squeeze (Feb 2011) and Ubuntu version 10.04 remove HAL from the basic system and boot process.[9] In Linux, it is in the process of being merged into udev (main udev, libudev, and udev-extras) and existing udev and kernel functionality. The replacement for non-Linux systems such as FreeBSD is devd.

Initially a new daemon DeviceKit was planned to replace certain aspects of HAL, but in March 2009, DeviceKit was deprecated in favor of adding the same code to udev as package udev-extras, and some functions have now moved to udev proper.

已弃用

截至 2011 年,Linux 发行版如Ubuntu[5] Debian[6]Fedora以及 FreeBSD、[7]以及 KDE、[8] GNOME 和X.org等项目都在弃用HAL,因为它已经“变成了一个庞大的、不可维护的大块”。[5]该过程已基本完成,但仍保留了一些 HAL 的使用——Debian 挤压(2011 年 2 月)和 Ubuntu 版本 10.04 从基本系统和引导过程中删除了 HAL。[9]在Linux中,正在合并到udev中(主要的 udev、libudev 和 udev-extras)以及现有的 udev 和内核功能。非 Linux 系统(如 FreeBSD)的替代品是 devd。

最初计划一个新的守护进程DeviceKit来替换 HAL 的某些方面,但在 2009 年 3 月,DeviceKit 被弃用,取而代之的是向 udev 添加与软件包udev-extras相同的代码,并且一些功能现在已移至udev本身。

See also

References

  1. Jump up to:a b c Pennington, Havoc (2003-07-10), Making Hardware Just Work
  2. ^ HAL source code license text, HAL is licensed to you under your choice of the Academic Free License version 2.1, or the GNU General Public License version 2
  3. ^ Zeuthen, David (2009-11-01), HAL 0.5.14 Specificationfreedesktop.org, retrieved 2017-01-15
  4. ^ "hal: doc/spec". 2010-03-16. Retrieved 2017-01-15.
  5. Jump up to:a b Halsectomyubuntu.com, 2013-05-10, retrieved 2017-01-15
  6. ^ "HALRemoval"debian.org. 2011-06-28. Retrieved 2017-01-15.
  7. ^ "Features/HalRemoval"Fedora Project. 2012-01-09. Retrieved 2017-01-15.
  8. ^ "Revision 1206281: Features in KDE Base"KDE. 2010-12-19. Retrieved 2017-01-15.
  9. ^ "TechnicalOverview: HAL removal". ubuntu.com. 2010-05-17. Retrieved 2017-01-15.

参考文献

  1. ^跳转至:a c Pennington, Havoc (2003-07-10),使硬件正常工作
  2. HAL 源代码许可文本,根据您选择的 Academic Free License 版本 2.1 或 GNU General Public License 版本 2,HAL 被许可给您
  3. ^ Zeuthen, David (2009-11-01), HAL 0.5.14 Specification , freedesktop.org , 2017-01-15检索
  4. "hal: 文档/规范" . 2010 年 3 月 16 日。检索2017-01-15。
  5. ^跳转至:a b Halsectomy ,ubuntu.com, 2013-05-10, 检索2017-01-15
  6. “HAL去除” . debian.org。2011-06-28 。检索2017-01-15。
  7. “特点/HalRemoval”Fedora 项目。2012-01-09 。检索2017-01-15。
  8. “修订版 1206281:KDE Base 中的功能”凯德。2010 年 12 月 19 日。检索2017-01-15。
  9. “技术概述:HAL 移除”。ubuntu.com。2010-05-17 . 检索2017-01-15。

External links

外部链接

摘自:

https://en.wikipedia.org/wiki/HAL_(software)

猜你喜欢

转载自blog.csdn.net/asdcls/article/details/127667320
HAL