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.
本文是關(guān)于一個類 UNIX 操作系統(tǒng)子系統(tǒng)的。有關(guān)一般概念和 Windows NT 內(nèi)核 HAL,請參閱硬件抽象。
| This article needs to be?updated.?Please help update this article to reflect recent events or newly available information.?(January 2022) |
| 0.5.14?/ November?30, 2009; 12 years ago |
| Linux,?FreeBSD,?NetBSD,?OpenSolaris,?Solaris |
| UNIX |
| System software |
| GNU General Public License?and?Academic Free License |
| 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(硬件抽象層或更確切地說是硬件注釋庫)是一個軟件子系統(tǒng),用于提供硬件抽象的類 UNIX操作系統(tǒng)。
HAL 現(xiàn)在在大多數(shù) Linux 發(fā)行版和 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]
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 等替代品的操作系統(tǒng)仍然使用 HAL。
硬件抽象層的目的是允許桌面應(yīng)用程序通過簡單、可移植和抽象的API發(fā)現(xiàn)和使用主機(jī)系統(tǒng)的硬件,而不管底層硬件的類型。[1]
HAL for Linux OS 最初是由Havoc Pennington設(shè)想的。它成為了一個freedesktop.org項目,并且是GNOME和KDE?桌面環(huán)境軟件堆棧的關(guān)鍵部分。它是自由軟件,根據(jù)GNU 通用公共許可證和學(xué)術(shù)自由許可證雙重許可。[2]
HAL 與Windows NT內(nèi)核 HAL的概念無關(guān),后者在內(nèi)核中處理一些特定于平臺的核心功能,例如中斷路由。
Contents
- 1Rationale
- 2Design
- 3Implementations and obsolescence
- 3.1Deprecated
- 4See also
- 5References
- 6External links
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.
基本原理
傳統(tǒng)上,操作系統(tǒng)?內(nèi)核負(fù)責(zé)為運行系統(tǒng)的硬件提供抽象接口。應(yīng)用程序使用系統(tǒng)調(diào)用接口,或在設(shè)備節(jié)點上執(zhí)行文件I/O,以便通過這些抽象與硬件進(jìn)行通信。這對于早期桌面計算的簡單硬件來說已經(jīng)足夠了。
然而,計算機(jī)硬件的復(fù)雜性增加了,Unix 內(nèi)核提供的抽象跟不上現(xiàn)在在服務(wù)器和臺式計算機(jī)上常見的設(shè)備和外圍設(shè)備類型的數(shù)量激增。大多數(shù)現(xiàn)代總線也具有熱插拔功能,并且可以具有非平凡的拓?fù)浣Y(jié)構(gòu)。結(jié)果,設(shè)備以難以通過系統(tǒng)調(diào)用接口或 Unix IPC 跟蹤的方式被發(fā)現(xiàn)或更改狀態(tài)。這樣做的復(fù)雜性迫使應(yīng)用程序作者重新實現(xiàn)硬件支持邏輯。[1]
一些設(shè)備還需要特權(quán)幫助程序來準(zhǔn)備它們以供使用。這些通常必須以難以用 Unix 權(quán)限模型表達(dá)的方式調(diào)用(例如,僅當(dāng)用戶登錄到視頻控制臺時才允許他們加入無線網(wǎng)絡(luò))。[1]?應(yīng)用程序作者求助于使用setuid二進(jìn)制文件或運行服務(wù)守護(hù)程序來提供自己的訪問控制和權(quán)限分離,每次都可能引入安全漏洞。
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]
設(shè)計
HAL 是一個單一的守護(hù)進(jìn)程,負(fù)責(zé)發(fā)現(xiàn)、枚舉和調(diào)解對主機(jī)上大多數(shù)硬件的訪問。應(yīng)用程序通過D-Bus?IPC機(jī)制與 HAL 進(jìn)行通信,該機(jī)制將硬件抽象為基于對象的?RPC機(jī)制。
每個邏輯硬件設(shè)備都表示為一個 D-Bus 對象,其總線地址用作唯一標(biāo)識符。設(shè)備包括磁盤分區(qū)和可見無線網(wǎng)絡(luò)等抽象。設(shè)備的功能通過 D-Bus接口公開,其狀態(tài)通過屬性訪問,一組鍵值對。
HAL在這些對象上廣播硬件事件作為信號;應(yīng)用程序可以監(jiān)聽信號并對它們表示的硬件事件做出反應(yīng)——例如插入數(shù)碼相機(jī)、光盤旋轉(zhuǎn)或筆記本電腦合上蓋子等事件。[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.
實現(xiàn)和過時
在 Linux 上,HAL 使用/sys(Linux系統(tǒng)的虛擬文件系統(tǒng))來發(fā)現(xiàn)硬件并監(jiān)聽內(nèi)核熱插拔事件。一些 Linux 發(fā)行版還提供udev規(guī)則,以允許 udev 守護(hù)程序在出現(xiàn)新設(shè)備節(jié)點時通知 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 發(fā)行版如Ubuntu、[5]?Debian、[6]和Fedora以及 FreeBSD、[7]以及 KDE、[8]?GNOME 和X.org等項目都在棄用HAL,因為它已經(jīng)“變成了一個龐大的、不可維護(hù)的大塊”。[5]該過程已基本完成,但仍保留了一些 HAL 的使用——Debian 擠壓(2011 年 2 月)和 Ubuntu 版本 10.04 從基本系統(tǒng)和引導(dǎo)過程中刪除了 HAL。[9]在Linux中,正在合并到udev中(主要的 udev、libudev 和 udev-extras)以及現(xiàn)有的 udev 和內(nèi)核功能。非 Linux 系統(tǒng)(如 FreeBSD)的替代品是 devd。
最初計劃一個新的守護(hù)進(jìn)程DeviceKit來替換 HAL 的某些方面,但在 2009 年 3 月,DeviceKit 被棄用,取而代之的是向 udev 添加與軟件包udev-extras相同的代碼,并且一些功能現(xiàn)在已移至udev本身。
See also
- devfsd
- eudev
- udev
- UPower
- Free and open-source software portal
References
參考文獻(xiàn)
External links
- HAL - Hardware Abstraction Layer
外部鏈接
- HAL - 硬件抽象層
摘自:
https://en.wikipedia.org/wiki/HAL_(software)
總結(jié)
以上是生活随笔為你收集整理的HAL (software)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [HITML]哈工大2020秋机器学习期
- 下一篇: 冬虫夏草的个人简历