如何实现hello world Makefile &Kconfig吗?
我知道如何编写Makefile,但我们如何编写Makefile和Kconfig类似Linux内核。
我想写一个小程序,我可以打开菜单类似于Linux内核?
我不想让它为Linux内核模块编译,我知道那部分,我想学习使任何应用程序转换成这样一个可配置的应用程序。
任何示例指针我应该从哪里开始?
如果我正确理解你的问题,那么你必须询问在树构建你的可加载模块与内核构建过程。Kconfig负责在menuconfig中显示相应的值/可加载模块(我使用menuconfig进行内核配置)。
为了简单起见,让我们遵循下面的规则:在~/drivers目录下创建名为mymod的目录。在~/drivers/mymod中创建Kconfig和Makefile文件,并保留helloKernelmod.c
在Kconfig中保持以下内容
menu "Menu Name of Your Driver"
config HELLO_MODULE
tristate "Inside Menu Name"
help
This is help/informational content for your module
endmenu
在makefile中保持以下内容
obj-$(CONFIG_HELLO_MODULE) +=helloKernelmod.o
这些更新将完成任务,您的模块将被构建。为缩进添加制表符更多信息请访问https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt