In most Linux kernel build cases a single compiler is used, either natively or via cross-compile. Those cases, including the Jetson TK1 (emphasis “K”, not “X”), are easy to deal with since all of the tools are generally available natively on the system which will use the kernel. Anything cross-compiled adds at least a slight complexity, as a cross-compiler tool chain needs to be installed, and a few environment variables may need to be set in order to tell the build that the host isn’t what the target is.
On the Jetson TX1 (emphasis “X”) the kernel build environment is slightly different for now; I would expect the environment to be simplified two releases from now (currently L4T R23.1 is the JTX1 release…another release should be coming soon, but environment simplification is not expected until the release after that). The complication is that parts of the software are running 64-bit, while other parts are running 32-bit. Thus two compilers are required. This would make native compile of a kernel on a JTX1 more complicated than cross-compile via an x86_64 host.
The document describing kernel cross-compile is on this page:
https://developer.nvidia.com/embedded/linux-tegra
The specific document is “Jetson TX1 Developer Kit User Guide”, direct URL is:
http://developer.download.nvidia.com/embedded/L4T/r23_Release_v1.0/NVIDIA_Jetson_TX1_Developer_Kit_User_Guide.pdf
Within ths document, see “Building the NVIDIA Kernel”.
If you are using an Ubuntu desktop host, I believe you simply download and install the cross-compile tools via ordinary package management. I’m using Fedora, so I manually download Linaro compilers. My compilers are located on my local host under these paths:
/usr/local/gcc-linaro-5.2-2015.11-x86_64_aarch64-linux-gnu
/usr/local/gcc-linaro-5.2-2015.11-x86_64_arm-linux-gnueabihf
An excerpt from this guide:
1. Export the following environment variables:
$ export CROSS_COMPILE=<crossbin>
$ export CROSS32CC=<cross32bin>gcc
$ export TEGRA_KERNEL_OUT=<outdir>
$ export ARCH=arm64
For my setup (adjust for your install locations), assuming output to “/home/me/build”, this means:
1. Export the following environment variables:
$ export CROSS_COMPILE=/usr/local/gcc-linaro-5.2-2015.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
$ export CROSS32CC=/usr/local/gcc-linaro-5.2-2015.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
$ export TEGRA_KERNEL_OUT=/home/me/build
$ export ARCH=arm64
Note that CROSS32CC contains a full path to a 32-bit gcc program, while CROSS_COMPILE is a prefix to an entire set of 64-bit programs starting with “arch64-linux-gnu-”.
Tip on cross-compile of kernels: Many of the kernel build commands respond to “TEGRA_KERNEL_OUT”. Not all examples use this variable, but “make menuconfig”, “make clean”, and “make mrproper” respond to this. Don’t forget to use this when cross-compiling for all of those helper commands.
The rest will be the usual Linux kernel procedures for whatever build there is, e.g., start with a known working “.config”. If the only modifications are in the format of a module, then your $TEGRA_KERNEL_OUT location should produce the modules you need…modifying non-module config may require more extensive copy instructions. Because the full version naming of a default Jetson TX1 has suffix “-g3a5c467”, you will want to set this up to match in the CONFIG_LOCALVERSION (should be make menuconfig “general” settings, and then second line down); should you modify more than modules, you will want to use a modification of “-g3a5c467” and go for complete kernel install procedures (this is not custom to Jetson, it is simply one of the details for manual build and install of Linux kernels).