Adding support for menuconfig / Kconfig in my proj

2020-06-16 01:09发布

I am planning to add support for menuconfig in my project. The project is not associated with Linux kernel so, I have to write everything from scratch in menuconfig and Makefile.

How do I add support for menuconfig and create Kconfig and make the makefile read the defines in .config?

Any good tutorial to begin with?

3条回答
smile是对你的礼貌
2楼-- · 2020-06-16 01:34

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.

查看更多
\"骚年 ilove
3楼-- · 2020-06-16 01:39

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

查看更多
ゆ 、 Hurt°
4楼-- · 2020-06-16 01:45

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.

查看更多
登录 后发表回答