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

Avoid creating debug info in LKM with kbuild

I'm building Linux kernel module (LKM) from a big C files (>50 000 LOC). It's some generated RAID calculation code. When I try to build it from kbuild gcc eats all of the memory and crashes, while invoking gcc manually works fine. After inspecting…
Alexander Dzyoba
  • 4,009
  • 1
  • 24
  • 29
2
votes
1 answer

How to load a modified kernel module which is already exist in precompiled kernel

one way is to do so is to build the kernel sources again with making original module loadable which need to be modified. so original module can be removed and modified module can be inserted. but this is time consuming process. I am wondering if…
raj_gt1
  • 4,653
  • 2
  • 20
  • 28
2
votes
1 answer

How .ko file is built

I am trying to port my own driver to a Beagle board xm arm-cortex-A8. While porting I am trying to figuring out how the .ko file actually builds. In our Makefile we only have a command to build an.o file. How is a .ko file built? Using…
2
votes
2 answers

How to properly make clean in kernel Makefile

I'm porting a driver to the 3.4 kernel, and when I do a make clean, it is not cleaning some .o files, so now I'm wondering what the proper way of doing this is. I have the following Makefile (note: in a separate directory from the kernel): obj-y +=…
John
  • 3,400
  • 3
  • 31
  • 47
1
vote
0 answers

hotkey of kernel menuconfig searching from current path

From make menuconfig, the items shown was not in alphabetical order. It is not easy to search what we need. Is any better way hotkey to faster get cursor to the item we need.
Robber Pen
  • 1,033
  • 2
  • 12
  • 24
1
vote
1 answer

Yocto: how to configure an out-of-tree kernel module recipe that uses "inherit module"?

I have written a simple inherit module recipe to build a third-party out-of-tree kernel module called u-dma-buf: SUMMARY = "User space mappable DMA Buffer" DESCRIPTION = "${SUMMARY}" LICENSE = "BSD-2-Clause" LIC_FILES_CHKSUM =…
davidA
  • 12,528
  • 9
  • 64
  • 96
1
vote
1 answer

Missing config option from Linux .config

I am trying to set the CONFIG_DEBUG_INFO_BTF option to y in my Linux .config file. For some reason, this config item is missing from .config even after running make olddefconfig, and when I manually add CONFIG_DEBUG_INFO_BTF=y to .config, the option…
Jack Humphries
  • 13,056
  • 14
  • 84
  • 125
1
vote
0 answers

What are .o.ur-safe files generated by Linux kernel module build?

What is the purpose of *.o.ur-safe files generated when building a kernel module? I couldn't find a reference to this extension in the kernel source, or anywhere else. Here's the (fairly standard) Makefile: obj-m += module.o module-y := main.o…
Sagar
  • 1,617
  • 9
  • 17
1
vote
0 answers

Get dependencies of a given feature in the Linux Kernel

I have been working on the Linux kernel these time: undertanding its build system and everything about kbuild. My question is: is it possible to get, for a given feature of the kernel, all its dependency? I know that there is a parser of Kconfig…
Ngahy Be
  • 545
  • 1
  • 4
  • 10
1
vote
1 answer

Linux Kbuild: what is the difference between $(src) and $(obj)

In Documentation/kbuild/makefiles.txt chapter 3.10 it is mentioned that $(src) refers to the location of the source code while $(obj) refers to the location of the generated output files. I am confused about this when using a different output…
bombos
  • 33
  • 1
  • 4
1
vote
1 answer

Kconfig and LKM

I'm working with LKM outside the kernel tree and I want to use some compiling options for my module like MYLKM_CONFIG_{something}. I know that this can be done using the C preprocessing (#define // #ifdef // #endif). But I want to know is it…
Ilya Matveychikov
  • 3,936
  • 2
  • 27
  • 42
1
vote
1 answer

Setting Include Paths When Building Kernel Modules

I'm trying to compile a kernel module for Linux. I have the following files: testuio.c and Makefile. When I type make all I get the following errors: $ make all make -C /lib/modules/`uname -r`/build …
Alex
  • 751
  • 1
  • 6
  • 34
1
vote
1 answer

Why did not we have ccflags-m, but ccflags-y?

I'm analyzing Linux Kernel Makefiles bundle. We can define an additional compiler flag to build external module with ccflags-y += -std=gnu11 -Wno-declaration-after-statement -Werror. I looked at Makefile.build which external module build goes down…
St.Antario
  • 26,175
  • 41
  • 130
  • 318
1
vote
0 answers

Can Kbuild build one module for several kernels at once?

Roughly: build against all kernels listed in /lib/modules E.g: l /lib/modules 5.3.13-300.fc31.x86_64 5.3.14-300.fc31.x86_64 Right now I have an ordinary KBuild and pass the location of the kernel module with -C looks like the following line. [..]…
Christoph Acham
  • 101
  • 1
  • 3
1
vote
2 answers

How to add multiple Headers files path in a Makefile?

I am trying to compile uleds.c driver and this driver includes multiple files existing under this path : /opt/poky-atmel/2.5.3/sysroots/cortexa5hf-neon-poky-linux-gnueabi/usr/src/kernel/include/linux I want now to modify my Makefile and add this…
Gonn
  • 377
  • 5
  • 21