Complete Communications Engineering

Packages in Buildroot are usually downloaded as archive files, extracted, and built.  Buildroot can use this process for the Linux kernel also, but there are cases where the Linux kernel needs to be customized and extracting an archive on every rebuild can make this difficult.  Buildroot supports another method where the kernel source code can be stored in a folder on the build machine.  Using this method, Buildroot will use rsync to copy changes from the source folder to the build folder, instead of extracting an archive.  Having the source already extracted allows the use of change tracking software such as GIT, which can be helpful for developing custom Linux kernel code.

Using a custom Linux kernel in Buildroot can be done by using the Buildroot package override feature.  This requires setting some configuration parameters, and creating an override file.  The following example shows the configuration parameters:

BR2_PACKAGE_OVERRIDE_FILE=”board/custom/override.mk”

BR2_LINUX_KERNEL_CUSTOM_VERSION=y

BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE=”custom-linux-5.15″

The path to the override file is relative to the root folder of the Buildroot system.  The override file must exist for the package override to work.  The file specifies OVERRIDE_SRCDIR values for any of the packages being used by Buildroot.  For example, the following line will specify an override folder for Linux:

override.mk

LINUX_OVERRIDE_SRCDIR=$(TOPDIR)/src/$(BR2_LINUX_KERNEL_VERSION)

The TOPDIR variable is defined by Buildroot to be the root folder of the Buildroot system.  The BR2_LINUX_KERNEL_VERSION variable will contain the Linux version value string from the configuration.  This folder must exist, and its contents will be treated as the Linux source code.  Once this is setup, running make-linux-rebuild will cause Buildroot to use rsync to update another folder (output/build/linux-custom) where the Linux kernel is actually built from.  (The source directory stays clean, which is helpful for change tracking.)  The new kernel image will be copied to the output/images folder, and updated kernel modules will be copied to the output/target folder as usual.