How to Compile Forecr Xavier Kernel? | Forecr - Forecr.io

How to Compile Forecr Xavier Kernel?

Jetson AGX Xavier | Jetson TX2 NX | Jetson Xavier NX

27 January 2022
ENVIRONMENT

Operating System: Ubuntu 18.04.6 LTS

CPU: AMD Ryzen 9 3900X 12-Core Processor

RAM: 32 GB DDR4 - 3200MHz

In this blog post, we will compile the “forecr_xavier_kernel” for Jetson AGX Xavier Series, Xavier NX & TX2 NX modules. First, we will install the required packages. Then, we will download the kernel source repository and compile it. Finally, we will export the binaries.

Installing the Development Packages

First of all, install some development packages on your host PC(git, build-essential, ncurses-dev, xz-utils, bzip2, libssl-dev, bc, flex, libelf-dev, bison) with this command:


sudo apt install git build-essential ncurses-dev xz-utils bzip2 libssl-dev bc flex libelf-dev bison vim-common unzip wget


Select the right JetPack version from here. In this tutorial, we will continue to the “32.6.1” version.


Then, download the GCC archive to compile the kernel sources:


Create “l4t-gcc” folder in your $HOME directory and extract the GCC archive into it (or you can extract it in another folder as well).

Downloading & Compiling the Kernel

Our custom kernel source shared from here. You can check the latest published JetPack versions on it.


Now, download the kernel source with this command below (Its location does not require in a specific path):


git clone -b {JetPack Version} https://github.com/mistelektronik/forecr_xavier_kernel.git

For this tutorial, we cloned the “4.6” version of JetPack.


git clone -b Jetpack-4.6 https://github.com/mistelektronik/forecr_xavier_kernel.git


Then, let’s check the “environment_nvidia” file.

Be careful about “CROSS_COMPILE” environment’s definition. If you located the GCC compiler in another path, you should update this environment (In our setup, we do not need to change it).


Open a new terminal on this folder and type these commands to set the environment: 


cd ./kernel/kernel-4.9/
source ../../environment_nvidia


Now, it’s time to compiling the kernel for different device types. 


    • For DSBOARD_XV2 with AGX Xavier or AGX Xavier Industrial SoM, type these commands below:


make ARCH=arm64 O=$HOME/kernel_out_dsboard_xv2 dsboard_xv2_defconfig
make ARCH=arm64 O=$HOME/kernel_out_dsboard_xv2 -j$(($(nproc)-1))


    • For DSBOARD_NX2 with Xavier NX or TX2 NX SoM, type these commands below:


make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2 dsboard_nx2_defconfig
make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2 -j$(($(nproc)-1))


    • For MILBOARD_XV with AGX Xavier or AGX Xavier Industrial SoM, type these commands below:


make ARCH=arm64 O=$HOME/kernel_out_milboard_xv milboard_xv_defconfig
make ARCH=arm64 O=$HOME/kernel_out_milboard_xv -j$(($(nproc)-1))


At this point, we compiled the kernel source for DSBOARD-NX2 with Xavier NX SoM.


A few minutes later …

Exporting the Binaries

After the kernel compiling progress ended, we can move on to export the BSP files (Image and DTB file). 


    • For DSBOARD_XV2 with AGX Xavier SoM, type these commands below:


mkdir $HOME/kernel_out_dsboard_xv2_agx
cp $HOME/kernel_out_dsboard_xv2/arch/arm64/boot/Image $HOME/kernel_out_dsboard_xv2_agx/Image
cp $HOME/kernel_out_dsboard_xv2/arch/arm64/boot/dts/tegra194-p2888-0001-dsboard-xv2-0000.dtb $HOME/kernel_out_dsboard_xv2_agx/tegra194-p2888-0001-p2822-0000.dtb


    • For DSBOARD_XV2 with AGX Xavier Industrial SoM, type these commands below:


mkdir $HOME/kernel_out_dsboard_xv2_agxi
cp $HOME/kernel_out_dsboard_xv2/arch/arm64/boot/Image $HOME/kernel_out_dsboard_xv2_agxi/Image
cp $HOME/kernel_out_dsboard_xv2/arch/arm64/boot/dts/tegra194-p2888-0008-dsboard-xv2-0000.dtb $HOME/kernel_out_dsboard_xv2_agxi/tegra194-p2888-0008-p2822-0000.dtb


    • For DSBOARD_NX2 with Xavier NX SoM, type these commands below:


mkdir $HOME/kernel_out_dsboard_nx2_xavier
cp $HOME/kernel_out_dsboard_nx2/arch/arm64/boot/Image $HOME/kernel_out_dsboard_nx2_xavier/Image
cp $HOME/kernel_out_dsboard_nx2/arch/arm64/boot/dts/tegra194-p3668-dsboard-nx2-0000.dtb $HOME/kernel_out_dsboard_nx2_xavier/tegra194-p3668-all-p3509-0000.dtb


    • For DSBOARD_NX2 with TX2 NX SoM, type these commands below:


mkdir $HOME/kernel_out_dsboard_nx2_tx2
cp $HOME/kernel_out_dsboard_nx2/arch/arm64/boot/Image $HOME/kernel_out_dsboard_nx2_tx2/Image
cp $HOME/kernel_out_dsboard_nx2/arch/arm64/boot/dts/tegra186-p3636-0001-p3509-0000-a01-dsboard-nx2.dtb $HOME/kernel_out_dsboard_nx2_tx2/tegra186-p3636-0001-p3509-0000-a01.dtb
wget https://github.com/mistelektronik/forecr_blog_files/blob/master/tegra186-bpmp-p3636-0001-a00-00.zip?raw=true -O $HOME/kernel_out_dsboard_nx2_tx2/tegra186-bpmp-p3636-0001-a00-00.zip
unzip $HOME/kernel_out_dsboard_nx2_tx2/tegra186-bpmp-p3636-0001-a00-00.zip
rm $HOME/kernel_out_dsboard_nx2_tx2/tegra186-bpmp-p3636-0001-a00-00.zip


    • For MILBOARD_XV with AGX Xavier SoM, type these commands below:


mkdir $HOME/kernel_out_milboard_xv_agx
cp $HOME/kernel_out_milboard_xv/arch/arm64/boot/Image $HOME/kernel_out_milboard_xv_agx/Image
cp $HOME/kernel_out_milboard_xv/arch/arm64/boot/dts/tegra194-p2888-0001-milboard-xv-0000.dtb $HOME/kernel_out_milboard_xv_agx/tegra194-p2888-0001-p2822-0000.dtb


    • For MILBOARD_XV with AGX Xavier Industrial SoM, type these commands below:


mkdir $HOME/kernel_out_milboard_xv_agxi
cp $HOME/kernel_out_milboard_xv/arch/arm64/boot/Image $HOME/kernel_out_milboard_xv_agxi/Image
cp $HOME/kernel_out_milboard_xv/arch/arm64/boot/dts/tegra194-p2888-0008-milboard-xv-0000.dtb $HOME/kernel_out_milboard_xv_agxi/tegra194-p2888-0008-p2822-0000.dtb


At this point, we proceeded to export the kernel source for DSBOARD-NX2 with Xavier NX SoM.


You can use these exported files for installation guide of existing device. The following links have prepared for JetPack-4.6 (For other types of JetPack version, only the working directories differs from this situation). 


At the installation guide, the exported files are using instead of precompiled ones.


    • For DSBOARD_XV2 with AGX Xavier or AGX Xavier Industrial SoM, follow this guide.


    • For DSBOARD_NX2 with Xavier NX SoM, follow this guide.


    • For DSBOARD_NX2 with TX2 NX SoM, follow this guide.


    • For MILBOARD_XV with AGX Xavier or AGX Xavier Industrial SoM, follow this guide.


Thank you for reading our blog post.