Questions tagged [kbuild]

kbuild is the build system used by the Linux kernel.

kbuild is a build framework based on GNU make and a standard set of cross platform tools. It was originally developed for the Linux Kernel, but is now used in other projects such as crosstool-ng, buildroot, ltib, etc.

kbuild is extremely powerful and tries to hide most of its complexity in templates so that the actual makefiles are relatively easy to understand and write. There are two distinct parts of kbuild; A set of tools and languages for describing configuration variables and Gnu make template code to drive the actual build process.

There are stock documentation for different topics,

The Gnu make harness for the Linux kernel is in the main Makefile and Kbuild.include. The tools for configuring variable (and processing the Kconfig language) are in a kconfig directory. Obviously other projects such as buildroot, and crosstool-ng use modified versions.

The two aspects are found in files within the kernel source. They are a Kconfig file defining variables that can be defined by the tools. The second portion is a Makefile, which uses the Kconfig output (usually .config) to guide the build process through normal Gnu make rules, templates and macros.

144 questions
4
votes
1 answer

Problems building driver on Linux kernel 5.8.x

I'm working with a Linux driver that is building on v5.7.x kernels but not on the latest v5.8.x releases. To summarise, most of the driver is pre-built and the kernel interface is built on the target. This involves a make -f Kbuild command. Having…
Alan Spark
  • 8,152
  • 8
  • 56
  • 91
4
votes
2 answers

VirtualBox Guest Additions compilation and iso packing

I'm compiling VirtualBox Guest Additions according to official documentation. Building separately 64- and 32-bit additions and trying to pack it into iso image. Target system is Windows 7 x64. All software requirements as per documentation,…
user707779
4
votes
2 answers

How to select the value of a string option from another option in Kbuild Kconfig files?

For Boolean config, I am using select. Is there a similar one for string? Eventually, I would like to have something like: config MY_VAR_STR string config MY_VAR_BOOL bool default n config OPTION_2 bool # Set MY_VAR_BOOL value to y select…
Bechir
  • 987
  • 10
  • 26
4
votes
2 answers

How to chain KBuild Makefiles properly to build subfolders inside kernel module

I have a kernel module (often compiled using CONFIG_MYMODULE=m) which is set-up like the following: mymodule/Makefile ../foo/Makefile ../foo/component1/Makefile ../foo/component2/Makefile Currently what's being used…
Jordan
  • 9,014
  • 8
  • 37
  • 47
4
votes
1 answer

IDE with Kconfig support?

Is there any IDE that exports Kconfig files to automatically add include and source folders, as well as setting the actual symbols that are defined there? I mean, it's next to impossible to have a complete Eclipse environment for Linux Kernel…
rnunes
  • 2,785
  • 7
  • 28
  • 56
4
votes
1 answer

How do I make buildroot packages mutually exclusive?

I'm implementing a buildroot package, foo, which can't be included together with a specific other package, bar. I'm trying to define the packages mutually exclusive by writing depends on-statements in the respective Config.in-files. In…
anorm
  • 2,255
  • 1
  • 19
  • 38
4
votes
2 answers

In Kernel makefile $(call cmd, tags) what is the cmd here refers to?

In Kernel Makefile i found the code like below: ctags CTAGS CSCOPE: $(HEADERS) $(SOURCES) $(ETAGS) $(ETAGSFALGS) $(HEADERS) $(SOURCES) $(call cmd, ctags) Also, where can i find the Macro or function ?
mrsk
  • 55
  • 1
  • 8
4
votes
3 answers

Linking kernel module with a static lib

I'm trying to link my kernel module with an external static lib, like this: obj-m += my_prog.o my_prog-objs := some/path/lib.a # all the standard targets... For some reasone, the above Makefile doesn't compile my_prog.c at all, and the resulting…
Igor R.
  • 14,716
  • 2
  • 49
  • 83
3
votes
1 answer

Alternative to Kconfig (kernel config language) to configure/describe large C software

I'm interested in the configuration/building of large C systems... The Linux kernel uses the Kconfig language to describe the various configuration options (macros defined as CONFIG_X) and their dependencies... Basically, in each directory, there's…
LB40
  • 12,041
  • 17
  • 72
  • 107
3
votes
0 answers

Kernel Configuration Fragment not applying

I am attempting to add a linux kernel configuration fragment file (linux-1024MB-frags.config) into my build. Inside the fragment file I have set, CONFIG_HIGHMEM=y. In my buildroot .config I have…
gutelfuldead
  • 562
  • 4
  • 22
3
votes
0 answers

Building an out-of-tree kernel module with separate source and build directories via autoconf

Given a package that uses autoconf (a configure script) to provide both a user-mode application and a kernel driver, with a directory structure like this: configure.ac configure Makefile.am user Makefile.am user.c driver Makefile.am …
Miral
  • 12,637
  • 4
  • 53
  • 93
3
votes
0 answers

Errors in Linux sources?

I am trying to write a kernel module for an external system. To do this, I used the .config file for that kernel and rebuilt the sources on my development computer. Then I wrote a makefile which uses the following…
Zephyr
  • 337
  • 5
  • 23
3
votes
1 answer

Is it possible to convert a choice to an int in Kconfig

I'm looking for a way to convert a choice to an int in a Kconfig file. So for example, I would want: config BUFSIZE int choice prompt "choose a buffersize" depends on FOOBAR default 10 if FOO default 15 if BAR default…
John
  • 3,400
  • 3
  • 31
  • 47
3
votes
0 answers

Redefinition of macro warnings in kernel module code

I am going through beginner's kernel module exercises. In several sources, they define the following macros: #define MODULE #define LINUX #define __KERNEL__ But kbuild warns: warning: "MODULE" redefined [enabled by default] ... warning:…
jsj
  • 9,019
  • 17
  • 58
  • 103
3
votes
1 answer

Understanding how kbuild build process work

I am familiar with make and kbuild, and how the build system work. But I am having hard time understanding how the object goals are built!? For example, in Kbuild, if you want to generate an object file in a directory you would have a makefile with…
Jafar Kofahi
  • 763
  • 6
  • 22
1
2
3
9 10