error compiling public_source kernel

Hi I need to add custom camera device to kernel and trying to update files in /public_sources/kernel folder. While compiling using make, i got following error. How can I fix it? Thanks.

drivers/base/dma-coherent.c:971:12: error: ‘shrink_thread’ defined but not used [-Werror=unused-function]
static int shrink_thread(void *arg)
^~~~~~~~~~~~~
drivers/base/dma-coherent.c:280:12: error: ‘declare_coherent_heap’ defined but not used [-Werror=unused-function]
static int declare_coherent_heap(struct device *dev, phys_addr_t base,
^~~~~~~~~~~~~~~~~~~~~
drivers/base/dma-coherent.c:96:13: error: ‘dma_debugfs_init’ defined but not used [-Werror=unused-function]
static void dma_debugfs_init(struct device *dev, struct heap_info *heap)
^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:335: recipe for target ‘drivers/base/dma-coherent.o’ failed
make[2]: *** [drivers/base/dma-coherent.o] Error 1
scripts/Makefile.build:649: recipe for target ‘drivers/base’ failed
make[1]: *** [drivers/base] Error 2
Makefile:1104: recipe for target ‘drivers’ failed
make: *** [drivers] Error 2

hello clean,

your building failure seems you had some defined but not used functions/variables.

  1. may I know which JetPack release you’re working with?
  2. could you please revert all the adding code and confirm the building environment works.
    thanks
  1. I am currently using
    #R32 (release), REVISION: 1.0, GCID: 14531094, BOARD: t186ref, EABI: aarch64, …
  2. I also tried the same way to compile original /kernel/kernel-4.9 inside extracted public_source folder and it shows the same crash with 3 identical warnings.
    Any thought? Those defined are from existing source codes and not part of the changes I am trying to make.

Thanks.

hello clean,

please check your GCC toolchain version.
FYI, you should refer to Building the NVIDIA Kernel chapter that we recommends using the Linaro 7.3.1 2018.05 toolchain.

you may download GCC-7.3.1 toolchain from 3rdparty,
or, we had also test building l4t-r32.1 kernel successfully with gcc-6.4.1
thanks

Hello,

We are having the same problem (activating CAN on TX2). We found the Linaro 7.3.1 2018.05 toolchain binary but don’t know how to install it.

https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/

Any suggestions?

Thanks

This is just some information to perhaps get you started (in some cases you may find that Ubuntu has releases available directly through “apt”, although there may be a need to enable a repository to see it).

If you look closely you will see three components:

  • Compiler.
  • Sysroot.
  • Runtime.

Kernels are “bare metal”, and thus only require the compiler (sysroot and runtime are basically user space libraries and linking).

A compiler example is this:

gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu

(from https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu.tar.xz)

The i686 says this works from a PC architecture (the older 64-bit), the aarch64 says this produces aarch64 output. The “.xz” suffix is just the latest compression. From some clean directory location, if using this file:

tar xvfJ ./gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu.tar.xz

This will produce a subdirectory, “gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu/”. Within this is a “bin/” subdirectory (“gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu/bin/”). The compiler tools are in this “bin/” subdirectory.

Example if you have this at “/usr/local/gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu/bin/”:

export CROSS_COMPILE=/usr/local/gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu/bin/aarch64-linux-gnu-
# Then the compile would see the CROSS_COMPILE as a prefix...