Build uboot for rockpi4a

Hi everyone, I am trying to compile uboot for rockpi 4a and I have the following error:

./build/mk-uboot.sh rockpi4a

   CC      arch/arm/mach-rockchip/rk3399/clk_rk3399.o
   CC      arch/arm/mach-rockchip/rk3399/rk3399.o
   CC      arch/arm/mach-rockchip/rk3399/syscon_rk3399.o
   LD      arch/arm/mach-rockchip/rk3399/built-in.o
   CC      arch/arm/mach-rockchip/rk_atags.o
   LD      arch/arm/mach-rockchip/built-in.o
   CC      board/rockchip/evb_rk3399/evb-rk3399.o
 board/rockchip/evb_rk3399/evb-rk3399.c:168:13: error: 'rk3399_force_pcie_power_on' defined but not used [-Werror=unused-function]
  static void rk3399_force_pcie_power_on(void)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~
 cc1: all warnings being treated as errors
 scripts/Makefile.build:280: recipe for target 'board/rockchip/evb_rk3399/evb-rk3399.o' failed
 make[2]: *** [board/rockchip/evb_rk3399/evb-rk3399.o] Error 1
 Makefile:1287: recipe for target 'board/rockchip/evb_rk3399' failed
 make[1]: *** [board/rockchip/evb_rk3399] Error 2
 make: *** [__build_one_by_one] Error 2
 Makefile:461: recipe for target '__build_one_by_one' failed

I have another rock pi 4b and I got it normally… :confused: :thinking:

I believe this is not the right u-boot branch or commit, which branch are you using?

I get the same error, using the stable-4.4-rockpi4 branch as per the documentation

Any ideas?

And the per the documentation linked above, the branch rk3399-pie-gms-express-baseline gives the following error:
CC common/s_record.o
CC common/xyzModem.o
CC common/write_keybox.o
CC common/keymaster.o
CC common/attestation_key.o
LD common/built-in.o
CC disk/part.o
CC disk/part_dos.o
CC disk/part_efi.o
disk/part_efi.c: In function ‘gpt_verify_partitions’:
disk/part_efi.c:858:49: error: taking address of packed member of ‘struct _gpt_entry’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
858 | gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
| ^~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:281: disk/part_efi.o] Error 1
make[1]: *** [Makefile:1289: disk] Error 2
make: *** [Makefile:461: __build_one_by_one] Error 2
MAKE UBOOT IMAGE FAILED.

I got the same error When I try to reproduce the problem and I will get the resolution for you sooner.

modify line 363 in the file uboot/Makefile, delete the keyword “-Werror”, then try this command “./build/mk-uboot.sh rk3399-rock-pi-4a”

Following the above advice, I get the following:
CC net/ping.o
CC net/tftp.o
LD net/built-in.o
CC test/rockchip/test-rockchip.o
CC test/rockchip/test-brom-dnl.o
CC test/rockchip/test-timer.o
CC test/rockchip/test-key.o
CC test/rockchip/test-emmc.o
CC test/rockchip/test-regulator.o
CC test/rockchip/test-eth.o
CC test/rockchip/test-vendor-storage.o
LD test/rockchip/built-in.o
LD test/built-in.o
CC test/dm/cmd_dm.o
LD test/dm/built-in.o
CC examples/standalone/stubs.o
LD examples/standalone/libstubs.o
CC examples/standalone/hello_world.o
LD examples/standalone/hello_world
OBJCOPY examples/standalone/hello_world.srec
OBJCOPY examples/standalone/hello_world.bin
LDS u-boot.lds
LD u-boot
OBJCOPY u-boot.srec
OBJCOPY u-boot-nodtb.bin
start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1 -d ’ '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut -f 1 -d ’ '); tools/relocate-rela u-boot-nodtb.bin 0x00200000 $start $end
DTC arch/arm/dts/rk3036-sdk.dtb
Error: arch/arm/dts/.rk3036-sdk.dtb.pre.tmp:77.1-10 syntax error
FATAL ERROR: Unable to parse input tree
make[3]: *** [scripts/Makefile.lib:319: arch/arm/dts/rk3036-sdk.dtb] Error 1
make[2]: *** [dts/Makefile:62: arch-dtbs] Error 2
make[1]: *** [Makefile:878: dts/dt.dtb] Error 2
make: *** [Makefile:461: __build_one_by_one] Error 2
MAKE UBOOT IMAGE FAILED.

Any ideas? Why is this such a painful process?