Standalone Kernel Development
Building the BSP in its entirety has a fairly large learning curve and significantly larger system requirements on the Host Machine when compared to building just the individual components of the image. For these reasons (and others), the Yocto Project can be very cumbersome to use as your primary means of developing things like the Linux kernel by itself. When possible, it is best to clone the kernel repo independently of the overall BSP in order to customize it for your application requirements and export your changes back into the BSP to include them into your production image.
The goal of this guide is to provide you with a quick reference for setting up and building the stock BSP-Yocto-Ampliphy-AM62x-PD23.2.1 kernel independently, without The Yocto Project. This can then serve as a starting point for kernel development.
Note
Eventually, you will have a set of patches that modify the Linux kernel such that phyCORE-AM62x SOM is able to meet your unique application requirements. This collection of patches should eventually be consolidated into a custom Meta-Layer specific to your system and added in a modular way to the BSP so that they are incorporated into the production-ready software image automatically. Checkout the Create a Custom Meta-Layer guide when you are ready to begin finalizing your production image.
Requirements
In order to build the kernel repository independently of the overall BSP, you will need to install a compatible toolchain for the phyCORE-AM62x.
A toolchain is conveniently included in the pre-built SDK so head over to the Install The SDK guide and run through those steps first if you haven’t already done so.
Remember to source the cross-compilation environment before attempting to build the kernel. You’ll have to do this with every nw terminal session, even if you have previously installed the SDK. You can’t complete this guide without first doing so.
Clone the Linux kernel
Clone the PHYTEC kernel repository using the release tag corresponding to the BSP version:
host:~$ cd ~
host:~$ git clone -b v6.1.69-09.02.00.005-phy3 https://github.com/phytec/linux-phytec-ti.git
host:~$ cd linux-phytec-ti
If you plan to use menuconfig to customize your kernel configuration, you’ll need the following additional Host dependencies:
host:~$ sudo apt-get install libncurses5-dev libncursesw5-dev
Make
The kernel build system leverages various environment variables and makefiles to build the kernel and it’s components for a specific target architecture. Reference the following commands when building for the phyCORE-AM62x:
Configure the kernel build system to use PHYTEC’s provided kernel configuration for the default phyCORE-AM62x development kit
host:~$ make phytec_ti_defconfig phytec_ti_platform.config
Make kernel configuration changes (enable/disable drivers)
host:~$ make menuconfig
Save the kernel configuration from .config to a file named “defconfig”
host:~$ make savedefconfig
Build everything (Image, DTB, kernel modules, etc):
host:~$ make
Install kernel modules to the mounted bootable SD Card
host:~$ sudo make INSTALL_MOD_PATH=/media/user/root/ modules_install
The new Image kernel binary can be found at arch/arm64/boot/Image and the device tree blobs (and overlays) can be found at arch/arm64/boot/dts/ti/.
For installing the new kernel image and device tree files, head over to the SD Card guide.