Flash kernel image on Nvidia TX2

Hi community,

i am trying to rebuild the kernel for NVIDIA TX2 and flash it to my Jetson TX2 dev board.

What i have done:

  1. I set up my host machine with Ubuntu 16.04. , downloaded the JetPack3.2 and followed the install guide:
    https://docs.nvidia.com/jetpack-l4t/index.html#developertools/mobile/jetpack/l4t/3.2/install.htm

So currently i have the latest r28.2 on my TX2 running.

uname -r -> 4.4.38-tegra

  1. First i want to recompile the kernel and only to change the name so that uname -r says-> 4.4.38-myname

  2. what i have done

created a directory named nvidia. Downloaded from nvida site:
gcc-4.8.5-aarch64.tgz
tx2_sources.tbz2

mkdir nvidia
cd nvidia
mkdir tx2
cd tx2
mkdir kernel
mkdir modules
cd ..
tar -xvf gcc-4.8.5-aarch64.tgz
mkdir source
cd source
tar -xvjf tx2_sources.tbz2
cd public_release
tar -xvjf kernel_src.tbz2
cd kernel/kernel-4.4/
export TEGRA_KERNEL_OUT=~/nvidia/tx2/kernel
export TEGRA_MODULES_OUT=~/nvidia/tx2/modules
export ARCH=arm64
export CROSS_COMPILE=~/nvidia/install/bin/aarch64-unknown-linux-gnu-
make mrproper
make O=$TEGRA_KERNEL_OUT tegra18_defconfig
make O=$TEGRA_KERNEL_OUT menuconfig

set the local version under general setup to -myname

make O=$TEGRA_KERNEL_OUT modules -j4
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT -j4
make O=$TEGRA_KERNEL_OUT zImage -j4
make O=$TEGRA_KERNEL_OUT dtbs -j4

i didn’t get any error.

Now i have under

~/nvidia/tx2/kernel/arch/arm64/boot/

the Image file

  1. What is the proper way to flash this kernel image on to my TX2?

Thank you for the help, Br

Hi Joko, after attaching your devkit to the host PC via micro-USB cable and entering the Jetson into Recovery mode, you can run this command to flash the kernel:

sudo ./flash.sh -k kernel jetson-tx2 mmcblk0p1

The flashing tools are included in the L4T Driver Package.

Hi dusty_nv,

thank you for the answer.

1)one thing the link for the L4T Driver Package is linked to:
https://developer.nvidia.com/embedded/dlc/l4t-jetson-tx1-driver-package-28-2-ga
is this correct?

  1. When i flash my image with the flash.sh, what should i do with the modules that i compiled ? Because i have files that are in folder lib/modules/4.4.38-myname.

2.1) there are also some other files do i need to copy them somewhere in order to boot correctly with my custom kernel image 4.4.38-myname

  1. I would like to know if i can have two kernel images on system and to choose between them?

3.1) can i rename the current image to eg. image_gold and add the image that i compiled and then add a second entry into /boot/extlinux/extlinux.conf ??

Thanks.

Sorry, that was my mistake, I meant to link to the TX2 version, I have corrected the link above, here it is: https://developer.nvidia.com/embedded/dlc/l4t-jetson-tx2-driver-package-28-2-ga

You probably have to copy these over to your Jetson manually after flashing the kernel, or you could mount the root filesystem image on the host via loopback, add to the image and slipstream them there, then reflash the entire image.

Using extlinux.conf, I believe you may be able to do this, but I’m not sure myself as I haven’t done this part before.

It is possible to specify an kernel image and a rootfs from extlinux.conf.
You would have to copy your alternate kernel image into boot directory of filesystem of partition /dev/mmcblk0p1 (/boot/Image-test), and edit there the /boot/extlinux/extlinux.conf.
For example, you may have ‘test’ version of your kernel on MMC0:/boot and according rootfs having modules on /dev/sda1 with such extlinux.conf:

TIMEOUT 30
DEFAULT primary
MENU TITLE p2771-0000 eMMC boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

LABEL test
      MENU LABEL primary test
      LINUX /boot/Image-test
      APPEND ${cbootargs} root=/dev/sda1 rw rootwait rootfstype=ext4

By default, this would start the standard image and rootfs on MMC0p1.
If you use a serial console, you would be able to choose the second entry, booting Image-test kernel and then mounting /dev/sda1 as rootfs (assuming your kernel has builtin drivers for your drive and ext4 filesystem support).
When you are sure it works, you can set this as default by editing the second line of MMC0p1:/boot/extlinux/extlinux.conf into DEFAULT test.

Hi all,

thanks for the replay.

we managed to compile the kernel

make O=$TEGRA_KERNEL_OUT zImage -j4
make O=$TEGRA_KERNEL_OUT dtbs -j4
make O=$TEGRA_KERNEL_OUT modules -j4
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT -j4

and then apply binearies

sudo ./apply_binaries.sh

and flash to TX2

sudo ./flash.sh jetson-tx2 mmcblk0p1

The TX2 is starting ok.

but one thing i don’t understand, when doing the:

make O=$TEGRA_KERNEL_OUT dtbs -j4

in the output folder $TEGRA_KERNEL_OUT/arch/arm64/boot/dts i get 22 different .dts files.

eg.

tegra186-quill-e3313-1000-a00-00-e2598.dtb
tegra186-quill-p3310-1000-c03-00-base.dtb
tegra186-quill-p3310-1000-c03-00-dsi-dp.dtb
...

do I have to copy only the

tegra186-quill-p3310-1000-c03-00-base.dtb

.dtb file to

Linux_for_Tegra/kernel/dtb/

to flash ?? or i need to copy all 22 files??

What for are the other .dtb files ??

Br.

Just the one file. There are many TX2 platforms, some with different carrier boards, some with different variations on the actual SoC (e.g., we now have the TX2i), and so there are multiple trees. You use one tree, but have a choice among them for your situation.

Watch the flash operation and verify logs or output from the flash that the correct file was used.