Building the Linux Kernel¶
- Table of contents
- 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.
- Docker Build - Build using a Docker image (as described in Docker Build Environment )
- Linux Manual Install - You can use a previously compiled ARM toolchain provided by ARM by installing it on a Linux system.
- 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-5.10.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 --single-branch --branch mitysom-linux-5.10.y https://support.criticallink.com/git/linux-ti.git $ cd linux-ti $ docker run --rm --volume "$PWD:/work" --workdir=/work mitysom_ubuntu:22.04 ./62x-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¶
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 18616832 Mar 11 20:59 /work/build-mitysom62x/arch/arm64/boot/Image + strings /work/build-mitysom62x/vmlinux + grep 'Linux version' Linux version 5.10.158-00039-gd6107ae8c8d7 (user@a8b7d2d76252) (aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025, GNU ld (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 2.33.1.20191209) #1 SMP PREEMPT Sat Mar 11 20:53:13 UTC 2023 + ls -la /work/build-mitysom62x/arch/arm64/boot/dts/ti/k3-am62x-mitysom-devkit.dtb -rw-r--r-- 1 user mitysom 62495 Mar 11 20:53 /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.
Note: We've added a 62x-push.sh script to the kernel directory to make it easier to push changes to a running board. Feel free to modify and use it. Note it expects the build to be run with the options from the build.sh script.
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 5.10.158-00039-gd6107ae8c8d7 (user@a8b7d2d76252) (aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025, GNU ld (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 2.33.1.20191209) #1 SMP PREEMPT Sat Mar 11 20:53:13 UTC 2023
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 62x-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 info@criticallink.com 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