Cross compile jetson nano kernel failed

I downloaded the kernel source code from

After export CROSS_COMPILE_AARCH64_PATH and run, get following logs:

arch/arm64/boot/dts/Makefile:132: target ‘arch/arm64/boot/dts/ddot’ given more than once in the same rule
make[1]: *** No rule to make target ‘arch/arm64/boot/dts/…//hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-a00.dts’, needed by ‘arch/arm64/boot/dts/ddot//hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-a00.dtb’. Stop.
make[1]: *** Waiting for unfinished jobs…
** DTC arch/arm64/boot/dts/ddot**
cc1: fatal error: arch/arm64/boot/dts/…: No such file or directory
compilation terminated.
make[1]: *** [arch/arm64/boot/dts/Makefile:133: arch/arm64/boot/dts/ddot] Error 1
make: *** [arch/arm64/Makefile:154: dtbs] Error 2

Hi, may I know which OS and cross compiler you are using on the host PC?
I’ve just tested it on Ubuntu 18.04 with GCC 7.3.1 from Linaro (the recommended compiler for R32.7.3),
and encountered no error.
Maybe checking the building environments and re-tar ing the source files help.

under ubuntu, the builds passed.
but when build with -o option, rm -fr $PWD/kernel_out && mkdir $PWD/kernel_out && ./ -o $PWD/kernel_out

the build outputs are still inside source code tree.

Building kernel-4.9 sources
** HOSTCC scripts/basic/fixdep**
** HOSTCC scripts/kconfig/conf.o**
** SHIPPED scripts/kconfig/**
** SHIPPED scripts/kconfig/zconf.lex.c**
** SHIPPED scripts/kconfig/zconf.hash.c**
** HOSTCC scripts/kconfig/**
** HOSTLD scripts/kconfig/conf**
scripts/kconfig/conf --silentoldconfig Kconfig

***** Configuration file “.config” not found!**

***** Please run some configurator (e.g. “make oldconfig” or**
***** “make menuconfig” or “make xconfig”).**

scripts/kconfig/Makefile:37: recipe for target ‘silentoldconfig’ failed
make[3]: *** [silentoldconfig] Error 1
Makefile:575: recipe for target ‘silentoldconfig’ failed
make[2]: *** [silentoldconfig] Error 2
make[1]: Nothing to be done for ‘/build/Linux_for_Tegra/source/public/kernel_out’.
# configuration written to .config

You cannot just build without first configuring. The input location remains the kernel source, but the config it wants is at your alternate output location. That means you have to configure while using the “O=$PWD/kernel_out” or there won’t be any configuration file. Typical example:

# Configure to the default starting config:
make O=./kernel_out tegra_defconfig
# Now use this for any edits to the default if changing it:
make O=./kernel_out nconfig

In that example the “nconfig” is the same as “menuconfig”, but it has a symbol search function (I think it is more convenient than menuconfig). The tegra_defconfig creates the initial configuration, and the output goes to “./kernel_out” (note that “./kernel_out” is the same as “$PWD/kernel_out” since “.” is an alias for “$PWD”).

It is only after that configuration when you can compile.

Also, if you put the output location to somewhere outside of the kernel source, then the kernel source could be owned by root and kept pristine, and the person doing to build could be non-root (thus protecting the original source).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.