Radxa u-boot build failure for Rock Pi S

make rockpi-s-rk3308_defconfig

#
# configuration written to .config
#

env ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- make u-boot

 In file included from tools/../include/../lib/libfdt/libfdt.h:10,
                  from tools/../include/libfdt.h:1,
                  from tools/fdt_host.h:11,
                  from tools/imagetool.h:24,
                  from tools/aisimage.c:8:
 /usr/include/libfdt_env.h:71:30: error: conflicting types for β€˜fdt64_t’
    71 | typedef uint64_t FDT_BITWISE fdt64_t;
       |                              ^~~~~~~
 In file included from <command-line>:
 ././include/libfdt_env.h:19:16: note: previous declaration of β€˜fdt64_t’ was here
    19 | typedef __be64 fdt64_t;
       |                ^~~~~~~
 In file included from ././include/libfdt_env.h:12,
                  from <command-line>:
 /usr/include/libfdt_env.h:91:24: error: expected β€˜)’ before β€˜x’
    91 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
       |                        ^~~~~~~~~~~~
 ././include/compiler.h:71:9: error: expected β€˜)’ before β€˜&’ token
    71 |  ((((x) & 0xff000000) >> 24) | \
       |         ^
 ././include/compiler.h:71:23: error: expected β€˜)’ before β€˜>>’ token
    71 |  ((((x) & 0xff000000) >> 24) | \
       |                       ^~
 ././include/compiler.h:71:30: error: expected β€˜)’ before β€˜|’ token
    71 |  ((((x) & 0xff000000) >> 24) | \
       |                              ^
 /usr/include/libfdt_env.h:95:23: error: expected β€˜)’ before β€˜x’
    95 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
       |                       ^~~~~~~~~~~~
 ././include/compiler.h:71:9: error: expected β€˜)’ before β€˜&’ token
    71 |  ((((x) & 0xff000000) >> 24) | \
       |         ^
 ././include/compiler.h:71:23: error: expected β€˜)’ before β€˜>>’ token
    71 |  ((((x) & 0xff000000) >> 24) | \
       |                       ^~
 ././include/compiler.h:71:30: error: expected β€˜)’ before β€˜|’ token
    71 |  ((((x) & 0xff000000) >> 24) | \
       |                              ^
 /usr/include/libfdt_env.h:100:24: error: expected β€˜)’ before β€˜x’
   100 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
       |                        ^~~~~~~~~~~~
 ././include/compiler.h:76:9: error: expected β€˜)’ before β€˜&’ token
    76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
       |         ^
 ././include/compiler.h:76:36: error: expected β€˜)’ before β€˜>>’ token
    76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
       |                                    ^~
 ././include/compiler.h:76:43: error: expected β€˜)’ before β€˜|’ token
    76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
       |                                           ^
 /usr/include/libfdt_env.h:104:23: error: expected β€˜)’ before β€˜x’
   104 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
       |                       ^~~~~~~~~~~~
 ././include/compiler.h:76:9: error: expected β€˜)’ before β€˜&’ token
    76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
       |         ^
 ././include/compiler.h:76:36: error: expected β€˜)’ before β€˜>>’ token
    76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
       |                                    ^~
 ././include/compiler.h:76:43: error: expected β€˜)’ before β€˜|’ token
    76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
       |                                           ^
 make[2]: *** [scripts/Makefile.host:116: tools/aisimage.o] Error 1
 make[1]: *** [Makefile:1288: tools] Error 2
 make: *** [Makefile:461: __build_one_by_one] Error 2
  MAKE UBOOT IMAGE FAILED.

I think we need to cherry-pick the fix to the ROCK Pi S branch.

https://github.com/radxa/u-boot/pull/2

Such a new patch may help fix the issue. Please update the ROCK Pi S branch and build again.

This is the new error I’m seeing after pulling the latest commit.

 disk/part_efi.c: In function β€˜gpt_verify_partitions’:
 disk/part_efi.c:736:49: error: taking address of packed member of β€˜struct _gpt_entry’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
   736 |   gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
       |                                         ~~~~~~~~^~~~~~~~~~~~~~~
 cc1: all warnings being treated as errors
 make[1]: *** [scripts/Makefile.build:281: disk/part_efi.o] Error 1
 make: *** [Makefile:1288: disk] Error 2

u-boot codebase treats all warnings as errors.
The build failed because GCC 9 added -Werror=address-of-packed-member.

I recommend picking commits from https://github.com/u-boot/u-boot/search?q=address-of-packed-member&type=Commits

1 Like