Linux Kernel - Compile and Install¶
Critical Link Kernel Repository¶
Critical Link recommends using the linux4.19
branch on our git server: git://support.criticallink.com/home/git/linux-mityarm-335x.git (Gitweb)
Install Kernel Build Prerequisites¶
The following packages must be installed on your host Linux system in order to build the kernel: libyaml-devel/libyaml-dev
Configuring the Kernel Build Environment¶
If the MDK is installed to the default directory:
source /opt/criticallink/mitysom-335x_XXXX-XX-XX/environment-setup-XXXX-criticallink-linux-gnueabi
Building the Kernel¶
Clone the repository from Critical Link (please replace the X's with your desired branch):
git clone git://support.criticallink.com/home/git/linux-mityarm-335x.git cd linux-mityarm-335x git checkout -b linuxX.XX origin/linuxX.XX
Note: You may need to run
git fetch
if the branch wasn't cloned.
Configure the build for the Development Kit Baseboard
make mitysom-335x-devkit_defconfig
Optional: Customize the kernel
make menuconfig
Build the kernel image
make -j$(nproc) zImage
For a faster build, add "
-j$(nproc)
" to build with multiple threads, @$(nproc) will use as many threads as the building machine has cores.
Make the kernel modules
make -j$(nproc) modules make INSTALL_MOD_PATH=$PWD/../rootfs/ modules_install
This will build the selected kernel modules and then install them under
../rootfs/
. You can change this path to change where the modules will install. For example, you may have the build install directly to an SD card. (Note: Make sure you include the INSTALL_MOD_PATH
variable. Otherwise, the kernel Makefile will attempt to install these modules into your host machine's root filesystem. You probably do NOT want this!)
After running the modules_install
command, the kernel modules will be in, for example, ../rootfs/lib/modules/4.19.38-gf4a1a195ea50-dirty
. The actual directory name may be different due to differences in your kernel version. You must copy the directory in ../rootfs/lib/modules
to your filesystem under /lib/modules
.
Make device tree blobs (DTB)
make -j$(nproc) dtbs
You will find the compiled DTBs in
arch/arm/boot/dts
. Note: These will be in the same folder as the source files. Make sure to use the
.dtb
file and not the .dts
or .dtsi
.
In most cases, you will need to move your dtb file to the boot partition on your filesystem (or create a fitImage as described in the Flattened Image Tree section).
Install PowerVR SGX Graphic Modules¶
If you are building your own kernel and want to enable SGX graphics then you must add the modules to the filesystem manually.
Configuring the Build Enviroment¶
Setup the MDK environment:
source <MDK path>/environment-setup-cortexa8hf-neon-criticallink-linux-gnueabi
If the MDK is installed in the default directory:
source /opt/criticallink/mitysom-335x_2020-08-20/environment-setup-cortexa8hf-neon-criticallink-linux-gnueabi
Clone the Git Repository¶
Clone the repository from ti for the 4.19 Kernel (you may need to modify this kernel version to match your kernel):
git clone git://git.ti.com/graphics/omap5-sgx-ddk-linux.git
cd omap5-sgx-ddk-linux
git checkout ti-img-sgx/1.17.4948957/k4.19
Build the Modules¶
cd eurasia_km/eurasiacon/build/linux2/omap_linux
make ARCH=arm TARGET_PRODUCT=ti335x KERNELDIR=$PWD/../../linux-mityarm-335x
Where KERNELDIR points to the directory where you built your kernel.
make -C ${KERNELDIR} SUBDIRS=${PWD}/../../../binary2_omap_linux_release/target/kbuild INSTALL_MOD_PATH=$PWD/../../rootfs modules_install
Where:
- KERNELDIR is the directory where you built your kernel.
- SUBDIRS points to the full path of the kbuild directory.
- INSTALL_MOD_PATH points to the directory containing the root filesystem you are using.
The modules should have been installed under lib/modules/4.4.32-xxxxx/extra/ in your filesystem. The modules that should be in the extra directory are bc_example.ko and pvrsrvkm.ko.
Enabling the Modules¶
At startup you can run the following modprobe command to enable the modules.
modprobe pvrsrvkm
Flattened Image Tree (FIT)¶
The MitySOM-335x MDK includes a FIT image binary. The fitImage contains the devkit kernel and device tree.
Building mkimage¶
Follow the instructions for checking out the MDK U-Boot source, https://support.criticallink.com/redmine/projects/armc8-platforms/wiki/Das_U-Boot_Port_-_Compile_and_Install
Build U-Boot tools
cd <work directory>/u-boot-mityarm-335x make tools
Add U-Boot tools to your path
export PATH=$(pwd)/tools:$PATH
Preparing the FIT source¶
Copy the FIT source to the kernel source directory
cd <work directory>/linux-mityarm-335x cp <MDK path>/sources/fitImage.its ./
The FIT source is provided by Yocto and has a slightly different set up than the kernel source.
Open fitImage.its
and change the following line:
data = /incbin/("linux.bin");
to
data = /incbin/("arch/arm/boot/zImage");
Building the FIT¶
Run mkimage
mkimage -f fitImage.its fitImage
Go to top