Linux Kernel Configuration

Customizing Linux Kernel #

Updating Defconfig #

Default path to kernal


kernel can be customized using bitbake menuconfig command

$ cd ~/CodeSetup_Trucrux/
$ source setup-environment build_trucrux
$ bitbake -c menuconfig virtual/kernel

now customize kernel by selecting options using

"*" = build in
"M" = Modular
" " = not selected

once finished save and exit

The .config file is stored in


Once the configuration is done the file has to be saved as a patch called defconfig. To save configuration as a defconfig file

$ bitbake -c savedefconfig virtual/kernal

the defconfig is saved in


now to make it work as a patch copy defconfig file to

$ cd CodeSetup_Trucrux/build_xwayland/tmp/work/imx8mq-trucrux-fslc-linux/linux-trucrux/5.4.142-r0/build
$ cp defconfig ~/CodeSetup_Trucrux/sources/meta-trucrux/recipies-kernel/linux/files/

now create a bbappend file

$ cd ..
$ touch linux-trucrux_5.4.bbappend
$ vi linux-trucrux_5.4.bbappend

now add the following lines in bbappend file

SRC_URI += "file://<path to defconfig>"
KBUILD_DEFCONFIG_imx8mq-trucrux = ""

now rebuild kernel

$ bitbake linux-trucrux

Customizing Source Code #

To make changes in source code first need to create a local_repos

$ cd ~/CodeSetup_Trucrux
$ mkdir local_repos
$ cp -a build_xwayland/tmp/work/imx8mq-trucrux-fslc-linux/linux-trucrux/5.4.142+gitAUTOINC+91e04665c4-r0/git/ local_repos/linux
$ cd local_repos/linux

now use git to create a branch or make changes in same branch (creating new branch is recommended)

Now make changes in source code.

To add changes in kernel

cd ~/CodeSetup_Trucrux/sources/meta-trucrux/recipies-kernel/linux
touch linux-trucrux_5.4.bbappend

(ignore if bbappend is already exist)
and append the following in bbappend file

KERNEL_SRC = "git://${BSPDIR}/local_repos/linux-imx;protocol=file"
SRCBRANCH = "< your branch name > "
SRCREV = "The commit id you'd like to use"

now rebuild kernel

$ bitbake linux-trucrux

NOTE: bbappend files apply changes during runtime