radxa / rockchip-bsp

Linux BSP for ROCK Pi
http://rockpi.org
89 stars 42 forks source link

Unable to package u-boot natively on Rock Pi 4 #6

Open sepotvin opened 5 years ago

sepotvin commented 5 years ago

I would like to be able to package u-boot directly on my Rock Pi 4 instead of having to use a x86_64 linux machine. I'm currently able to run both "firmwareMerger" and "resource_tool", using usermode qemu emulation, as they are compiled static: $ uname -a Linux rockpi4 5.3.8-gentoo #3 SMP PREEMPT Tue Nov 5 11:17:18 EST 2019 aarch64 GNU/Linux $ file firmwareMerger firmwareMerger: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.8, with debug_info, not stripped $ ./firmwareMerger

----------------FirmwareMerger v1.3-------------------- Packing: -P <config file> <saving dir> UnPacking: -U <firmware> <output dir> [offcheck] ------------------------------------------------------- Unfortunately, the other tools are all dynamic and are looking for shared libraries that are not present. I can kind of work around the problem by chrooting to a complete x86_64 linux but it's not as convenient as running the executables directly. Would it be possible to provide statically compiled tools (or, alternatively, the source code) so it is possible to do development on the Rock Pi 4 natively, without an x86_64 Linux computer?

jack-ma commented 5 years ago

Hi, @sepotvin

I can see that you are running kernel 5.3 and gentoo, which means you are using upstream kernel. I suggest you also use the upstream u-boot, which provides a unified interfaces and utilities. You can just install the u-boot to SPI flash with mtd tool under Linux or in u-boot console with sfcommand.

The binary tools are provided by Rockchip, which we don't have source code nor arm64 binaries. We can check with Rockchip but I don't expect much hope.

AllizomFoxfire commented 2 years ago

I'm trying to compile the native Uboot and kernel with wifi and some PCIe RAID drivers built-in, but I'm coming across an issue where it will not compile with the Radxa provided tools giving the following error:

lib/avb/libavb/avb_slot_verify.c: In function ‘load_and_verify_vbmeta’:
lib/avb/libavb/avb_slot_verify.c:476:40: error: found’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  476 |     loaded_partition->partition_name = avb_strdup(found);
      |                                        ^~~~~~~~~~~~~~~~~
lib/avb/libavb/avb_slot_verify.c:299:15: note: found’ was declared here
  299 |   const char* found;
      |               ^~~~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:281: lib/avb/libavb/avb_slot_verify.o] Error 1
make[2]: *** [scripts/Makefile.build:425: lib/avb/libavb] Error 2
make[1]: *** [Makefile:1305: lib] Error 2
make: *** [Makefile:461: __build_one_by_one] Error 2
 MAKE UBOOT IMAGE FAILED.

I'm passing the standard command listed on the "Build Debian from scratch" site.

./build/mk-uboot.sh rk3568-rock-3-a #For ROCK 3-A

Whilst I am not a programmer per se, I can follow code fairly well. It looks fine at first glance to me. Any ideas what I can do to get this compiled?

AllizomFoxfire commented 2 years ago

@sepotvin

As you can see here, the main u-boot repository has a config for the Rock Pi 4, so building a new one and compiling a new kernel for you should be easy. Just clone that repo and take the output files from it combined with the compiled 5.3 kernel and you should be good to go!

adminy commented 2 years ago

@AllizomFoxfire I'm having the same issue.

I fixed it by Running these two commands:

sed -i 's/Werror/w/g' scripts/Kbuild.include
sed -i 's/Werror/w/g' Makefile

I am compiling the soquartz version of uboot but your problem should be solved in more or less the same way.