免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
【z】make config解惑
make config解惑
2010-05-15 21:03

一直對(duì)Linux內(nèi)核編譯的配置問題的理解模棱兩可的,網(wǎng)上的說法也眾說紛紜,尤其是配置工具的使用問題,大家的理解完全就不一致。找了幾個(gè)比較官方的網(wǎng)站,總結(jié)了一下比較權(quán)威的解釋。

Linux內(nèi)核的配置系統(tǒng)由三個(gè)部分組成,分別是:
1. Makefile:分布在 Linux 內(nèi)核源代碼中的 Makefile,定義 Linux 內(nèi)核的編譯規(guī)則;
2. 配置文件(config.in):給用戶提供配置選擇的功能;
3. 配置工具:包括配置命令解釋器(對(duì)配置腳本中使用的配置命令進(jìn)行解釋)和配置用戶界面(提供基于字符界面、基于 Ncurses 圖形界面以及基于 Xwindows 圖形界面的用戶配置界面,各自對(duì)應(yīng)于Make config、Make menuconfig 和 make xconfig)。
這些配置工具都是使用腳本語言,如 Tcl/TK、Perl 編寫的(也包含一些用 C 編寫的代碼):
配置命令                                             解釋腳本
make config,make oldcofig                    scripts/Configure
make menuconfig                                 scripts/Menuconfig
make xconfig                                       scripts/tkparse
除非是配置系統(tǒng)的維護(hù)者,一般的內(nèi)核開發(fā)者無須了解它們的原理,只需要知道如何編寫 Makefile 和配置文件就可以。
以字符界面配置(make config)為例,頂層Makefile調(diào)用scripts/Configure,按照arch/$(ARCH)/config.in來進(jìn)行配置。命令執(zhí)行完后產(chǎn)生文件.config,其中保存著配置信息。下一次再做make config將產(chǎn)生新的.config文件,原.config被改名為.config.old。


Linux 內(nèi)核支持非常多的硬件平臺(tái),對(duì)于具體的硬件平臺(tái)而言,有些配置就是必需的,有些配置就不是必需的。另外,新增加功能的正常運(yùn)行往往也需要一定的先決條件,針對(duì)新功能,必須作相應(yīng)的配

置。因此,特定硬件平臺(tái)能夠正常運(yùn)行對(duì)應(yīng)著一個(gè)最小的基本配置,這就是缺省配置。
Linux 內(nèi)核中針對(duì)每個(gè) ARCH 都會(huì)有一個(gè)缺省配置。在向內(nèi)核代碼增加了新的功能后,如果新功能對(duì)于這個(gè) ARCH 是必需的,就要修改此 ARCH 的缺省配置。修改方法如下(在 Linux 內(nèi)核根目錄下):
1. 備份 .config 文件
2. cp arch/arm/deconfig .config
3. 修改 .config
4. cp .config arch/arm/deconfig
5. 恢復(fù) .config
如果新增的功能適用于許多的 ARCH,只要針對(duì)具體的 ARCH,重復(fù)上面的步驟就可以了。

看看內(nèi)核源碼的README:
Do not skip this step even if you are only upgrading one minor version. New configuration options are added in each release, and odd problems will turn up if the configuration

files are not set up as expected. If you want to carry your existing configuration to a new version with minimal work, use "make oldconfig", which will only ask you for theanswers to new questions.

- Alternate configuration commands are:
"make config"      Plain text interface.
"make menuconfig" Text based color menus, radiolists & dialogs.
"make xconfig"     X windows (Qt) based configuration tool.
"make gconfig"     X windows (Gtk) based configuration tool.
"make oldconfig"   Default all questions based on the contents of your existing ./.config file and asking about new config symbols.
"make silentoldconfig"   Like above, but avoids cluttering the screen with questions already answered.
Additionally updates the dependencies.
"make defconfig"   Create a ./.config file by using the default symbol values from either arch/$ARCH/defconfig or arch/$ARCH/configs/${PLATFORM}_defconfig, depending on the architecture.
"make ${PLATFORM}_defconfig" Create a ./.config file by using the default symbol values from arch/$ARCH/configs/${PLATFORM}_defconfig.
Use "make help" to get a list of all available platforms of your architecture.
"make allyesconfig" Create a ./.config file by setting symbol values to 'y' as much as possible.
"make allmodconfig" Create a ./.config file by setting symbol values to 'm' as much as possible.
"make allnoconfig" Create a ./.config file by setting symbol values to 'n' as much as possible.
"make randconfig" Create a ./.config file by setting symbol
values to random values.
在網(wǎng)上搜到的一個(gè)解釋:
1. 如果.config不存在,運(yùn)行make config/menuconfig時(shí)的缺省設(shè)置由固化在各個(gè)Kconfig文件中各項(xiàng)目的缺省值決定。
2. 如果.config存在,運(yùn)行make config/menuconfig時(shí)的缺省設(shè)置即是當(dāng)前.config的設(shè)置,若對(duì)設(shè)置進(jìn)行了修改,.config將被更新。
3. arch/arm/defconfig是一個(gè)缺省的配置文件,make defconfig時(shí)會(huì)根據(jù)這個(gè)文件生成當(dāng)前的.config。
4. arch/arm/configs文件夾中有許多命名為xxx_defconfig的配置文件,如果運(yùn)行make xxx_defconfig,當(dāng)前.config文件會(huì)由xxx_defconfig文件生成。
5. make oldconfig的作用是備份當(dāng)前.config文件為.config.old,如若make config/menuconfig設(shè)置不當(dāng)可用于恢復(fù)先前的.config。

       總結(jié)了一下,平時(shí)編譯內(nèi)核時(shí)所采用的是先將當(dāng)前版本內(nèi)核的配置文件拷貝到源碼目錄下.config,然后采用make oldconfig的方式只回答新內(nèi)核中添加功能的問題,如果沒有.config文件,配置工具基于的默認(rèn)值是arch/$(ARCH)/Kconfig里的缺省值。一般如果當(dāng)前.config被配置工具改動(dòng)了,那么就會(huì)在該目錄下生成一個(gè).config.old文件,這是改動(dòng)之前配置文件的備份。make config毫無疑問是最基本也是最繁瑣的一種方式,它會(huì)問遍所有問題,然后創(chuàng)建.config文件,如果已有該文件,它會(huì)進(jìn)行備份(文件名為.config.old)。

      不過貌似現(xiàn)在內(nèi)核的編譯比較人性化,考慮到了配置時(shí)的可操作性,如果用戶在終端執(zhí)行make menuconfig或者make oldconfig,它會(huì)自動(dòng)先將/boot目錄下的配置文件寫進(jìn).config文件中,新增加的功能也會(huì)寫進(jìn)去,不過采用的是注釋的形式(所以它會(huì)比直接拷貝來的.config文件要大一些)。

       有一點(diǎn)要說明的是,.config文件中記錄的都是選擇y或者m的配置選項(xiàng),如果配置的時(shí)候選擇了n,那么在配置文件中是不會(huì)有任何記錄的;但是如果當(dāng)初配置時(shí)只是簡(jiǎn)單地按回車跳過,那么它也認(rèn)為是選擇了n,不過它在.config文件中會(huì)以注釋的形式進(jìn)行說明該選項(xiàng)還沒進(jìn)行配置。

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
瑞芯微RK3568|SDK開發(fā)之Kernel編譯
Linux 內(nèi)核配置方式詳解
openwrt make menuconfig
linux設(shè)備驅(qū)動(dòng)歸納總結(jié)(一):內(nèi)核的相關(guān)基礎(chǔ)概念
driver note
menuconfig過程詳解
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服