I’ve encountered an issue with kernel headers on my Jetson TX2. After loading the compiled OS, I see two sets of kernel headers: 4.9.140+ and 4.9.140-tegra. I’m using CONFIG_LOCALVERSION=-tegra.
However, when I run uname -r, it returns 4.9.140+, and this version’s build directory is a symbolic link pointing to an invalid path on my PC, where I originally cross-compiled the OS.
This is causing problems because I’m trying to compile the rtl88x2bu driver, and the compilation process fails to find the necessary kernel headers.
How can I resolve this issue to ensure that only 4.9.140-tegra is used?
You can compile your kernel itself and change it in your tegra. It should compile with the matching name as the modules since you are going to be compiling on the same env.
I’m compiling the kernel, drivers and generating Rootfs using Jetson Jetpack. I followed the nvidia procedure. Basically, after mount SDK, I run the following commands in order to compile kernel:
---------------------------------------
# Variables used to generate complete OS
export LINUX_FOR_TEGRA_PATH="<my pc local path>/Linux_for_Tegra"
export CUSTOM_KERNEL_OUT="$LINUX_FOR_TEGRA_PATH/sources/output"
export KERNEL_SOURCE_PATH="$LINUX_FOR_TEGRA_PATH/sources/kernel/kernel-4.9"
export CROSS_COMPILE=<my pc local path>/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CROSS_COMPILE_TOOL_PATH=<my pc local path>/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin
export ROOTFS_PATH="$LINUX_FOR_TEGRA_PATH/rootfs/"
export KERNEL_IMAGE_PATH="$LINUX_FOR_TEGRA_PATH/kernel"
export DEVICE_TREE_PATH="$KERNEL_IMAGE_PATH/dtb/"
export CONFIG_LOCALVERSION=-tegra
--------------------------------------
# Compilation commands
# Create custom kernel directory
mkdir -p $CUSTOM_KERNEL_OUT
# Apply tegradef_config on custom kernel
make ARCH=arm64 O=$CUSTOM_KERNEL_OUT tegra_defconfig
# Compile kernel
make ARCH=arm64 O=$CUSTOM_KERNEL_OUT -j8 CC="ccache ${CROSS_COMPILE}gcc"
# INSTALLING KERNEL MODULES
sudo make ARCH=arm64 O=$CUSTOM_KERNEL_OUT modules_install INSTALL_MOD_PATH=$ROOTFS_PATH
# BUILDING DEVICE TREE
cd $LINUX_FOR_TEGRA_PATH
sudo ./flash.sh --no-flash -r -k kernel-dtb jetson-tx2 mmcblk0p1"