u-boot rk356х (rockchip repository)
#11
(09-04-2021, 08:21 AM)ryo Wrote: Along with an error, although it seems like compilation went on regardless.
Code:
  CC      net/tftp.o
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;
      |               ^~~~~
  CC      drivers/video/drm/analogix_dp.o
  LD      net/built-in.o
  CC      test/dm/cmd_dm.o
  LD      test/dm/built-in.o
  CC      drivers/video/drm/analogix_dp_reg.o
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:280: lib/avb/libavb/avb_slot_verify.o] エラー 1
make[1]: *** [scripts/Makefile.build:425: lib/avb/libavb] エラー 2
make: *** [Makefile:1305: lib] エラー 2
make: *** 未完了のジョブを待っています....
  LD      drivers/watchdog/built-in.o
  CC      drivers/video/drm/rockchip_lvds.o
  CC      drivers/video/drm/rockchip_panel.o
  LD      drivers/video/drm/built-in.o
  LD      drivers/video/built-in.o
  LD      drivers/built-in.o

I ran into this too, and just did this:

Code:
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c
index 123701fc3b..74fc5e7bb2 100644
--- a/lib/avb/libavb/avb_slot_verify.c
+++ b/lib/avb/libavb/avb_slot_verify.c
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(
   bool image_preloaded = false;
   uint8_t* digest;
   size_t digest_len;
-  const char* found;
+  const char* found = "";
   uint64_t image_size;
   size_t expected_digest_len = 0;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];

(probably dangerous and wrong and bad I am lazy and simply wanted this to build)

Also, I think you should use the ./make.sh script, like the Quartz64 CI does.

If you run into any further issues, the quickest way to get help is probably in the Quartz64 channel of the PINE64 chats. I'm usually quite active there.

Occasional Linux Kernel Contributor, Avid Wiki Updater, Ask Me About Quartz64
Open Hardware Quartz64 Model A TOSLink Adapter
  Reply
#12
complete instructions that I just tried:-
Code:
git clone --depth=1 -b next-dev https://github.com/rockchip-linux/u-boot.git u-boot
git clone --depth=1 https://github.com/rockchip-linux/rkbin.git rkbin
cd u-boot
wget https://gitlab.com/sndwvs/images_build_kit/-/raw/arm/patch/u-boot/rk3568/01-add-u-boot-quartz64.patch
patch -p1 < 01-add-u-boot-quartz64.patch
ln -sf ../rkbin/bin/rk35/rk3568_bl31_v1.24.elf bl31.elf
ln -sf ../rkbin/bin/rk35/rk3568_bl32_v1.05.bin tee.bin
make rk3566-quartz64_defconfig
make CROSS_COMPILE=aarch64-linux-gnu- -j4 && make CROSS_COMPILE=aarch64-linux-gnu- -j4 u-boot.itb
tools/mkimage -n rk356x -T rksd -d ../rkbin/bin/rk35/rk3566_ddr_1056MHz_v1.08.bin:spl/u-boot-spl.bin idblock.bin

This worked on my ubuntu virtualbox machine that I use for Armbian builds once I had installed gcc-aarch64-linux-gnu

It wouldn't compile on my Manjaro desktop (even with aarch64-linux-gnu-gcc installed)
  Reply
#13
I followed the various instructions and put onto a microSD card.
This is the output. Did I compile it right?
Code:
U-Boot SPL board init                                                          
U-Boot SPL 2017.09-g1372a46 #root (Nov 27 2021 - 16:35:48)                      
unknown raw ID phN                                                              
unrecognized JEDEC id bytes: 00, 00, 00                                        
Trying to boot from MMC2                                                        
## Verified-boot: 0                                                            
## Checking atf-1 0x00040000 ... sha256+ OK                                    
## Checking uboot 0x00a00000 ... sha256+ OK                                    
## Checking fdt 0x00b22708 ... sha256+ OK                                      
## Checking atf-2 0xfdcc9000 ... sha256+ OK                                    
## Checking atf-3 0xfdcd0000 ... sha256+ OK                                    
## Checking optee 0x08400000 ... sha256+ OK                                    
Jumping to U-Boot(0x00a00000) via ARM Trusted Firmware(0x00040000)              
Total: 265.827 ms                                                              
                                                                                
INFO:    Preloader serial: 2                                                    
NOTICE:  BL31: v2.3():v2.3-135-gcda1658bc-dirty:xsf                            
NOTICE:  BL31: Built : 14:19:26, Jun  1 2021                                    
INFO:    GICv3 without legacy support detected.                                
INFO:    ARM GICv3 driver initialized in EL3                                    
INFO:    pmu v1 is valid                                                        
INFO:    dfs DDR fsp_param[0].freq_mhz= 1056MHz                                
INFO:    dfs DDR fsp_param[1].freq_mhz= 324MHz                                  
INFO:    dfs DDR fsp_param[2].freq_mhz= 528MHz                                  
INFO:    dfs DDR fsp_param[3].freq_mhz= 780MHz                                  
INFO:    Using opteed sec cpu_context!                                          
INFO:    boot cpu mask: 0                                                      
INFO:    BL31: Initializing runtime services                                    
INFO:    BL31: Initializing BL32                                                
I/TC:                                                                          
I/TC: Start rockchip platform init                                              
I/TC: Rockchip release version: 1.0                                            
I/TC: OP-TEE version: 3.6.0-307-g0b06ae94 #1 Fri May  7 01:52:27 UTC 2021 aarch4
I/TC: Initialized                                                              
INFO:    BL31: Preparing for EL3 exit to normal world                          
INFO:    Entry point address = 0xa00000                                        
INFO:    SPSR = 0x3c9                                                          
                                                                                
                                                                                
U-Boot 2017.09-g1372a46 #root (Nov 27 2021 - 16:36:25 +0000)                    
                                                                                
Model: Pine64 RK3566 Quartz64 Board                                            
PreSerial: 2, raw, 0xfe660000                                                  
DRAM:  4 GiB                                                                    
Sysmem: init                                                                    
Relocation Offset: ed356000, fdt: eb9f93f8                                      
Using default environment                                                      
                                                                                
no mmc device at slot 1                                                        
dwmmc@fe2b0000: 1 (SD), dwmmc@fe2c0000: 2, sdhci@fe310000: 0                    
Bootdev(atags): mmc 1                                                          
MMC1: Legacy, 50Mhz                                                            
PartType: EFI                                                                  
No misc partition                                                              
boot mode: None                                                                
FIT: No boot partition                                                          
No resource partition                                                          
Failed to load DTB                                                              
Failed to get kernel dtb, ret=-19                                              
io-domain: OK                                                                  
Model: Pine64 RK3566 Quartz64 Board                                            
rockchip_set_serialno: could not find efuse/otp device                          
CLK: (sync kernel. arm: enter 816000 KHz, init 816000 KHz, kernel 0N/A)        
  apll 816000 KHz                                                              
  dpll 528000 KHz                                                              
  gpll 1188000 KHz                                                              
  cpll 1000000 KHz                                                              
  npll 24000 KHz                                                                
  vpll 24000 KHz                                                                
  hpll 24000 KHz                                                                
  ppll 100000 KHz                                                              
  armclk 816000 KHz                                                            
  aclk_bus 150000 KHz                                                          
  pclk_bus 50000 KHz                                                            
  aclk_top_high 300000 KHz                                                      
  aclk_top_low 200000 KHz                                                      
  hclk_top 150000 KHz                                                          
  pclk_top 50000 KHz                                                            
  aclk_perimid 300000 KHz                                                      
  hclk_perimid 150000 KHz                                                      
  pclk_pmu 50000 KHz                                                            
Net:   clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -2.
Hit key to stop autoboot('CTRL+C'):  0                                          
## Booting FIT Image FIT: No boot partition                                    
FIT: No FIT image                                                              
Could not find misc partition                                                  
ANDROID: reboot reason: "(none)"                                                
optee api revision: 2.0                                                        
TEEC: Waring: Could not find security partition                                
Not AVB images, AVB skip                                                        
android_image_load_by_partname: Can't find part: boot                          
Android image load failed                                                      
Android boot failed, error -1.                                                  
switch to partitions #0, OK                                                    
mmc1 is current device                                                          
Failed to mount ext2 filesystem...                                              
** Unrecognized filesystem type **                                              
MMC error: The cmd index is 0, ret is -110                                      
mmc_init: -110, time 4                                                          
starting USB...                                                                
Bus dwc3@fcc00000: usb maximum-speed not found                                  
Register 2000140 NbrPorts 2                                                    
Starting the controller                                                        
USB XHCI 1.10                                                                  
Bus dwc3@fd000000: usb maximum-speed not found                                  
Register 2000140 NbrPorts 2                                                    
Starting the controller                                                        
USB XHCI 1.10                                                                  
scanning bus dwc3@fcc00000 for devices... 1 USB Device(s) found                
scanning bus dwc3@fd000000 for devices... 1 USB Device(s) found                
       scanning usb for storage devices... 0 Storage Device(s) found            
                                                                                
Device 0: unknown device                                                        
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missind
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/00000000                                          
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/0000000                                          
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/000000                                            
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/00000                                            
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/0000                                              
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/000                                              
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/00                                                
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/0                                                
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/default-arm-rockchip                              
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/default-arm                                      
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22missine
Retrieving file: pxelinux.cfg/default                                          
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22Configd
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22clk_ge.
clk_get_by_name(master_bus) failed: -22eqos_probe_resources() failed: -22=>
  Reply
#14
yes, the bootloader is compiled and loaded.
now we need a correct markup structure
Code:
echo -e "\ng\nn\n1\n32768\n+512M\nt\n1\nn\n2\n\n\nw" | fdisk /dev/mmcblk0
donation   slarm64

  Reply
#15
I had already done that step.
Before I noticed your reply I tried something else.
I bitwise copied (with dd) partition 2 and 3 from one of your SLARM64 images (so the EFI partition and rootlinux partition) onto the SDCard, but didn't touch the partition table nor partition 1.
It worked fine and booted up so I going say that it works.
I have copied the code here https://github.com/dieselnutjob/u-boot
With a readme here https://github.com/dieselnutjob/u-boot/b...4-a/README

hopefully in a way that's easy for less experienced people

Thanks for your efforts with this board.
  Reply
#16
Code:
  CC      net/tftp.o
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;
      |               ^~~~~
  CC      drivers/video/drm/analogix_dp.o
  LD      net/built-in.o
  CC      test/dm/cmd_dm.o
  LD      test/dm/built-in.o
  CC      drivers/video/drm/analogix_dp_reg.o
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:280: lib/avb/libavb/avb_slot_verify.o] エラー 1
make[1]: *** [scripts/Makefile.build:425: lib/avb/libavb] エラー 2
make: *** [Makefile:1305: lib] エラー 2
make: *** 未完了のジョブを待っています....
  LD      drivers/watchdog/built-in.o
  CC      drivers/video/drm/rockchip_lvds.o
  CC      drivers/video/drm/rockchip_panel.o
  LD      drivers/video/drm/built-in.o
  LD      drivers/video/built-in.o
  LD      drivers/built-in.o

Technically speaking that char *found in lib/avg/libavb/avb_slot_verify.c line 299 is being used without being initialized, at least as far as the compiler is concerned. Combined with the -Werror=maybe-uninitialized flag, what would normally be a warning is being treated as an error.

A quick fix would be to add "= NULL" to the declaration on line 299 so it is always initialized, e.g.

char * found = NULL;
  Reply
#17
thanks, this problem has already been resolved fixed-gcc11-avb-slot-verify.patch
donation   slarm64

  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)