欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Linux kernel的Makefile和Kconfig
背景知識:
背景知識一:Kconfig介紹:

#make menuconfig 時(shí),所顯示的Menu list是由各層Kconfig組成的。
最底層Kconfig存放在 ~/arch/i386/Kconfig. 以此為頭,它會(huì )一層層使用source來(lái)把需要加入的各個(gè)目錄中Keconfig添加近來(lái)。
例如:source "drivers/Kconfig"
則將~/drivers/Kconfig添加進(jìn)Menu list中。

背景知識二:Kconfig寫(xiě)法語(yǔ)義:
config HID
tristate "Generic HID support"
depends on INPUT
default y
---help---
A human interface device (HID) is a type of computer device that interacts directly with and takes input from humans. The term "HID" most commonly used to refer to the USB-HID specification, but other devices (such as, but not strictly limited to, Bluetooth) are designed using HID specification (this involves certain keyboards, mice, tablets, etc). This option compiles into kernel the generic HID layer code (parser, usages, etc.), which can then be used by transport-specific HID implementation (like USB or Bluetooth).
For docs and specs, see http://www.usb.org/developers/hidpage/
If unsure, say Y

解釋如下:
config HID :表示此條目與CONFIG-HID對應。CONFIG-HID會(huì )在Makefile中用到。

tristate "Generic HID support" 引號內的內容是會(huì )顯示到Menu list中的。tristate表示這一項是三態(tài)的。

depends on INPUT:依賴(lài)于INPUT這一項。如果沒(méi)有選中INPUT,則Menu list不會(huì )顯示這項。 kernel32.dll vc


default y :缺省被選中。



背景知識三:built-in.o
vmlinux是Linux源碼編譯后未壓縮的內核, vmlinux是由arch/i386/kernel/head.o和arch/i386/kernel/init_task.o以及各個(gè)相關(guān)子目錄下的built-in.o鏈接而成的。


背景知識四:Kernel Makefile
Kernel中Makefile的體系以及如何編譯的,其實(shí)Sam一直是一知半解的。
其中,kernel目錄中的Makefile被稱(chēng)為底層Makefile。
當使用類(lèi)似#make menuconfig配置內核成功后,會(huì )生成 .config文件。
換句話(huà)說(shuō):make menuconfig 時(shí),Makefile會(huì )從~/arch/i386/Kconfig讀取Kconfig.然后根據用戶(hù)的選擇。生成.config文件。
例如:在drivers/hid/Kconfig:
config HID
tristate "Generic HID support"
如果用戶(hù)選中Y,則在.config中會(huì )反映出來(lái):
CONFIG_HID=y
則在~/drivers/Makefile中可以看到:
obj-$(CONFIG_HID) += hid/
表明:如果CONFIG_HID是Y,則把hid目錄添加到要編譯的目錄中了。
進(jìn)入到/driver/hid目錄,則看到:
hid-objs := hid-core.o hid-input.o
表明這兩個(gè).o文件是一定會(huì )被編譯出的。
obj-$(CONFIG_HID) += hid.o
表明:如果CONFIG_HID是Y,則hid.o會(huì )被編譯出來(lái)。并built-in.
如果是 =m. 則hid.o被編譯出來(lái),但最后被做成modules(ko)


背景知識五:KBuild Make:
Linux內核的Makefile與我們平時(shí)寫(xiě)的Makefile有所不同,它由五部分組成:
1.Makefile : 頂層Makefile。
2. .config: kernel配置文件。
3. arch/xxx/Makefile: 具體架構的Makefile。
4. scripts/Makefile.xxx : 通用規則。
5. kbuild Makefile: 整個(gè)kernel中大約有數百個(gè)這種文件。

#make menuconfig后,生成 kernel配置文件: .config。
頂層Makefile讀取.config.
頂層Makefile通過(guò)解析 .config來(lái)決定遞歸訪(fǎng)問(wèn)哪些目錄中的Kbuild Makefile .
這個(gè)過(guò)程中,Kbuild Makefile會(huì )按.config的設置,逐個(gè)添加文件列表,以供最后的編譯使用。
最簡(jiǎn)單的KBuild Makefile如下:
obj-y += foo.o
表明:Kbuild在這目錄里,有一個(gè)名為foo.o的目標文件。foo.o將從foo.c或foo.S文件編譯得到。并且它會(huì )被包入built-in中去。
所有編譯進(jìn)內核的目標文件都存在$(obj-y)列表中。而這些列表依賴(lài)內核的配置。Kbuild編譯所有的$(obj-y)文件。然后,調用"$(LD) -r"將它們合并到一個(gè)build-in.o文件中。稍后,該build-in.o會(huì )被其父Makefile聯(lián)接進(jìn)vmlinux中。

如果foo.o要編譯成一模塊,那就要用obj-m了。所采用的形式如下:
obj-m += foo.o



例一:
在 ~/driver/hid/hid-core.c中,有以下語(yǔ)句,即內核insmod接口hid_init.
module_init(hid_init);
也就是說(shuō),當此模塊被buildin或者作為module insmod時(shí),kernel會(huì )自動(dòng)調用hid_init.
然后查看 ~/driver/hid/Makefile,發(fā)現
hid-objs := hid-core.o hid-input.o
表明只要hid這個(gè)目錄被加入,就會(huì )生成hid-core.o.
只好去看上一層目錄中怎樣會(huì )進(jìn)入hid目錄:
obj-$(CONFIG_HID) += hid/
表明只要CONFIG_HID=Y,m. 則hid目錄被加入。
但用戶(hù)作了什么,hid目錄被加入編譯呢?則看~/drivers/hid/Kconfig
config HID
tristate "Generic HID support"
以此得之只要在make menuconfig中選中此項,則hid-core.o被編譯出來(lái)。


例2:
Sam想要研究USB Keyboard & Mouse driver. 在 make menuconfig時(shí),需要選中:
config USB_HID
tristate "USB Human Interface Device (full HID) support"
則查看Makefile。發(fā)現只要選中CONFIG_USB_HID.則會(huì )編譯出usb_hid.o
但~/drivers/hid/usbhid目錄中卻沒(méi)有usbhid.c。那usbhid.o如何生成的呢?
drivers/hid/usbhid目錄中,有個(gè).usbhid.o.cmd文件。
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Linux Kbuild文檔
Linux內核中的Kconfig、Makefile、.config
Linux內核模塊的編譯基礎知識
U-Boot 之四 構建過(guò)程(Kconfig 配置 + Kbuild 編譯)詳解
也談Linux Kernel Hacking – Kconfig與Kbuild | Tony Bai
Kconfig文件的作用 轉載自我的太陽(yáng) - 一些知識 - 革命的阿Q的奮斗歷程
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久