Project

General

Profile

Building the Linux Kernel

Before You Begin

There are multiple ways to customize and compile the Linux kernel for your project. Please try to build the kernel as-is with no changes before you add your customizations. This will ensure your environment and toolchain are setup correctly.

  1. Docker Build - Build using a Docker image (as described in Docker Build Environment )
  2. Linux Manual Install - You can use a previously compiled ARM toolchain provided by ARM by installing it on a Linux system.
  3. Yocto Environment - If you are using the docker environment and Yocto for your filesystem, you can use its tools to customize and build the kernel.

In most cases, you will use one of the first three options to build the kernel for Critical Link development kit. Then, once you have everything working you can integrate your custom code into the kernel source.

Critical Link recommends using the mitysom-linux-6.1.y branch on our git server: https://support.criticallink.com/git/linux-ti.git.

Other branches seen on the repository should not be considered stable, and are used for internal feature development.

Kernel Build - Docker

See Docker build environment for details on how to setup and install the Docker build environment. Once that is installed, you can build the kernel using the following commands:

git clone --branch mitysom-linux-6.1.y https://support.criticallink.com/git/linux-ti.git
cd linux-ti
docker run --rm --volume "$PWD:/work" --workdir=/work mitysom_ubuntu:22.04 ./62xx-build.sh 

Please refer to the "Verifying Your Kernel Build" section of this wiki page to verify your build.

Kernel Build - Linux Manual Install

Click here to view instructions...

Kernel Build - Yocto

Click here to reveal details

Verifying Your Kernel Build and Next Steps

If successful, the kernel build creates multiple outputs:

+ ls -l /work/build-mitysom62x/arch/arm64/boot/Image
-rw-r--r-- 1 user mitysom 26069504 May 16 09:16 /work/build-mitysom62x/arch/arm64/boot/Image
+ strings /work/build-mitysom62x/vmlinux
+ grep 'Linux version'
Linux version 6.1.46-g19dec3325ad7 (user@a8b7d2d76252) (aarch64-none-linux-gnu-gcc (Arm GNU Toolchain 11.3.Rel1) 11.3.1 20220712, GNU ld (Arm GNU Toolchain 11.3.Rel1) 2.38.20220708) #5 SMP PREEMPT Thu May 16 09:16:14 EDT 2024
+ ls -la /work/build-mitysom62x/arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dtb
-rw-r--r-- 1 user mitysom 67828 May 14 13:09 /work/build-mitysom62x/arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dtb

The two files, Image, and k3-am62x-mitysom-devkit.dtb, should be copied to the /boot directory of your root filesystem. Note that this directory is different than the boot partition that contains the U-Boot files.

In addition to the kernel Image and device tree, you will need to copy the compiled kernel modules to your root filesystem. Assuming your root filesystem is on a mounted SD card at /run/media/user/root, the modules can be installed using:

cp -r build-mitysom62x/rootfs/lib/modules/* /run/media/user/root/lib/modules/

Note: Several out-of-tree kernel modules are built by Yocto and are needed for some peripherals like the gpu or m4/pruss communication. This extra directory should be copied from the previous /lib/modules directory to the newly created directory as well.

When the kernel boots, it will display the build date and time. Please check this to make sure your new kernel files are being used.

For example, here is an example boot log. Note the kernel revision and build time displayed in the first lines of the kernel boot:

Linux version 6.1.46-gd28abd4af0 (oe-user@oe-host) (aarch64-oe-linux-gcc (GCC) 11.4.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Wed Apr 24 13:13:07 UTC 2024

Additional Scripts

Several additional scripts are provided to do helpful things.

62xx-build-dts.sh - Builds the dtbs.
62xx-menuconfig.sh - Launches the kernel's "menuconfig" so you can pick what parts get built.
62xx-copy.sh - Copies the files to a locally mounted SD card (assumed to be at /media/$USER).
62xx-push.sh - Push the files to a board over network. You must supply a connection string as the first argument (eg root@<board ip address> ) or configure a ssh host target.

Customizing the Kernel for your Application

Now that you can build the kernel, you can customize the kernel source code for your specific application.

For most projects, you will want a custom defconfig and a custom pinmux. Example defconfigs can be found in the arch/arm64/configs/ directory. It is recommended that you start with a similar board as a reference for your own configuration. You will need to update the 62xx-build.sh script to use your custom defconfig file (search for defconfig to find the relevant string).

An example pinmux for Critical Link's development board can be found in the devkit device tree at arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dts.

Please contact Critical Link at if you need help with customizing your defconfig and pinmux for your application. You may also use our forums to ask any questions about custom configurations.

Go to top
Add picture from clipboard (Maximum size: 1 GB)