Compiling the kernel for TK1

I am trying to build the kernel on the tk1.
My ultimate goal is to patch it to add support for 4GB memory, but my first step is just to build the kernel without any changes.
I am following the HOWTO from https://devtalk.nvidia.com/default/topic/762653/embedded-systems/-guide-build-own-kernel-for-jetson-tk1/post/4264541/#4264541

The compilation itself fails:

...
  CC      init/version.o
  LD      init/built-in.o
drivers/built-in.o: In function `nvhost_syncpt_deinit_timeline':
/usr/src/kernel/drivers/video/tegra/host/nvhost_syncpt.c:725: undefined reference to `sync_timeline_destroy'
/usr/src/kernel/drivers/video/tegra/host/nvhost_syncpt.c:732: undefined reference to `sync_timeline_destroy'
drivers/built-in.o: In function `add_sync_waits':
/usr/src/kernel/drivers/video/tegra/host/host1x/host1x_channel.c:154: undefined reference to `sync_fence_put'
/usr/src/kernel/drivers/video/tegra/host/host1x/host1x_channel.c:154: undefined reference to `sync_fence_put'
/usr/src/kernel/drivers/video/tegra/host/host1x/host1x_channel.c:154: undefined reference to `sync_fence_put'
drivers/built-in.o: In function `nvhost_sync_pt_dup_inst':
/usr/src/kernel/drivers/video/tegra/host/nvhost_sync.c:163: undefined reference to `sync_pt_create'
drivers/built-in.o: In function `nvhost_sync_fdget':
/usr/src/kernel/drivers/video/tegra/host/nvhost_sync.c:256: undefined reference to `sync_fence_fdget'
/usr/src/kernel/drivers/video/tegra/host/nvhost_sync.c:268: undefined reference to `sync_fence_put'
...

Any ideas?
In general is there an NVIDIA-supported guide on how to compile / cross-compile the kernel?

The general listing of various L4T versions is here:
https://developer.nvidia.com/embedded/linux-tegra-archive

The downloads for L4T R21.5 is here:
https://developer.nvidia.com/linux-tegra-r215

Within that is “Documentation”. This has documents you can install locally and look at with your web browser. Information includes building the kernel.

I don’t know about your specific error, but quite often it means you haven’t provided a feature in the kernel configuration which is required. You would want to start with the “/proc/config.gz” file to get your current running configuration, make sure the CONFIG_LOCALVERSION is correct, and then use an editor such as from “make nconfig” or “make menuconfig” to find and enable what you are working on (these editors understand dependencies, and will for example enable other required dependencies when you enable the one you want). Often the convenience config editors require the ncurses-devel package (or ncurses5 variant) before you can use them.

This is a typical environment setup…adjust it for your actual directories where your source is (create empty directories for output as needed…adjust for the compiler tools you use as well…the “baggage” subdirectory of the document download provides a crosstool-ng version):

export CROSS_COMPILE=/usr/local/arm-linux-gnueabihf/gcc-linaro-4.8-2015.06/bin/arm-linux-gnueabihf-
export ARCH=arm
export TEGRA_KERNEL_OUT=${HOME}/L4T/build/stage
export TEGRA_MODULES_OUT=${HOME}/L4T/build/modules
export TEGRA_FIRMWARE_OUT=${HOME}/L4T/build/firmware
export TEGRA_KERNEL_SRC=${HOME}/L4T/R21.5/src/kernel/kernel-R21_5

cd $TEGRA_KERNEL_SRC

#make O=$TEGRA_KERNEL_OUT distclean
make mrproper
make O=$TEGRA_KERNEL_OUT mrproper
# tegra12_defconfig works if you don't have a starting "/proc/config.gz".
make O=$TEGRA_KERNEL_OUT tegra12_defconfig

# Use this to set CONFIG_LOCALVERSION and make your configuration changes.
make O=$TEGRA_KERNEL_OUT nconfig

# Eventually zImage gets copied to "/boot/zImage-some_name" on the Jetson.
make -j4 O=$TEGRA_KERNEL_OUT zImage

# make O=$TEGRA_KERNEL_OUT modules_prepare
make -j4 O=$TEGRA_KERNEL_OUT modules

# If you make a module it would end up here and be copied as a file to the
# Jetson's "/lib/modules/$(uname -r)/".
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUTT

Indeed, the link to the kernel sources provided in that HOWTO article are wrong. Downloading the right sources from the link you provided, I can build the kernel on the TK1.
I still cannot flash the kernel back to the TK1 from a host machine.
The provided command of:

sudo ./flash.sh -k 6 jetson-tk1 mmcblk0p1

Does not work.
I’ll post separately to ask about this problem

The “-k 6” was used with fastboot and is not a valid flash for U-Boot. I would suggest:

sudo ./flash.sh -S 14580MiB jetson-tk1 mmcblk0p1