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
0
votes
0 answers

What does the following lines mean from kernel makefiles?

The following code are extracted from kernel source $(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE) $(real-objs-m) : quiet_modtag := [M] $(multi-objs-m) : modname = $(modname-multi)
Larry
  • 13
  • 3
0
votes
2 answers

u-boot.cfg file in U-boot

I am understanding the U-boot build, it seems the selected config options in Kconfig are updated in u-boot.cfg file. Can you guide to understand how it is created and the usage of this file(who will use this file).
user3693586
  • 1,227
  • 5
  • 18
  • 40
0
votes
0 answers

Calling Python Script from Kbuild file

How can I call a python script present in scripts folder from the Kbuild file? There is a code to call shell script from the Kbuild as follows : ##### # 4) Check for missing system calls # always += missing-syscalls targets +=…
0
votes
1 answer

How u-boot generation the dot config file

Under the u-boot tree, after make my_defconfig, a .config is generated. By comparing the defconfig and dot config files, it seems that all config items in my_defconfig are included in .config, and there are some extra config items added into…
bruin
  • 979
  • 1
  • 10
  • 30
0
votes
1 answer

How is obj-m variable exported to sub-make?

I am trying to learn linux kernel module building and kbuild by following https://www.tldp.org/LDP/lkmpg/2.6/lkmpg.pdf and reading GNU make manual. Here is the Makefile of the first example, Hello-1, on The Linux Kernel Module Programming Guide:…
ayazar
  • 145
  • 1
  • 11
0
votes
1 answer

How to check if given page is a ZERO_PAGE in a kernel module?

I am writing a kernel module, where, inside a function I need to check if passed struct page* maps to ZERO_PAGE or not. I came up with following code to check the condition. foo (struct page *pp, ..) { if(pp == ZERO_PAGE(0)) { …
0
votes
1 answer

VirtualBox Guest Additions compilation

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

How to build a single source file of a kernel module

I want to compile a .c file into an .o file so that in a separate later stage I could link it with others to produce a loadable module (.ko file). I tried to follow Kbuilds documentation (2.4 here), but had no success: obj-m: myfile.o all: make…
Artium
  • 5,147
  • 8
  • 39
  • 60
0
votes
0 answers

exec-shield kernel parameter cant be enabled in arm platform

i want to enable kernel.exec-shield parameter in an embedded platform at run-time or compile time. i have 32-bit arm architecture in my embedded platform. i list all the kernel parameters with following command. sysctl -a and i get many unrelated…
mehmet riza oz
  • 541
  • 6
  • 18
0
votes
1 answer

Enable/Disable Kernel Configuration options in Yocto

I have a configuration option called CONFIG_X86_SMAP that I would like to disable in my kernel image. The problem is that I can't identify where this option is being set. I can confirm that it isn't set in my defconfig file and also it's not set by…
Keith Ape
  • 1,103
  • 1
  • 12
  • 28
0
votes
1 answer

Compile error for Linux kernel 4.10.8 targeting ARM

I'm trying to cross compile the Linux kernel 4.10.8 for arm, but get this error: CC [M] drivers/vhost/vhost.o In file included from ./include/uapi/linux/stddef.h:1:0, from ./include/linux/stddef.h:4, from…
Mr Zach
  • 495
  • 4
  • 18
0
votes
0 answers

KConfig mix files

I'm currently developing some firmware for an ESP32 device. I reached the stage in the development process in which I need to write some stuff in the Kconfig file. I'm just developing one component and I have my own Kconfig file. But in the "make…
SnowFreak
  • 1
  • 2
0
votes
1 answer

How to identify *.ko file given CONFIG_* name?

I enabled a couple new kernel modules as loadable (m as opposed to builtin with y) but do not understand how the CONFIG maps to the .ko file. modprobe CONFIG_MY_CONFIG insmod CONFIG_MY_CONFIG modprobe MY_CONFIG insmod MY_CONFIG
tarabyte
  • 17,837
  • 15
  • 76
  • 117
0
votes
0 answers

make oldconfig for entry without prompt

I'm doing a make oldconfig on a config file that has CONFIG_FOO=y. The kconfig entry defines FOO as a bool, without a prompt. It seems that make oldconfig wipes out the entry. If I add a prompt to FOO, then the value is retained. I'm…
John
  • 3,400
  • 3
  • 31
  • 47
0
votes
0 answers

Selectively build a module from a different kernel directory using Kbuild

I'm having trouble in selectively building a module from a different directory using KBUILD. I have 2 kernel directories Kernel / kernel-XXX Let the drivers directory structure be like follows ----kernel | | | |-----drivers | | | …
Django
  • 181
  • 2
  • 15
1 2 3
9
10