How to Compile Forecr Nano Kernel? - Forecr.io

How to Compile Forecr Nano Kernel?

Jetson Nano

28 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_nano_kernel” for Jetson Nano module. 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, ex, 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


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_nano_kernel

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


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


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 DSBOARD-NX2 with Jetson Nano SoM. Please type these commands below:


make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2_nano dsboard_nx2_nano_defconfig
make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2_nano -j$(($(nproc)-1))


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) with these commands:


mkdir $HOME/kernel_out_dsboard_nx2_nano_bsp
cp $HOME/kernel_out_dsboard_nx2_nano/arch/arm64/boot/Image $HOME/kernel_out_dsboard_nx2_nano_bsp/Image
cp $HOME/kernel_out_dsboard_nx2_nano/arch/arm64/boot/dts/tegra210-p3448-0002-dsboard-nx2-b00.dtb $HOME/kernel_out_dsboard_nx2_nano_bsp/tegra210-p3448-0002-p3449-0000-b00.dtb


You can use these exported files for the installation guide from here. It has 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.


Thank you for reading our blog post.