How do I load a new kernel?

Hello! I’m new to rebuilding kernels. I just followed the help given here, and was directed here to finish up. I was told to mention:

  • I’ve changed the Image, modifying a handful of features with =y
  • L4T release Orin NX # R35 (release), REVISION: 4.1, GCID: 33958178, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug 1 19:57:35 UTC 2023
  • I want to keep the original kernel as a backup, and want to create an alternate boot entry for testing the new kernel.
  • I don’t want to flash the entire system to add the new kernel or modules.

Hi,
We have the guidance for kernel customization in developer guide:
Kernel — Jetson Linux Developer Guide documentation

Please take a look and give it a try.

Hello, @DaneLLL ! I’ve followed these steps already:

mkdir ~/kernel
cd ~/kernel
export TEGRA_KERNEL_OUT=`pwd`

mkdir ~/modules
cd ~/modules
export TEGRA_MODULES_OUT=`pwd`

export TOP=/usr/src/linux-headers-5.10.120-tegra-ubuntu20.04_aarch64/kernel-5.10

cd ~
vim source_sync.sh
chmod +x source_sync.sh
./source_sync.sh -h
./source_sync.sh -k -t jetson_35.4.1
sudo cp -r ~/sources/kernel/* /usr/src/linux-headers-5.10.120-tegra-ubuntu20.04_aarch64

cd $TOP

make O=$TEGRA_KERNEL_OUT tegra_defconfig
make O=$TEGRA_KERNEL_OUT nconfig
make O=$TEGRA_KERNEL_OUT -j 8 Image
make O=$TEGRA_KERNEL_OUT -j 8 modules
make O=$TEGRA_KERNEL_OUT INSTALL_MOD_PATH=$TEGRA_MODULES_OUT modules_install

That finished successfully.

I need to… replace the kernel at this point? I don’t see anything in the documentation that you’ve linked that captures that step. I’ve never done anything like this, so if you have an ELI5, I’d really appreciate it.

Hi,
If you only have minor modification to kernel image, you may replace

/boot/Image

in the Orin NX system and reboot the device.

For reflashing the kernel partition, please do

  1. Follow Kernel Customization — Jetson Linux Developer Guide documentation
  2. Follow Flashing Support — Jetson Linux Developer Guide documentation

I’m trying something new, but also a bit more aligned with the official docs it would seem. They recommend using nvbuild.sh, so I modified that script to call nconfig and pass a suffix!

nvbuild.sh (4.1 KB)

cd ~
./source_sync.sh -k -t jetson_35.4.1
cp nvbuild.sh nvcommon_build.sh sources

cd sources
./nvbuild.sh -o $TEGRA_KERNEL_OUT -s cilium

This seems to have done the trick building the image, but I can’t seem to test it. I discovered kexec when asking for help back on the turing pi discord. This just hangs, though:

sudo kexec -l $TEGRA_KERNEL_OUT/arch/arm64/boot/Image
sudo kexec -e

Am I missing a step? Is there something else that needs to be passed to kexec to test out this Image? Or did I miss something on the Image build itself??

Hi,
Please follow the steps in document and not to execute additional steps.The steps are validated and if you execute it one by one, it is supposed to work fine.

The steps mention swapping out files in Linux_for_Tegra. That’s what I did when flashing originally. I don’t want to flash the entire system…

I’m currently trying to modify the kernel in-place, essentially. Sorry if I seem dense, but unless the only solution is to re-flash the Orin, the docs you linked don’t answer my question.

If you only want to replace kernel file, then you can just replace /boot/Image on your device.

Hello, Wayne! I’ve rebuilt the Image with new flags using =y and =m. I have a directory with the new bits, but I’d like to test them before bricking my system 😕. Any suggestions?

Hi,

Basically if you changed anything to “=m” in kernel config, it means you want to build it as kernel modules. In that case, if you don’t want to reflash the rootfs, you have to manually copy the new modules + dependencies file to your /lib/modules/<uname -r> directory on your jetson.

And jetson by default is using extlinux to boot. Which means there is a /boot/extlinux/extlinux.conf file. You can read the info there first.

It will tell where the kernel gets loaded. And if you want to recover from your new kernel which gets crashed easily, you can add a backup option in that file. After you add that, you can select which kernel to boot during boot by using UART serial console to interrupt UEFI bootloader.

I was able to kexec the new Image and modules!

I modified nvbuild.sh to run nconfig, append a suffix to LOCALVERSION, and to run modules_install. Updating Kernel of Nvidia Jetson · GitHub.

Now that it’s validated, I think I might just replace /boot/Image and cross my fingers 😅

Thanks for the pointers!

1 Like

Mmmmm, one more question. What are these files, and should I be recreating them? If I just swap the Image, am I going to have any wonkiness?

/boot$ ls
...
Image
Image.t19x
Image.t19x.sig
initrd
initrd.t19x
initrd.t19x.sig
...

Hi,

Generally you only need to swap “Image” and no need to care about the .sig file.

Sig files are only be used when security boot things are enabled.

Could we update nvbuild.sh to include my changes?

nvbuild.sh (4.7 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.