Custom kernel selection on Xavier (Solved)

Hello,

I have built a custom kernel on xavier (using same config as the primary kernel), but I don’t know how or where to an entry for this kernel so that I can select it during boot. I no longer get the U-boot menu to select the kernel to boot from. I also realized that there’s no exlinux.conf file under /boot.

The developer guide that’s provided with the JetPack 4.0 EA has a mention about “how to build custom kernel” but doesn’t mention about configuring/booting with it. I saw mention of extlinux.conf in the “NVIDIA Driver Package Development Guide” under “Kernel Boot Time Optimization->Disable Console Over UART”.

Please let me know how to boot a custom kernel on Xavier.

Does it work just copy and replace the /boot/Image on the device?

Hi,

Thanks for the reply. It should work but would it work with new initrd.img? It should match the kernel version.

Also, our company develops various kernel flavors with the help of in-house created patches applied to the NVIDIA L4T kernel. So, we will need the ability to select different kernels on a boot.

BTW, I have tried to replace extlinux.conf file taken from a TX2 but still the Uboot didn’t present me with the list of kernels to boot from.

Hi anish.aney,

Please take a look at “Jetson-Xavier Boot Flow” in https://developer.nvidia.com/embedded/dlc/l4t-documentation-31-0-1 . There is no u-boot stage now.

Hi Vickyy,

Yes, I realized it while going through the documentation. Is there any way to configure cboot to present list of available kernels to boot from? Will there be uboot component in the final release (as this is EA)?

kernel selection may be supported in upcoming release. uboot won’t be there even in following releases.

Hi vickyy,

Thank you for your reply. I hope the kernel selection is supported in future releases because that’s an easier to test custom kernels. Instead of constantly flashing the system if the new kernel fails to boot, kernel selection helps in recovering the system to NVIDIA’s 4.9.108-tegra kernel and continue working on the fixing of the bad image.

It’s alright if uboot is not part of the boot process. But kernel selection will definitely help us developers.

Thank you again.

I would like to support request to have a kernel selection menu added to the next version of Jatpack/bootloader.

-albertr

Thanks a lot, albertr. I will also request it from my end.

We were also lamenting the lack of u-boot support here.

Where do you get the source for the xavier kernel ?

Hi danpollock,

The download center for Xavier has a link to download the source. It has u-boot, kernel source and few more source tarballs.

The git repositories are located here:

[url]https://nv-tegra.nvidia.com/gitweb/[/url]

The Xavier kernel is kernel-4.9. You’ll also need a number of repositories for the various pieces of the device tree. The Jetpack contains a script, source_sync.sh, that’s supposed to clone the repositories but it looks like this hasn’t been updated for Xavier yet.

Hi growe, The script was fixed. It will be working from the next release.

vickyy, can you publish the fixed script? On this thread or elsewhere on the forum?

-albertr

If you replace SOURCE_INFO with what I have below you should be good to go until the next release officially updates source_sync.sh

SOURCE_INFO="
k:kernel/kernel-4.9:nv-tegra.nvidia.com/linux-4.9.git:
k:kernel/nvgpu:nv-tegra.nvidia.com/linux-nvgpu.git:
k:kernel/nvidia:nv-tegra.nvidia.com/linux-nvidia.git:
k:hardware/nvidia/soc/t18x:nv-tegra.nvidia.com/device/hardware/nvidia/soc/t18x.git:
k:hardware/nvidia/platform/t18x/common:nv-tegra.nvidia.com/device/hardware/nvidia/platform/t18x/common.git:
k:hardware/nvidia/platform/t18x/quill:nv-tegra.nvidia.com/device/hardware/nvidia/platform/t18x/quill.git:
k:hardware/nvidia/soc/t19x:nv-tegra.nvidia.com/device/hardware/nvidia/soc/t19x.git:
k:hardware/nvidia/platform/tegra/common:nv-tegra.nvidia.com/device/hardware/nvidia/platform/tegra/common.git:
k:hardware/nvidia/platform/t19x/common:nv-tegra.nvidia.com/device/hardware/nvidia/platform/t19x/common.git:
k:hardware/nvidia/platform/t19x/galen:nv-tegra.nvidia.com/device/hardware/nvidia/platform/t19x/galen.git:
k:hardware/nvidia/soc/tegra:nv-tegra.nvidia.com/device/hardware/nvidia/soc/tegra.git:
"
SOURCE_INFO+="
u:u-boot:nv-tegra.nvidia.com/3rdparty/u-boot.git:
"

checking with
https://developer.nvidia.com/embedded/dlc/l4t-documentation-31-0-2
steps seem to be:

sudo apt install build-essential bc

mkdir -p $TEGRA_KERNEL_OUT
~/Downloads/sources/public_sources/kernel/kernel-4.9$ make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
make[1]: Entering directory '/home/nvidia/kernel-out'
  HOSTCC  scripts/basic/fixdep
  GEN     ./Makefile

The next question is where do I :
“5. Replace Linux_for_Tera/kernel/Image with:
$TEGRA_KERNEL_OUT/arch/arm64/boot/Image” ?
What is that place where I need to d othe replace? is it a config file? or a folder where I am doing the step 4 make?

Put your Xavier system into recovery mode and then use flash.sh from the Jetpack to flash the kernel.

sudo flash.sh -r -k kernel -K  YOUR_KERNEL_ZIMAGE jetson-xavier mmcblk0p

If I use the patch, what shall I specify for the tag in the prompt below?

Please enter a tag to sync /home/hostpc/Downloads/Xavier/Linux_for_Tegra/sources/kernel/kernel-4.9 source to
(enter nothing to skip): 
Couldn't find tag 0
/home/hostpc/Downloads/Xavier/Linux_for_Tegra/sources/kernel/kernel-4.9 source sync to tag 0 failed!
Downloading default kernel/nvidia source...

Now it thrown multiple "source sync to tag 0 failed! on every element sync , because of the non specified tag, as it seems to me.
The answer has been found in the Documentation:

git tag -l tegra-l4t*

That is supposed to return some value that can be used as the tag.
However, that returns:

git tag -l tegra-l4t*
fatal: not a git repository (or any of the parent directories): .git

It is said In the Documentation:
“When prompted enter a ‘tag’ name, as provided in the release notes”
trying the return of

uname -a

instead
the output is:

4.9.108-tegra

more reference found: https://developer.download.nvidia.com/embedded/L4T/r31_Release_v0.2/EA/Tegra_Linux_Driver_Package_Release_Notes_R31.0.2.pdf
and it appears that the tag can be retrieved from nv-tegra.nvidia Code Review - linux-4.9.git/summary
Shall I put the tag below?

tegra-l4t-r31.0.2

trying with tegra-l4t-r31.0.2 as a tag
the latter tag seems fine, but the sync method doesnt result in the folder
hardware/nvidia/platform/t19x/galen/

well, I managed to flash the OS with newly built kernel, but that doesn’t help with making modules_prepare. Probably I can get a required module v4l2looback built at Host PC and then load it as a separate ko module to kernel somehow, though