Save a copy of your current Jetson’s “/proc/config.gz”. Start with that. You do need to learn to cross compile to build a kernel for the TX1, but you can just get the kernel source here (you don’t need to use git)…be sure your current release matches the kernel source:
https://developer.nvidia.com/embedded/linux-tegra-archive
If you are using the current release it will be R24.2.1 from here (look for kernel source):
https://developer.nvidia.com/embedded/linux-tegra
Note that this same page has a “Documentation” download which includes compile instructions:
https://developer.nvidia.com/embedded/dlc/l4t-documentation-24-2-1
The URL you gave seems to concentrate on using the most recent sources via git, but also mentions the documentation download I just gave. You might want to skim that documentation first (for kernel build), then look at the article you mentioned for other details.
I already have tools installed, and those tools are different than what an Ubuntu user would use (I’m using Fedora, I manually installed a lot of different compilers…it’s easier to just use the ones available as standard packages on Ubuntu if you have that).
Some environment variables important to set (my specific case is just an example, yours will not match exactly):
export CROSS_COMPILE=/usr/local/aarch64-linux-gnu/gcc-linaro-5.3-2016.02-rc1/bin/aarch64-linux-gnu-
export CROSS32CC=/usr/local/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02/bin/arm-linux-gnueabihf-gcc
export ARCH=arm64
You probably also want to pre-create an output location, e.g.:
mkdir ~/build
mkdir ~/build/kernel
mkdir ~/build/modules
mkdir ~/build/firmware
export TEGRA_KERNEL_OUT=~/build/kernel
export INSTALL_MOD_PATH=~/build/modules
export INSTALL_FW_PATH=~/build/firmware
(you won’t actually build firmware, but it is in my notes)
Place your .config at “~/build/kernel”. Make sure the CONFIG_LOCALVERSION matches…either edit the file or use something like the “make O=$TEGRA_KERNEL_OUT nconfig” and search for CONFIG_LOCALVERSION (this was the suffix from the running Jetson’s “uname -r”).
Note that there are edits needed for this kernel to build. The edits may already exist in some versions, I’ll mention below more about that.
Technically you don’t need to build the whole kernel, but it does some configuration and is preferable as an error check. Actual build (after some edits…the nconfig stage is where you look for your driver…commands are from the kernel source tree):
make mrproper
make O=$TEGRA_KERNEL_OUT mrproper
make O=$TEGRA_KERNEL_OUT nconfig
make O=$TEGRA_KERNEL_OUT Image
make O=$TEGRA_KERNEL_OUT modules
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT
…take a look in $TEGRA_MODULES_OUT…you’ll get to a subdirectory with the actual modules and within that somewhere will be the module of interest…this will get manually copied to the analogous location on the Jetson and it’ll be done (you’ll probably reboot the Jetson even though you could just manually run commands to insert the module).
Remember, I gave the path to some tools that are my version on Fedora, adjust paths to your tools.
About fixes needed for the source to compile…check the following within your kernel source…some may already be fixed:
# R24.1, NOTE: drivers/base/Kconfig, line 234, missing double quote to close string.
# NOTE: May need to edit "drivers/platform/tegra/tegra21_clocks.c:1065"
# c->state = ((!is_lp_cluster()) == (c->u.cpu.mode == MODE_G)) ? ON : OFF;
# NOTE: toplevel Makefile, KBUILD_CFLAGS_KERNEL := -fomit-frame-pointer