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
2
votes
1 answer

disable a KBUILD_CFLAGS option when making a driver

I'm attempting to compile this UART -> USB driver from silicon labs. It has only been tested on Ubuntu version 18.04 (Bionic) and my machine is running on 21.10 (Impish). Apparently one of the differences is that the newest version enables strict…
richbai90
  • 4,994
  • 4
  • 50
  • 85
2
votes
1 answer

Variable assignment in Makefile Prerequisites

I'm looking through the Linux kernel code to try and understand how the image is built. In the scripts/makefile.build Makefile, there are some lines that look like this: $(real-objs-m) : part-of-module :=y $(real-objs-m) : quiet_modtag :=…
lihesoft
  • 23
  • 3
2
votes
0 answers

Linux config "selected by" what?

When configuring a linux kernel, i often stumble across options which can't be deselected, because they are automatically selected by other options. Usually, the Selected by: line only lists a few options, making it easy to find the culprit. But…
Felix G
  • 674
  • 1
  • 7
  • 17
2
votes
1 answer

In linux kernel source, why is there only one defconfig file for arch/arm64? (for arch/arm there are many xxx_defconfig files)

In linux kernel 5.4.21, there are many xxx_defconfig files under arch/arm/configs. But under arch/arm64/configs, there is only one file named "defconfig". Why is it so?
Chan Kim
  • 5,177
  • 12
  • 57
  • 112
2
votes
1 answer

Why does my /proc/kallsyms file not contain all the symbols in System.map?

I saw from this SO post that /proc/kallsyms should have the symbols of dynamically loaded modules as well as static code whereas System.map contains only the symbols of static code. However, when I cat /proc/kallsyms I seem to only have symbols in…
peachykeen
  • 4,143
  • 4
  • 30
  • 49
2
votes
0 answers

Unknown symbol cfg80211_connect_result kernel 4.4.169

I am trying to build kernel module rtl8192eu for Turris Omnia router using openwrt crosscompile toolchain. Everything looks fine except that the module cannot be inserted if I set EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211. I need that option,…
Grief
  • 1,839
  • 1
  • 21
  • 40
2
votes
1 answer

How to set preprocessor directives in makefile for kernel module build target?

I have a kernel module I'd like to build with any of make, make debug, make test, where the only difference between each one is a -D option to the compiler. This is essentially the same question as Creating a debug target in Linux 2.6 driver module…
Roger Dueck
  • 615
  • 7
  • 16
2
votes
0 answers

kbuild C: ~ Operator Converts Unsigned to Signed?

In a Linux kernel module there are definitions for a number of things that are in stdint.h/limits.h for user mode C but are conspicuously missing from the standard kernel headers. E.g. the following: #define UINT16_MIN (uint16_t)0 #define UINT16_MAX…
Justin Olbrantz
  • 647
  • 3
  • 11
2
votes
1 answer

How to extract the config from a kernel image file when CONFIG_IKCONFIG is set as a module (=m)?

How do I extract the kernel configuration from a kernel image file? The kernel image file type is: /boot/kernel7.img: Linux kernel ARM boot executable zImage (little-endian) The kernel has been compiled with CONFIG_IKCONFIG enabled. However,…
sergej
  • 17,147
  • 6
  • 52
  • 89
2
votes
1 answer

How to link files within other directories?

I have a project that is big enough to benefit from having its files classified by directory. I'm trying to build one kernel module out of all of them. The documentation states the following: --- 3.6 Descending down in directories A Makefile is…
Yd Ahhrk
  • 1,088
  • 12
  • 24
2
votes
1 answer

Using 'make menuconfig' / Kconfig infrastructure for my project

I'd like to take advantage of the existing 'make menuconfig' / Kconfig infrastructure to build a configuration file for my own project, which has nothing to do with Linux kernel or module development. I mostly develop on Linux. Where can I get the…
dpeng
  • 395
  • 2
  • 4
  • 17
2
votes
1 answer

Suggestions to handle `Wframe-larger-than`-warning on kernel module

Hello and a happy new year, I'm working on a kernel-module. It is necessary to do a numeric calculation of some parameter to set up the device correctly. The function works perfectly but the gcc compiler (I'm using kbuild) gives me the…
Alex44
  • 3,597
  • 7
  • 39
  • 56
2
votes
1 answer

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…
ART
  • 1,509
  • 3
  • 29
  • 47
2
votes
1 answer

How does lxdialog and kconfig (menuconfig) work together?

I want to understand how the menuconfig is done e.g.: for a linux-kernel or Buildroot. What I know is, that it's using lxdialog as GUI, and kconfig somehow carrys the logical part (like selects, depends etc.). But where or how does dialog gets the…
user3085931
  • 1,757
  • 4
  • 29
  • 55
2
votes
0 answers

Add dependecy on another module while building a kernel module

I am trying trying to use an external module that I have written from another kernel module. The second module is the cr_module from the Berkeley lab checkpoint/restart). So, I create a module A that exports some functions and then created another…
feeling_lonely
  • 6,665
  • 4
  • 27
  • 53
1 2
3
9 10