TX2 kernel build

Hi,

Today I built my first kernel for TX2. As part of JetPack, in 64_TX2/Linux_for_Tegra_tx2/kernel, there are 2 archives: kernel_headers.tbz2 and kernel_supplements.tbz2.

Could someone explain to me how to generate them? I’m new to this.

kernel_headers.tbz2 ends up in /usr/src/linux-headers-4.4.38-tegra on the target. I need to build a kernel module from third parties hardware. This manufacturer’s build script searches files in /usr/src/linux-headers-$(uname -r) so I need to be able to provide this folder.

I’m not using the default kernel since I use a different carrier than jetson, and this folder is not provided by the manufacturer.

Thanks!

Answering to my own question. I found a great article describing the whole process:
http://developer.ridgerun.com/wiki/index.php?title=Compiling_Tegra_X1_source_code

But I found it really not generate kernel_supplements.tbz2, as you can see in the new link Compiling Jetson TX1/TX2 source code, there are two decriptions below,

  1. Besides creating the modules and the kernel image you need to create again your kernel_headers.tbz2 file (needed by Jetpack). By default when you patch the kernel code and you don’t check your changes in the kernel will add a -dirty suffix to the release version (check ls $DEVDIR/images/modules/lib/modules/ for example). For this specific reason you need to generate your headers tarball again changing it the release version.
    cd $DEVDIR/kernel
    tar -xf kernel_headers.tbz2
    export KERNEL_HEADERS_NAME=linux-headers-4.4.38-tegra
    mv $KERNEL_HEADERS_NAME linux-headers-$KERNEL_MODULES_NAME
    tar -cjf kernel_headers_custom.tbz2 linux-headers-$KERNEL_MODULES_NAME
    mv kernel_headers_custom.tbz2 $DEVDIR/images/packages
    rm -rf linux-headers-$KERNEL_MODULES_NAME
  2. Finally overwrite the default images with your own images to install and boot them using jetpack

cd $DEVDIR/images
cp -rf arch/arm64/boot/Image arch/arm64/boot/zImage packages/kernel_supplements.tbz2 $DEVDIR/kernel/
cp -rf packages/kernel_headers_custom.tbz2 $DEVDIR/kernel/kernel_headers.tbz2

What it is really do is copy the kernel_headers.tbz2 in $DEVDIR/kernel/ through $DEVDIR/images/packages back to $DEVDIR/kernel/. So it does nothing.