Building the Kernel with L4T R28.2

I am trying to build L4T R28.2 kernel.

Building toolchain according to “Building the Toolchain” in “Development Guide 28.2 Release”, build failed on “Building Glibc stage 1”.

I am using Ubuntu 14.04 x86_64 PC for building kernel.

My operation is follows…

  1. Download “GCC Tool Chain Sources for 64-bit BSP” version R28.2 from following url.

  2. Extruct archive with following command.

tar xf src_aarch64_gcc-4.8.5.tar.gz

  1. Run build script.

The script outputs following result.

Downloading sources
Applying patches
Set environment
Build binutils
Install Linux headers
Build GCC stage1
Build Glibc stage1

The contents of build_glibc_stage1.log are as follows…

mkdir build-glibc1
pushd build-glibc1
~/work/L4T_r28_2/toolchain/build-glibc1 ~/work/L4T_r28_2/toolchain
mkdir -p /home/user/work/L4T_r28_2/toolchain/install/aarch64-unknown-linux-gnu/sysroot/usr/lib
checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking for aarch64-unknown-linux-gnu-gcc... aarch64-unknown-linux-gnu-gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether aarch64-unknown-linux-gnu-gcc accepts -g... yes
checking for aarch64-unknown-linux-gnu-gcc option to accept ISO C89... unsupported
checking for gcc... gcc
checking how to run the C preprocessor... /lib/cpp
checking for aarch64-unknown-linux-gnu-g++... aarch64-unknown-linux-gnu-g++
checking whether we are using the GNU C++ compiler... yes
checking whether aarch64-unknown-linux-gnu-g++ accepts -g... yes
checking for aarch64-unknown-linux-gnu-readelf... aarch64-unknown-linux-gnu-readelf
checking for sysdeps preconfigure fragments... x86_64 
configure: running configure fragment for add-on nptl
checking add-on /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports for preconfigure fragments... aarch64 alpha am33 arm 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/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/unix/sysv/linux/aarch64/nptl /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/unix/sysv/linux/aarch64 /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/unix/sysv/linux/generic sysdeps/unix/sysv/linux/wordsize-64 nptl/sysdeps/unix/sysv/linux nptl/sysdeps/pthread sysdeps/pthread /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/unix/sysv/linux sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/inet nptl/sysdeps/unix/sysv /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/unix/sysv sysdeps/unix/sysv nptl/sysdeps/unix /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/unix sysdeps/unix sysdeps/posix /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/aarch64/fpu /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/aarch64/nptl /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/aarch64 sysdeps/wordsize-64 sysdeps/ieee754/ldbl-128 sysdeps/ieee754/dbl-64/wordsize-64 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 /home/user/work/L4T_r28_2/toolchain/glibc-2.17/ports/sysdeps/aarch64/soft-fp sysdeps/ieee754 sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/as is GNU as... yes
checking whether /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/ld is GNU ld... yes
checking for /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/as... /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/as
checking version of /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/as... 2.24, ok
checking for /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/ld... /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/ld
checking version of /home/user/work/L4T_r28_2/toolchain/install/lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/ld... 2.24, ok
checking for aarch64-unknown-linux-gnu-gcc... (cached) aarch64-unknown-linux-gnu-gcc
checking version of aarch64-unknown-linux-gnu-gcc... 4.8.5, ok
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 3.81, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.18.3, ok
checking for makeinfo... makeinfo
checking version of makeinfo... 5.2, ok
checking for sed... sed
checking version of sed... 4.2.2, ok
checking for gawk... gawk
checking version of gawk... 4.0.1, ok
checking for aarch64-unknown-linux-gnu-nm... aarch64-unknown-linux-gnu-nm
checking for autoconf... autoconf
checking whether autoconf works... no
configure: WARNING:
*** These auxiliary programs are missing or incompatible versions: autoconf
*** some features will be disabled.
*** Check the INSTALL file for required versions.
checking LD_LIBRARY_PATH variable... contains current directory
configure: error: 
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.
make install-bootstrap-headers=yes install-headers
make: *** ターゲット `install-headers' を make するルールがありません.  中止.
make install-bootstrap-headers=yes install-headers failed

Is there any solution to build kernel?

It looks like you are building the toolchain itself, and not the kernel. Regardless of what you are building it seems you are missing necessary prerequisite packages, e.g., autoconf. Building a toolchain involves a lot of dependencies (far more than what you might consider for most user space software). autoconf in particular is used in a very large number of builds, so I would be surprised if much of anything succeeds in building from third party packages.

Did you set LD_LIBRARY_PATH yourself?

Prebuilt toolchains are already available…do you have a reason to build your own chain?

r28.1 and r28.2 are using Ubuntu 16.04.

My camera driver README has instructions for setting up the toolchain and building the kernel:

Just skip the “Adding the driver” and “Update Kconfig” parts

How to solve this problem? I have the same one now.

Are you following a guide? Ridgerun has the best one:

Also keep in mind that if you run Ubuntu on your host PC, then most likely you can just install the cross-tools for gcc and don’t need to build the whole chain. I’ve built many chains over the years and even now I consider it a slow and difficult pain, but I’m using Fedora which historically has not provided the necessary cross-tools. Now that Fedora is providing those they are modern versions which won’t work on the Jetsons (e.g., Fedora 27 now provides gcc7 in both mainline and cross tools, but CUDA and kernel builds don’t work with gcc7).

Are you sure the cross tools are not available as a regular package? Build instructions are included, but custom build is not necessarily required (I wish I could verify, I’m using Fedora though, not Ubuntu).

Thank you very much for your recommend.
But something wrong remain when i follow the step to Compile kernel.
Like below:
$ make O=$TEGRA_KERNEL_OUT zImage

make[1]: Entering directory ‘/home/hm/Xavier/Xavier/Linux_for_Tegra/images’
arch/arm64/Makefile:40: LSE atomics not supported by binutils
CHK include/config/kernel.release
Using /home/hm/Xavier/Xavier/Linux_for_Tegra/sources/kernel/kernel-4.9 as source for kernel
GEN ./Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC kernel/bounds.s
/home/hm/Xavier/Xavier/Linux_for_Tegra/sources/kernel/kernel-4.9/kernel/bounds.c: In function ‘foo’:
/home/hm/Xavier/Xavier/Linux_for_Tegra/sources/kernel/kernel-4.9/kernel/bounds.c:25:1: sorry, unimplemented: function profiling
/home/hm/Xavier/Xavier/Linux_for_Tegra/sources/kernel/kernel-4.9/./Kbuild:45: recipe for target ‘kernel/bounds.s’ failed
make[2]: *** [kernel/bounds.s] Error 1
/home/hm/Xavier/Xavier/Linux_for_Tegra/sources/kernel/kernel-4.9/Makefile:1070: recipe for target ‘prepare0’ failed
make[1]: *** [prepare0] Error 2
make[1]: Leaving directory ‘/home/hm/Xavier/Xavier/Linux_for_Tegra/images’
Makefile:170: recipe for target ‘sub-make’ failed
make: *** [sub-make] Error 2

Not sure it is related to your issue, but I think you should generate a non compressed image

  1. What JetPack version are you using
  2. What platform are you building for
  3. What release are you building

It looks like you might be trying to build for the new Xavier board rather than the TX1/TX2

Which cross compiler version are you using?