makefilelinux-kernellinux-device-driverkernel-module

makefile - what to do with the kconfig file


I stumbled over this site about USB video grabber under Linux, I'm trying to compile the code found here. I have read about makefiles but this one confuses me, cause it's so short:

usbtv-y := usbtv-core.o \
    usbtv-video.o

obj-$(CONFIG_VIDEO_USBTV) += usbtv.o

I wanted to write now my own makefile. What I want to know now is, what the Kconfig file is for and how to use it. I have a hard time finding more information about how to use it, just some stuff regarding KDE which is not what I want. Can someone enlighten me please? I think it's important, cause in the description (on the first site I linked) it says under how to make it work

Linux kernel driver, enable CONFIG_VIDEO_USBTV

Here's the Kconfig file:

config VIDEO_USBTV
        tristate "USBTV007 video capture support"
        depends on VIDEO_V4L2
        select VIDEOBUF2_VMALLOC

        ---help---
          This is a video4linux2 driver for USBTV007 based video capture devices.

          To compile this driver as a module, choose M here: the
          module will be called usbtv

Also, what is meant in the Kconfig file with "choose M here"? Where? How? When?


Solution

  • Makefile

    This Makefile is not complete. It is included by other makefiles:

    This makefile [1] includes this one [2] which includes this one [3] which includes this one [4] which includes this one [5] which includes your example.

    Kconfig

    Like your Makefile, this Kconfig file is also not complete. It is included by other Kconfig: this kconfig [6] includes ... which includes ... etc ... which includes your example.

    According to the documentation, this piece of kconfig defines a help text:

    • help text: "help" or "---help---" This defines a help text. The end of the help text is determined by the indentation level, this means it ends at the first line which has a smaller indentation than the first line of the help text. "---help---" and "help" do not differ in behaviour, "---help---" is used to help visually separate configuration logic from help within the file as an aid to developers.

    So, "M" is an option of the program and is not a feature of kconfig. It has nothing to do with Kconfig.

    Documentation

    You will find kconfig documentation here [7] and makefile documentation here [8].

    URLs

    [1] https://github.com/torvalds/linux/blob/master/Makefile

    [2] https://github.com/torvalds/linux/blob/master/drivers/Makefile

    [3] https://github.com/torvalds/linux/blob/master/drivers/media/Makefile

    [4] https://github.com/torvalds/linux/blob/master/drivers/media/usb/Makefile

    [5] https://github.com/torvalds/linux/blob/master/drivers/media/usb/Makefile

    [6] https://github.com/torvalds/linux/blob/master/Kconfig

    [7] https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt

    [8] https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt