1. 前言
本文將介紹ARM64架構下,Linux kernel和啟動有關的配置項。
注1:本系列文章使用的Linux kernel版本是“X Project”所用的“Linux 4.6-rc5”,具體可參考“https://github.com/wowotechX/linux.git”。
2. Kconfig文件
ARM64架構中和Boot有關的配置項,非常簡單,主要包括ACPI、命令行參數和UEFI幾種。這些配置項位於“ arch/arm64/Kconfig”中,具體如下:
1: menu "Boot options"
2:
3: config ARM64_ACPI_PARKING_PROTOCOL
4: bool "Enable support for the ARM64 ACPI parking protocol"
5: depends on ACPI
6: help
7: Enable support for the ARM64 ACPI parking protocol. If disabled
8: the kernel will not allow booting through the ARM64 ACPI parking
9: protocol even if the corresponding data is present in the ACPI
10: MADT table.
11:
12: config CMDLINE
13: string "Default kernel command string"
14: default ""
15: help
16: Provide a set of default command-line options at build time by
17: entering them here. As a minimum, you should specify the the
18: root device (e.g. root=/dev/nfs).
19:
20: config CMDLINE_FORCE
21: bool "Always use the default kernel command string"
22: help
23: Always use the default kernel command string, even if the boot
24: loader passes other arguments to the kernel.
25: This is useful if you cannot or don't want to change the
26: command-line options your boot loader passes to the kernel.
27:
28: config EFI_STUB
29: bool
30:
31: config EFI
32: bool "UEFI runtime support"
33: depends on OF && !CPU_BIG_ENDIAN
34: select LIBFDT
35: select UCS2_STRING
36: select EFI_PARAMS_FROM_FDT
37: select EFI_RUNTIME_WRAPPERS
38: select EFI_STUB
39: select EFI_ARMSTUB
40: default y
41: help
42: This option provides support for runtime services provided
43: by UEFI firmware (such as non-volatile variables, realtime
44: clock, and platform reset). A UEFI stub is also provided to
45: allow the kernel to be booted as an EFI application. This
46: is only useful on systems that have UEFI firmware.
47:
48: config DMI
49: bool "Enable support for SMBIOS (DMI) tables"
50: depends on EFI
51: default y
52: help
53: This enables SMBIOS/DMI feature for systems.
54:
55: This option is only useful on systems that have UEFI firmware.
56: However, even with this option, the resultant kernel should
57: continue to boot on existing non-UEFI platforms.
58:
59: endmenu
3. 配置項說明
注2:Linux kernel的配置項雖然眾多,但大多使用默認值就可以。因此在kernel移植和開發的過程中,真正需要關心的並不是特別多。對於那些常用的、需要關心的配置項,我會在分析文章中用黃色背景標注。
3.1 ACPI有關的配置項
配置項 | 說明 | 默認值 |
CONFIG_ARM64_ACPI_ PARKING_PROTOCOL | 是否支持“ARM64 ACPI parking protocol”。關於ACPI和parking protocol,有機會的話我們會在其它文章中分析,這里不需要過多關注。 | 依賴於CONFIG_ACPI |
3.2 Kernel命令行參數有關的配置項
配置項 | 說明 | 默認值 |
CONFIG_CMDLINE | 內核默認的命令行參數。設置該參數后,可以不需要bootloader傳遞(開始porting kernel的時候比較有用,因為不能保證bootloader可以正確傳遞^_^) | 無 |
CONFIG_CMDLINE_FORCE | 強制使用內核默認的命令行參數(可以忽略bootloader傳遞來的); 一般在kernel開發的過程中,用來測試某些新的命令行參數(先不修修改bootloader傳遞的內容)。 | 無 |
注3:如果Kconfig沒有通過“default”關鍵字為某個配置項指定默認值,那么生成的.config文件中就不會出現該配置項,也就是變相的“禁止”了。后同。
3.3 UEFI有關的配置項
DMI
配置項 | 說明 | 默認值 |
CONFIG_EFI_STUB | 用於支持EFI啟動; 使能該配置項之后,會修改Kenrel bzImage header,把kernel Image變成一個可以被EFI運行的PE/COFF Image。 具體可參考Documentation/efi-stub.txt中的介紹。 |
無 |
CONFIG_EFI | 支持一些由UEFI Firmware提供的、運行時的服務,如RTC、reset等; 該配置項依賴Open Firmware(device tree),並且有很多的關聯項(可以參考Kconfig文件中的select關鍵字); 另外,有意思的是(參考第2章Kconfig文件中的“depends on OF && !CPU_BIG_ENDIAN”),該配置項只能在小端CPU中才能使用。有空可以研究一下為什么。 |
y |
CONFIG_DMI | 用於控制是否支持“SMBIOS/DMI feature”,依賴於CONFIG_EFI; 需要注意的是,就算使能了該配置項,kernel也需要能夠在其它非UEFI環境下正常啟動。 | y |
4. 參考文檔
[1] UEFI,http://www.wowotech.net/armv8a_arch/UEFI.html
[3] SMBIOS/DMI,http://www.dmtf.org/cn/standards/smbios