2

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?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
ART
  • 1,509
  • 3
  • 29
  • 47
  • `where should I start from?` - Start from the kernel's Makefile code. `make menuconfig` actually calls some program, which is built using `ncurses` library. – Tsyvarev Oct 07 '15 at 09:42
  • Following might help http://www.denx.de/wiki/pub/U-Boot/MiniSummitELCE2014/uboot2014_kconfig.pdf – RRON Nov 02 '15 at 10:41

1 Answers1

1

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

a-man
  • 41
  • 1
  • 5