Skip to content

Build new Kernel on EdgeKit

Saber Kaygusuz edited this page Jun 8, 2023 · 7 revisions

General

Sometimes there are missing some kernel modules, which we need for development and further for deployment. For the development or adaption-phase of your use-case we would recommend this tutorial, to flexible build the adjusted kernel Image on the EdgeKit itself. For example if you need the Wireguard module.

Step 1: Prepare environment on the EdgeKit

This procedure needs some space left on the EdgeKit, make sure you have at least 20GB free. First of all we're creating a new folder in the home directory:

cd && mkdir kernel && cd kernel

Also we're installing some dependencies for this further steps:

sudo apt-get install libncurses5-dev libssl-dev

Now we have to download the kernel source files directly from NVIDIA, for that please check which Release you've installed on your EdgeKit with

cat /etc/nv_tegra_release:

e.g. Output: # R35 (release), REVISION: 3.1, GCID: 32827747, BOARD: t186ref, EABI: aarch64, DATE: Sun Mar 19 15:19:21 UTC 2023

The release (R35) and the revision (3.1) is necessary for downloading the correct source files with the following structure:

wget https://developer.nvidia.com/downloads/embedded/l4t/rXX_release_vYYY/sources/public_sources.tbz2/ -O public_sources.tar.gz

XX = release e.g. 35

YYY = revision with dot as seperation e.g. 3.1

So in this example we would have following command: wget https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v3.1/sources/public_sources.tbz2/ -O public_sources.tar.gz

After downloading the sources, we're extract them and enter the correct directory:

tar xvf public_sources.tar.gz 
cd Linux_for_Tegra/source/public/ 
tar -xvjf kernel_src.tbz2 
cd kernel/kernel-5.10 

Step 2: Configuring the kernel modules

First of all we're taking the default kernel configuration as a basis with the following command:

sudo zcat /proc/config.gz > .config

Then we're switching to configuration mode (please change the path if you're configuring another kernel than the 5.10):

make ARCH=arm64 O=/home/edgekit/kernel/Linux_for_Tegra/source/public/kernel/kernel-5.10 menuconfig

Now we're gonna to activate the module, we want to have within the kernel (in this example Wireguard):

Device Drivers  --->
    [*] Network device support  --->
        [*] Network core driver support
        <*>   WireGuard secure network tunnel

Step 3: Building the kernel modules

Now we're gonna to build the kernel modules, this takes a while (1-2 hours).

make olddefconfig 
make prepare 
make modules_prepare 
make -j4 Image && make -j4 modules 
sudo make modules_install

If our kernel is build we have just an Image - file, which we need to replace on our EdgeKit. Herefore we make a backup of the old image file and copy the new file into the /boot/ directory:

mv /boot/Image /boot/Image_Backup
sudo cp arch/arm64/boot/Image /boot/Image 

Now it's time to reboot the system. After rebooting the system you shall have all the kernel modules build in. No data from your user-space will be lost.

Clone this wiki locally