简体   繁体   中英

error compiling linux kernel using buildroot toolchain

I am trying to compile linux kernel v5.9.12 using my buildroot toolchain (2020.08.2) and I keep getting an error related to libfdt. I can't figure out how to fix this and I've been banging my head against the wall for several hours now.

username@local:~/linux-stable$ make ARCH=arm CROSS_COMPILE=arm-linux- -j64 
  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/piggy.o
  CC      arch/arm/boot/compressed/fdt_ro.o
In file included from arch/arm/boot/compressed/../../../../lib/fdt_ro.c:2,
                 from arch/arm/boot/compressed/fdt_ro.c:2:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_generate_phandle’:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:149:13: error: ‘FDT_MAX_PHANDLE’ undeclared (first use in this function)
  149 |  if (max == FDT_MAX_PHANDLE)
      |             ^~~~~~~~~~~~~~~
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:149:13: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_get_mem_rsv’:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:182:13: error: implicit declaration of function ‘fdt64_ld’ [-Werror=implicit-function-declaration]
  182 |  *address = fdt64_ld(&re->address);
      |             ^~~~~~~~
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_get_property_by_offset_’:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:371:11: error: implicit declaration of function ‘fdt32_ld’ [-Werror=implicit-function-declaration]
  371 |   *lenp = fdt32_ld(&prop->len);
      |           ^~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:283: arch/arm/boot/compressed/fdt_ro.o] Error 1
make[1]: *** [arch/arm/boot/Makefile:64: arch/arm/boot/compressed/vmlinux] Error 2
make: *** [arch/arm/Makefile:330: zImage] Error 2
make: *** Waiting for unfinished jobs....

I have added output/host/usr/bin to my PATH env variable so make can find the toolchain. Any ideas?

It turns out that in arch/arm/boot/compressed there were a bunch of old libfdt related header files still hanging around, so by deleting these I was able to build the kernel. I found the files using git status.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM