build xavier kernel failed (Solved)

Hi NV people

i download source code and toolchain from jetson download center.
my PC can build tx2 R28.2.1 but i can’t build xavier kernel.

etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel$ export CROSS_COMPILE=/home/etta/storage-disk/nvidia/xavier-kernel/install/bin/aarch64-unknown-linux-gnu-
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel$ export ARCH=arm64
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel$ cd xavier_4.0_source/
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel/xavier_4.0_source$ ls
hardware  kernel  u-boot
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel/xavier_4.0_source$ cd kernel/kernel-4.9/
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9$
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9$ make O=./kernel-out/ tegra_defconfig
make[1]: Entering directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
  GEN     ./Makefile
#
# configuration written to .config
#
make[1]: Leaving directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9$ make O=./kernel-out/ menuconfig
make[1]: Entering directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
  GEN     ./Makefile
scripts/kconfig/mconf  Kconfig
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

make[1]: Leaving directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9$ make O=./kernel-out/ -j4
make[1]: Entering directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
arch/arm64/Makefile:40: LSE atomics not supported by binutils
  GEN     ./Makefile
scripts/kconfig/conf  --silentoldconfig Kconfig
make[1]: Leaving directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
make[1]: Entering directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
arch/arm64/Makefile:40: LSE atomics not supported by binutils
  CHK     include/config/kernel.release
  GEN     ./Makefile
  CHK     include/generated/uapi/linux/version.h
  Using .. as source for kernel
  CHK     include/generated/utsrelease.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
../scripts/mod/devicetable-offsets.c: In function ‘main’:
../scripts/mod/devicetable-offsets.c:210:1: sorry, unimplemented: function profiling
 }
 ^
make[3]: *** [scripts/mod/devicetable-offsets.s] Error 1
make[3]: *** Waiting for unfinished jobs....
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/conmakehash
  CC      kernel/bounds.s
../kernel/bounds.c: In function ‘foo’:
../kernel/bounds.c:25:1: sorry, unimplemented: function profiling
 }
 ^
make[2]: *** [kernel/bounds.s] Error 1
make[1]: *** [prepare0] Error 2
make[1]: *** Waiting for unfinished jobs....
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sortextable
make[2]: *** [scripts/mod] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts] Error 2
make[1]: Leaving directory `/home/etta/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9/kernel-out'
make: *** [sub-make] Error 2
etta@etta-i7pc:~/storage-disk/nvidia/xavier-kernel/xavier_4.0_source/kernel/kernel-4.9$

could you give some suggestion ?

Hi etta,

The Xavier kernel need use gcc 6.4.1 instead of 4.8.5
Please download the new toolchain from download center:
https://developer.nvidia.com/embedded/dlc/kernel-gcc-6-4-tool-chain

Thanks

Hi kaycc

thanks for your help !
i can build it!

Great, a magic link to some file with no way to find new or the latest version. How am I supposed to find the 7.3.1, or 7.4 gcc toolchain? Simply replacing, “6-4” with “7-4” or “7-3-1” above doesn’t work.

Wouldn’t it be better to tell us where you found that link so that in the future people can figure this out on their own instead of having to re-ask the same question every time a new compiler is released?

A wider range of compilers will now work. However, if you go here, log in (and then go there a second time since redirect does not work), you can search for “gcc”:
https://developer.nvidia.com/embedded/downloads

However, Ubuntu 18.04 LTS will be able to simply use “apt-get” to add what is needed. All of those tool chains and tool chain sources on the documentation page might be considered an alternate way of getting what is needed.

NOTE: Older and different compilers are required for bootloaders, but the kernel itself is fairly forgiving on gcc release.

How do I install gcc 7.3.1?

I’ve tried, and gave up because I couldn’t figure it out.

I’ve never tried, but this looks promising:
https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-20-04-lts-focal-fossa