Issue with building NVidia Kernel for TX1

I’ve been wrestling with building the NVidia Kernel as is described in the Tegra Linux Driver Package Documents.

I’m getting as far as $ make O=$TEGRA_KERNEL_OUT zImage and this is basically throwing the following error:

$ make O=$TEGRA_KERNEL_OUT ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE CROSS32CC=$CROSS32CC zImage
Using /home/idanbeck/Downloads/L4T-24.0-Beta/Linux_for_Tegra/sources/kernel_source as source for kernel
GEN /home/idanbeck/Downloads/L4T-24.0-Beta/Linux_for_Tegra/sources/kernel_source/out/Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[2]: `include/generated/mach-types.h’ is up to date.
CC kernel/bounds.s
arm-linux-gnueabihf-gcc: error: unrecognized command line option ‘-mgeneral-regs-only’
make[2]: *** [kernel/bounds.s] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

I’ve downloaded the Linaro toolchain 5.1 for the arm64 cross compiler and I’m pointing at:

$ echo $CROSS32CC
/usr/bin/arm-linux-gnueabihf-gcc

Any ideas as to what might be causing this error? Googling for the command line option I’m not finding anything. The version of arm-linux-gnueabihf-gcc is 4.8 I believe

So I noticed that in the NVidia documents the Aarch64 Linaro toolchain was mentioned so I downloaded the Aarch64 toolchain and used that instead and now I’m getting a different set of errors:

$ make O=$TEGRA_KERNEL_OUT ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE CROSS32CC=$CROSS32CC zImage
Using /home/idanbeck/Downloads/L4T-24.0-Beta/Linux_for_Tegra/sources/kernel_source as source for kernel
GEN /home/idanbeck/Downloads/L4T-24.0-Beta/Linux_for_Tegra/sources/kernel_source/out/Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[2]: `include/generated/mach-types.h’ is up to date.
CALL /home/idanbeck/Downloads/L4T-24.0-Beta/Linux_for_Tegra/sources/kernel_source/scripts/checksyscalls.sh
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
CHK include/generated/compile.h
VDSO32C arch/arm64/kernel/vdso32/vgettimeofday.o
/home/idanbeck/Downloads/L4T-24.0-Beta/Linux_for_Tegra/sources/kernel_source/arch/arm64/kernel/vdso32/vgettimeofday.c: In function ‘clock_gettime_fallback’:
/home/idanbeck/Downloads/L4T-24.0-Beta/Linux_for_Tegra/sources/kernel_source/arch/arm64/kernel/vdso32/vgettimeofday.c:56:1: error: r7 cannot be used in asm here
}
^
make[3]: *** [arch/arm64/kernel/vdso32/vgettimeofday.o] Error 1
make[2]: *** [arch/arm64/kernel/vdso32] Error 2
make[1]: *** [arch/arm64/kernel] Error 2
make: *** [sub-make] Error 2

You will probably find this thread of use:
https://devtalk.nvidia.com/default/topic/914941/jetson-tx1/custom-kernel-compilations/

The ARMv8a support is a very new thing and progressing very rapidly for Linaro. I’d suggest using the version 5.2 listed in the other thread.