Skip to content

Latest commit

 

History

History
86 lines (69 loc) · 3.49 KB

jetson_nano_modules_cross.md

File metadata and controls

86 lines (69 loc) · 3.49 KB

Cross compilation from HOST(linux x86_64) to TARGET(linux aarch64) kernel module for the NVIDIA Jetson Nano

  1. The Jetson host OS, based on Ubuntu 18.04, needs to be up and running (install, boot, login directly or ssh remotely). Please follow these steps if such Linux install is not done yet and therefore you cannot boot on the Jetson like an usual workstation. We have informations to gather from it. Once ready, natively boot the Jetson board and find it's network address:
hostname -I | awk '{print $1}'
  1. From now on we will access the Jetson remotely using the network address just found. Connect to the remote/target Jetson board from your local machine/host, eg using ssh:
  1. Check the Jetson version. On the remote/target Jetson platform, execute and note aside:
jetson:~$ cat /etc/nv_tegra_release
# R32 (release), REVISION: 6.1, GCID: 27863751, BOARD: t210ref, EABI: aarch64, DATE: Mon Jul 26 19:20:30 UTC 2021
  1. Go back to the host machine. Unpack the aarch64-linux-linux64 (from AdaCore download page: https://gt3-int-prod-1.adacore.com/#/downloads) cross toolchain somewhere. Note the path of its cross binaries location, eg. unpacking GNAT Pro on my machine/host at ~/Downloads/gnat-22.1 the binaries end up at ~/Downloads/gnat-22.1/gnatpro-22.1-aarch64-linux-linux64-bin/bin

  2. On the local machine/host create a base folder for the cross compilation and kernel output folder, eg. ~/cross_base and move to it.

mkdir ~/cross_base
mkdir ~/cross_base/output
cd ~/cross_base
  1. Get the linux sources, Linux for Tegra (L4T) (from NVIDIA download page: https://developer.nvidia.com/embedded/downloads) eg. from the output at 2. I download the kernel sources identified as L4T Driver Package (BSP) Sources 32.6.1 and rename for our context.
wget https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/sources/t210/public_sources.tbz2 -O tegra_sources.archive
  1. Extract sources, eg. (will create Linux_for_Tegra folder):
tar -xvf tegra_sources.archive
  1. Unpack the kernel sources:
tar -xjf ~/cross_base/Linux_for_Tegra/source/public/kernel_src.tbz2
  1. From remote/target Jetson command prompt, download its original kernel config to local machine/host, eg (xyz.xyz.xyz.xyz being the address of my local machine/host):
jetson:~$ sudo scp /proc/config.gz [email protected]:~/cross_base/output
  1. Extract the config.gz content to .config file:
gzip -d -c ~/cross_base/output/config.gz > ~/cross_base/output/.config
  1. Set ENV_PREFIX, eg. using GNAT PRO binaries on my machine/host it becomes:
export ENV_PREFIX="~/Downloads/gnat-22.1/gnatpro-22.1-aarch64-linux-linux64-bin/bin"
  1. Prepare the modules, eg:
make ARCH=arm64 CROSS_COMPILE=~/Downloads/gnat-22.1/gnatpro-22.1-aarch64-linux-linux64-bin/bin/aarch64-linux-gnu- O=~/cross_base/output -C ~/cross_base/kernel/kernel-4.9 modules_prepare
  1. Set "kernel_sources_abspath" in flash_led_jetson_nano.json, eg.
...
"kernel_sources_abspath" : "~/cross_base/output",
...
  1. Set "toolchain_type" in flash_led_jetson_nano.json, eg.
...
"toolchain_type" : "cross",
...
  1. Set "toolchain_abspath" in flash_led_jetson_nano.json, eg.
...
"toolchain_abspath" : "~/Downloads/gnat-22.1/gnatpro-22.1-aarch64-linux-linux64-bin/bin",
...