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.0 kernel independently, without The Yocto Project. This can then serve as a starting point for kernel development.
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.
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:
cd ~ git clone -b v6.1.33-phy3 https://github.com/phytec/linux-phytec-ti.git cd linux-phytec-ti
If you plan to use menuconfig to customize your kernel configuration, you’ll need the following additional Host dependencies:
sudo apt-get install libncurses5-dev libncursesw5-dev
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:
make phytec_ti_platform.config phytec_ti_defconfig #configure the kernel build system to use PHYTEC's provided kernel configuration for the default phyCORE-AM62x development kit make menuconfig #make kernel configuration changes (enable/disable drivers) make savedefconfig #save the kernel configuration from .config to a file named "defconfig" make #build everything (Image, DTB, kernel modules, etc): sudo make INSTALL_MOD_PATH=/media/user/root/ modules_install #install kernel modules to the mounted bootable SD Card
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.