Customizing the Linux kernel¶
Introduction¶
This guide demonstrates how to patch and rebuild Debian Linux images.
After customizing the kernel by following the instructions below, you can either build your complete image with var_build_image or you can build the kernel alone by running:
(see the Build Debian from source code page for the initial setup and for more info on using Flexbuild commands).
Requirements¶
Before modifying the Kernel source code, follow steps 1-3.1 of the Build Linux from source code page.
Modifying the Kernel¶
Make the desired changes to the Kernel source code¶
Example:
$ cd ${WORKDIR}/linux-imx
$ vim ./drivers/net/can/m_can/m_can.c
$ vim ./drivers/net/can/m_can/m_can.h
Configuring the Kernel¶
The default kernel configuration file used by Flexbuild is part of the kernel source tree and is located at:
Clean and prepare the kernel:
Customize the kernel configuration:
$ make menuconfig (Ps: Once you finish configuring the Kernel, save it to the .config file.)
$ make savedefconfig
$ mv defconfig arch/arm64/configs/imx8_var_defconfig
Generate a patch¶
Commit the changes locally and generate a patch¶
Build modified Linux¶
Make sure you set up the Flexbuild Docker environment properly. Follow the instructions from step 5 of the Build Debian from source code page.
Add your patches on top of the Variscite source code¶
Flexbuild will retrieve the source code from our default remote repository and apply your patches before building it.
Once the patch is created, copy it to the Linux patch folder, which is inside the Flexbuild directory:
Build Linux individually¶
Do not run any 'git am' or 'git apply' command. That will be done inside the Linux Makefile.
Now, if you're not inside the container, get in with the following commands:
$ cd [...]/flexbuild (Outside Docker environment)
$ . setup.env (Outside Docker environment)
$ bld docker (Outside Docker environment)
$ . setup.env (Inside Docker environment)
Once you've entered the Docker environment, run:
Rebuild Linux¶
Once you've built Linux, a clean step is needed if a rebuild is required:
Then, build Linux normally with: