ART
ART

Reputation: 1569

Hello world kconfig and makefile to make it similar to linux kernel menuconfig

How can I implement hello world Makefile & Kconfig?

I know how to write Makefile, but how can we write Makefile and Kconfig similar to Linux Kernel.
I want to write small program for which I can open menuconfig similar to Linux Kernel?

I don't want it for Linux Kernel module compilation, I know that part, I want to learn to make any application to convert into such a configurable app.

Any sample pointers where should I start from?

Upvotes: 2

Views: 1952

Answers (1)

a-man
a-man

Reputation: 41

If I understand your question properly then you must be asking about in tree build of your loadable module with kernels build process. Kconfig is responsible for the respective value/loadable module to be visible in menuconfig(I use menuconfig for kernel configuration).

To keep things simple let's follow below: Create dir on ~/drivers directory nammed mymod. In ~/drivers/mymod create Kconfig and Makefile files and keep your helloKernelmod.c

In Kconfig keep below content

menu "Menu Name of Your Driver"

config HELLO_MODULE 
      tristate "Inside Menu Name"
      help
          This is help/informational content for your module
endmenu

In makefile keep below content

obj-$(CONFIG_HELLO_MODULE)     +=helloKernelmod.o

these updates will do the trick and your module will be built. Add tabs for indentation For more information go to https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt

Upvotes: 1

Related Questions