Adding support for menuconfig / Kconfig in my project

不羁岁月 提交于 2019-12-04 03:29:40

If you are interested on using KBuild/KConfig for your custom applications, you may try the following Github projects. They aim to provide an initial template for projects using KBuild/KConfig and, therefore, supporting menuconfig.

I'll assume you are making a driver that is outside of the kernel directory. Information for that can be found here: https://www.kernel.org/doc/Documentation/kbuild/modules.txt.

Outside of that, if you want a userspace file to see the .config variables, you can have it depend on the kernel build, and then include autoconf.h, which is in the include/generated folder for recent versions of the kernel. Userspace does not use kbuild directly.

First you need to copy the folders and files below from linux folder 'scripts' into your own project

  • basic
  • kconfig
  • Kbuild.include
  • Makefile.build
  • Makefile.host
  • Makefile.lib

Sources in folders basic and kconfig need to be built for your processor architecture. How to do it is written in the linux Makefile. You can change some names using next variables

  • KCONFIG_CONFIG = .config
  • KCONFIG_AUTOHEADER = application/autoconf.h
  • KCONFIG_AUTOCONFIG = build/include/config/auto.conf
  • KCONFIG_TRISTATE = build/include/config/tristate.conf

The following project initially created for ARM MCUs can help you to understand kconfig

https://github.com/mcu/kconfig

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!