Pre-requisites
In order to build a new kernel image, you will need the following:- an SD card with an already functioning version of the Linux kernel and an OS such as Debian 12 (bookworm);
- the ability to connect to the device, either in headless mode via serial or ethernet or by attaching peripherals (monitor, keyboard, mouse) to the board;
- an internet connection (see section on networking if you need to set this up) if you wish to clone the kernel sourcecode from the online repository (alternatively, you could copy the source repository onto the SD card before mounting to the board);
- the following packages installed from the Debian package repository:
u-boot-tools,<FIND FULL LIST>.
Building the new kernel image
Get the kernel source
If you did not copy the source repository to the SD card, you will need to clone the repository containing the tuned Linux kernel from the embeddedTS GitHub:Create a staging directory
Rather than building everything directly inside the cloned repository, we will specify a new directory to collect the outputs of each stage of the kernel build. This helps to keep everything organised in case you need to rebuild the kernel in the future.<suffix> with some unique identifier for the kernel build, e.g., -avert. This suffix will be used again when configuring the kernel.
If, for any reason, you do not complete all of these steps in a single
session, you may need to re-export the
KERNEL_BUILD_OUT variable.Create an initial configuration file
Navigate to the directory containing the kernel source code (likely~/linux-lts). Create a new config for the specific i.MX6 processor used on the TS board:
Edit the configuration file
This is the point when you can select which additional modules/utilities you would like to enable in the kernel. In addition, you should specify theCONFIG_LOCALVERSION here to match the suffix you chose above (e.g., -avert).
Build the kernel image and modules
This stage can take a significant amount of time (> 1 hour). In order to ensure this proceeds as quickly as possible, be sure to include the-j flag, which sets the number of cores to be used while compiling the image. For example, for the quad-core model of the 7970, we can use -j 4.
$KERNEL_BUILD_OUT/arch/arm/boot/Image. However, this image is both too large and not directly compatible with U-boot. In order to get the required uImage (and zImage), run:
LOADADDR, which is a memory address used by the U-boot bootloader to find the image. This can be checked by booting into U-boot (hold down the reset pin while powering the 7970).
Repeat the process to build the modules:
Install the new image and modules
Once complete, you should have everything needed, the last thing to do is to install the new image and modules. Navigate to the directory containing the freshly built image and modules and install with elevated privileges:uImage/zImage files. Make a backup of the current files (found in /boot), then copy the two files with elevated privileges:
uImage and zImage files back to the /boot directory.
If everything boots, you can check the new kernel has been correctly loaded by running:
CONFIG_LOCALVERSION.
