TX1 R24.2.1 Kernel Compilation

I want to compile 64 bit TX1 kernel R24.2.1 on my PC running Ubuntu 16.04 LTS.
So which toolchain in need to use?


or Linaro Toolchain?

First i tried “jetson-tx1-toolchain-build.tbz2” approch.
I compiled toochain as per README and successfully build toolchains.

Below is my environment variable setup.

export CROSS_COMPILE=/home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-aarch64/install/bin/aarch64-unknown-linux-gnu-
export CROSS32CC=/home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/bin/arm-unknown-linux-gnueabi-gcc
export TEGRA_KERNEL_OUT=/home/ritesh/kernel_R24.2.1/sources/build
export ARCH=arm64

I have downloaded kernel sources using below commands

./source_sync.sh -k tegra-l4t-r24.2.1 -u tegra-l4t-r24.2.1

Then i executed following commands.

make O=$TEGRA_KERNEL_OUT tegra21_defconfig

zImage build gives me following errors.

/home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-aarch64/install/bin/aarch64-unknown-linux-gnu-ld: cannot find libgcc.a: No such file or directory
/home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-aarch64/install/bin/aarch64-unknown-linux-gnu-ld: cannot find libgcc.a: No such file or directory
/home/ritesh/kernel_R24.2.1/sources/kernel_source/Makefile:794: recipe for target 'vmlinux' failed
make[1]: *** [vmlinux] Error 1
Makefile:130: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

I have also tried patch given in this post but resulting same error.

So what’s wrong here?

Actually i figure out what causing the problem.

The toolchain building is not completed.
it stuck in glibc building.
please find error log.

mkdir build-glibc1
pushd build-glibc1
/home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/build-glibc1 /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf
mkdir -p /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/arm-unknown-linux-gnueabi/sysroot/usr/lib
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabi
checking for arm-unknown-linux-gnueabi-gcc... arm-unknown-linux-gnueabi-gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-unknown-linux-gnueabi-gcc accepts -g... yes
checking for arm-unknown-linux-gnueabi-gcc option to accept ISO C89... unsupported
checking for gcc... gcc
checking how to run the C preprocessor... /lib/cpp
checking for arm-unknown-linux-gnueabi-g++... arm-unknown-linux-gnueabi-g++
checking whether we are using the GNU C++ compiler... yes
checking whether arm-unknown-linux-gnueabi-g++ accepts -g... yes
checking for arm-unknown-linux-gnueabi-readelf... arm-unknown-linux-gnueabi-readelf
checking for sysdeps preconfigure fragments... x86_64 
configure: running configure fragment for add-on nptl
checking add-on /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports for preconfigure fragments... aarch64 alpha am33 arm arm/preconfigure: Did not find ARM architecture type; using default
hppa ia64 m68k mips tile 
checking for assembler and linker STT_GNU_IFUNC support... yes
checking whether .text pseudo-op must be used... yes
checking sysdep dirs... /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/unix/sysv/linux/arm/nptl /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/unix/sysv/linux/arm nptl/sysdeps/unix/sysv/linux nptl/sysdeps/pthread sysdeps/pthread /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/unix/sysv/linux sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/inet nptl/sysdeps/unix/sysv /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/unix/sysv sysdeps/unix/sysv /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/unix/arm nptl/sysdeps/unix /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/unix sysdeps/unix sysdeps/posix /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/arm/nptl /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/glibc-2.17/ports/sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/as is GNU as... yes
checking whether /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/ld is GNU ld... yes
checking for /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/as... /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/as
checking version of /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/as... 2.24, ok
checking for /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/ld... /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/ld
checking version of /home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf/install/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/ld... 2.24, ok
checking for arm-unknown-linux-gnueabi-gcc... (cached) arm-unknown-linux-gnueabi-gcc
checking version of arm-unknown-linux-gnueabi-gcc... 4.8.2, ok
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 4.1, bad
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.19.7, ok
checking for makeinfo... makeinfo
checking version of makeinfo... 6.1, ok
checking for sed... sed
checking version of sed... 4.2.2, ok
checking for gawk... gawk
checking version of gawk... 4.1.3, ok
checking for arm-unknown-linux-gnueabi-nm... arm-unknown-linux-gnueabi-nm
checking for autoconf... autoconf
checking whether autoconf works... no
configure: error: 
*** These critical programs are missing or too old: make
*** Check the INSTALL file for required versions.
make install-bootstrap-headers=yes install-headers
make: *** No rule to make target 'install-headers'.  Stop.
make install-bootstrap-headers=yes install-headers failed

It says make version is bad. But make v4.1 is installed.

root@riteshPC:/home/ritesh/kernel_R24.2.1/jetson-tx1-toolchain-build/toolchain-build-armhf# make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

So how to resolve this issue?
And if i want to use linaro built toolchain, which toolchain to used for 64 bit.?

Just a heads up, this is about the kernel compile rather than tools…

The R24.2 and some earlier releases needed some edits to compile. One of those edits is still required. The “-fomit-frame-pointer” is still needed. File to edit: “arch/arm64/kernel/vdso32/Makefile”. Actual edit:

# Change this line:
ccflags-y := -shared -fPIC -fno-common -fno-builtin -march=armv7-a
# Add the -fomit-frame-pointer:
ccflags-y := -shared -fPIC <b>-fomit-frame-pointer</b> -fno-common -fno-builtin -march=armv7-a

I tested this build using the older crosstool-ng-4.8.2 for the 64-bit tool chain, and gcc-linaro-4.8-2015.06 for the 32-bit gcc.

I have not yet tested with the supplied 4.8.5, but do be aware those tools are supplied in not just source form, but also binary, so compiling them is not required for testing. Just unpack them and the “install” directory is essentially something you can copy wherever you like and directly point at the bin subdirectory. I renamed my “install” directories to “install-4.8.5-armhf” and “install-4.8.5-aarch64”. I’ll probably test those and some other compilers in the next day or two.

Thanks for the Reply.

Ya with your suggested changes i can successfully build kernel R24.2.1 using following toolchains


there is also another toolchain like arm-linux-gnueabi for same linaro release.
In R24.2.1 documentation, they used gnueabi toolchain for CROSS32CC instead of gnueabihf. But for R23.2 i have used gnueabihf.
So does it make any difference?

Historically (back around the earlier L4T R16 days) the 32-bit ARMv7 did not always take advantage of hardware floating point. Somewhere in the later R16 era all L4T began using hard floating point calling convention to take advantage of hardware floating point. The “gnueabihf” is a way of noting this. I don’t actually remember what the compiler naming convention was for soft float, but I suspect that mixing soft float and hard float in the kernel might be partially functional, or perhaps be a bit bizarre at times…but I don’t know for sure. I wish I could remember what the naming convention was for soft float, but it is possible the one you have named “gnueabi” is actually “gnueabihf” (you’d have to read release notes). However, I would stick to known hard float (gnueabihf).

Note that the original 32-bit ARM CPUs had many options and different extensions to the ARM CPU which were not mandatory…it depended on the manufacturer to decide which parts to license. In the Tegra X1, with its 64-bit main native architecture, that the 32-bit compatibility mode under ARMv8 does not allow for picking and choosing many features which a natively 32-bit ARM CPU could choose…thus if you get an ARMv8 32-bit compiler which is compatibile with older ARM 32-bit code there will be just one “model” of CPU to be compatible with and features like NEON and Thumb2 will always be there…you would not need to distinguish things like optional floating point hardware or multimedia extensions.