完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
在配置界面中,可以选择、设置选项,这些设置会保存在.config文件里。
Makefile会包含.config,根据里面的值决定编译哪些文件、怎么编译文件。 1.1 配置界面示例 问题:
1.2.1 示例 在配置界面中操作的结果保存在.config文件中,示例如下: # LOSCFG_COMPILER_HIMIX_32 is not set LOSCFG_COMPILER_CLANG_LLVM=y # # Platform # LOSCFG_PLATFORM="stm32mp157" # LOSCFG_PLATFORM_HI3516DV300 is not set # LOSCFG_PLATFORM_HI3518EV300 is not set LOSCFG_PLATFORM_STM32MP157=y # LOSCFG_PLATFORM_IMX6ULL is not set LOSCFG_PLATFORM_BSP_GIC_V2=y LOSCFG_ARCH_ARM=y LOSCFG_ARCH_ARM_AARCH32=y LOSCFG_ARCH_ARM_V7A=y LOSCFG_ARCH_ARM_VER="armv7-a" LOSCFG_ARCH_FPU_VFP_V4=y LOSCFG_ARCH_FPU_VFP_D32=y LOSCFG_ARCH_FPU_VFP_NEON=y LOSCFG_ARCH_FPU="neon-vfpv4" LOSCFG_ARCH_CORTEX_A7=y LOSCFG_ARCH_CPU="cortex-a7" Makefile会包含.config文件,它会根据里面的变量比如LOSCFG_PLATFORM_STM32MP157选择单板相关的文件。 1.2.2 配置项的前缀 在Kconfig文件中,假设配置项的名字是XXX,在.config文件中:
1.3.1 示例 在make menuconfig界面,可以看到这个配置项: 在配置界面,使用方向箭头游走到Enable FAT Cache Sync Thread后,可以:
在Kconfig文件中,它对应下列代码: 1.3.2 语法 解释如下:
1.4.1 示例 在Kconfig中,代码如下: menu "Lib" config LIB_LIBC bool "Enable Libc" default y help Answer Y to enable libc for full code. config LIB_ZLIB bool "Enable Zlib" default y depends on LIB_LIBC help Answer Y to enable LiteOS support compress file library. endmenu 1.4.2 语法 解释如下:
1.5.1 示例 在上述界面中,对于LiteOS_Compiler_Type,有2个选择:arm-linux-ohoseabi、clang-llvm。 在Kconfig文件中怎么描述?如下: menu "Compiler" choice prompt "LiteOS_Compiler_Type" default COMPILER_CLANG_LLVM help Enable arm-himix100 or aarch64-himix100 or compiler. config COMPILER_HIMIX_32 bool "arm-linux-ohoseabi" depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_IMX6ULL || PLATFORM_STM32MP157 config COMPILER_CLANG_LLVM bool "clang-llvm" depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_IMX6ULL || PLATFORM_STM32MP157 endchoice endmenu 1.5.2 语法 解释如下:
menuconfig XXX和config XXX类似, 唯一不同的是该选项除了能设置y/m/n外,还可以实现菜单效果(能回车进入该项内部)。 1.6.1 示例 对于上述界面,Kconfig文件中代码如下: menuconfig OF bool "Device Tree and Open Firmware support" help This option enables the device tree infrastructure. It is automatically selected by platforms that need it or can be enabled manually for unittests, overlays or compile-coverage. if OF config OF_UNITTEST bool "Device Tree runtime unit tests" depends on OF_IRQ select OF_EARLY_FLATTREE select OF_RESOLVE help This option builds in test cases for the device tree infrastructure that are executed once at boot time, and the results dumped to the console. If unsure, say N here, but this option is safe to enable. config OF_OVERLAY bool "Device Tree overlays" select OF_DYNAMIC select OF_RESOLVE help Overlays are a method to dynamically modify part of the kernel's device tree with dynamically loaded data. While this option is selected automatically when needed, you can enable it manually to improve device tree unit test coverage. endif # OF 1.6.2 语法 menuconfig常用格式有2种: menuconfig M if M config C1 config C2 endif 或: menuconfig M config C1 depends on M config C2 depends on M 第1项menuconfig M跟config M语法是一样的, 不同之处在于menuocnfig M后面可以跟着好几个依赖于M的config C1、config C2等子配置项。 1.7 if/endif 1.7.1 语法 在上面的menuconfig中就有if/endif的使用,它的语法如下: "if" "endif" 1.7.2 示例 示例如下,只有定义的OF项,OF_UNITTEST和OF_OVERLAY才会显示出来: if OF config OF_UNITTEST bool "Device Tree runtime unit tests" depends on OF_IRQ select OF_EARLY_FLATTREE select OF_RESOLVE help This option builds in test cases for the device tree infrastructure that are executed once at boot time, and the results dumped to the console. If unsure, say N here, but this option is safe to enable. config OF_OVERLAY bool "Device Tree overlays" select OF_DYNAMIC select OF_RESOLVE help Overlays are a method to dynamically modify part of the kernel's device tree with dynamically loaded data. While this option is selected automatically when needed, you can enable it manually to improve device tree unit test coverage. endif # OF 1.8 source source 语句用于读取另一个文件中的 Kconfig 文件,如: source "../../kernel/liteos_a/platform/Kconfig" 1 1.9 comment comment 语句出现在界面的第一行,用于定义一些提示信息,如: config ARCH_ARM bool source "arch/arm/Kconfig" comment "Extra Configurations" config ARCH_FPU_DISABLE bool "Disable Floating Pointer Unit" default n help This option will bypass floating procedure in system. 界面如下: ## 1.9 comment comment 语句出现在界面的第一行,用于定义一些提示信息,如: ```shell config ARCH_ARM bool source "arch/arm/Kconfig" comment "Extra Configurations" config ARCH_FPU_DISABLE bool "Disable Floating Pointer Unit" default n help This option will bypass floating procedure in system. |
|
|
|
只有小组成员才能发言,加入小组>>
2519 浏览 0 评论
1101浏览 2评论
712浏览 1评论
465浏览 0评论
206浏览 0评论
351浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 01:06 , Processed in 1.906310 second(s), Total 80, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号