agherzan / meta-raspberrypi

Yocto/OE BSP layer for the Raspberry Pi boards
https://www.yoctoproject.org/
MIT License
531 stars 410 forks source link

Raspberry Pi 4 - 64 bit: fitimage #920

Closed RobertBerger closed 2 years ago

RobertBerger commented 3 years ago

fitimage

Here is what I did:

1) u-boot 2021.07 (which comes by default with poky/master) does not support fitimages, so I'll enable it

CONFIG_FIT=y
CONFIG_FIT_EXTERNAL_OFFSET=0x0
CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
# CONFIG_FIT_ENABLE_SHA384_SUPPORT is not set
# CONFIG_FIT_ENABLE_SHA512_SUPPORT is not set
CONFIG_FIT_FULL_CHECK=y
# CONFIG_FIT_SIGNATURE is not set
# CONFIG_FIT_CIPHER is not set
CONFIG_FIT_VERBOSE=y
# CONFIG_FIT_BEST_MATCH is not set
CONFIG_FIT_PRINT=y
# CONFIG_UPDATE_TFTP is not set
CONFIG_BOOTM_EFI=y
CONFIG_SHA1=y
CONFIG_SHA256=y
CONFIG_MD5=y
CONFIG_SPL_OF_LIBFDT_ASSUME_MASK=0xff
CONFIG_TPL_OF_LIBFDT_ASSUME_MASK=0xff

2) at least in theory with oe/yp it should be something like that in local.conf to create a fitimage:

KERNEL_CLASSES = "kernel-fitimage"
KERNEL_IMAGETYPE = "fitImage"
KERNEL_FITCONFIG = "conf@bcm2711-rpi-4-b.dtb"
KERNEL_BOOTCMD = "bootm"

3) This actually does something ;)

Describe the results you received:

This is what I see when I try to boot:

U-Boot 2021.07 (Jul 05 2021 - 15:11:28 +0000)                                                                                                                                                 

DRAM:  7.9 GiB                                                                                                                                                                                
RPI 4 Model B (0xd03114)                                                                                                                                                                      
MMC:   sdhci_setup_cfg: Hardware doesn't specify base clock frequency                                                                                                                         
sdhci_setup_cfg: Hardware doesn't specify base clock frequency                                                                                                                                
mmcnr@7e300000 - probe failed: -22                                                                                                                                                            
sdhci_setup_cfg: Hardware doesn't specify base clock frequency                                                                                                                                

Loading Environment from FAT... OK                                                                                                                                                            
In:    serial                                                                                                                                                                                 
Out:   serial                                                                                                                                                                                 
Err:   serial                                                                                                                                                                                 
Net:   eth0: ethernet@7d580000                                                                                                                                                                
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)                                                                                                                                                         
starting USB...                                                                                                                                                                               
Bus xhci_pci: Register 5000420 NbrPorts 5                                                                                                                                                     
Starting the controller                                                                                                                                                                       
USB XHCI 1.00                                                                                                                                                                                 
scanning bus xhci_pci for devices... 2 USB Device(s) found                                                                                                                                    
       scanning usb for storage devices... 0 Storage Device(s) found                                                                                                                          
Hit any key to stop autoboot:  0                                                                                                                                                              
switch to partitions #0, OK                                                                                                                                                                   
mmc0 is current device                                                                                                                                                                        
Scanning mmc 0:1...                                                                                                                                                                           
Found U-Boot script /boot.scr                                                                                                                                                                 
265 bytes read in 7 ms (36.1 KiB/s)                                                                                                                                                           
## Executing script at 02400000                                                                                                                                                               
8811332 bytes read in 754 ms (11.1 MiB/s)                                                                                                                                                     
## Loading kernel from FIT Image at 00080000 ...                                                                                                                                              
   Using 'conf-broadcom_bcm2711-rpi-4-b.dtb' configuration                                                                                                                                    
   Trying 'kernel-1' kernel subimage                                                                                                                                                          
     Description:  Linux kernel                                                                                                                                                               
     Type:         Kernel Image                                                                                                                                                               
     Compression:  gzip compressed                                                                                                                                                            
     Data Start:   0x00080138                                                                                                                                                                 
     Data Size:    8575068 Bytes = 8.2 MiB                                                                                                                                                    
     Architecture: AArch64                                                                                                                                                                    
     OS:           Linux                                                                                                                                                                      
     Load Address: 0x01314c40                                                                                                                                                                 
     Entry Point:  0x01314c40                                                                                                                                                                 
     Hash algo:    sha256                                                                                                                                                                     
     Hash value:   b461a0827874110a3ebdd43e970abacf095d56b1f62c878a5c3c99df1d702e10                                                                                                           
   Verifying Hash Integrity ... sha256+ OK                                                                                                                                                    
## Flattened Device Tree blob at 2eff3800                                                                                                                                                     
   Booting using the fdt blob at 0x2eff3800                                                                                                                                                   
   Uncompressing Kernel Image                             
   Using Device Tree in place at 000000002eff3800, end 000000002f002f79                                                                                                                       

Starting kernel ...            

and that's where we are stuck

Describe the results you expected:

command prompt/kernel boot log

Additional information you deem important (e.g. issue happens only occasionally):

I suspect that: i) I might be missing something on the fitimage class variables, or wrong values ii) issues with the devide tree/device tree overlays (are overlays passed on to the kernel?)

Additional details (revisions used, host distro, etc.):

master of everything

I guess I might not be the first one fighting against this problem, so please let me know if you worked it out ;)

RobertBerger commented 3 years ago

Here is some more documentation from the yocto project doc: http://docs.yoctoproject.org/singleindex.html#kernel-fitimage-bbclass

RobertBerger commented 3 years ago

I think the trick might be to assemble a configuration that contains kernel, dtb, dtbo, and maybe also a ramdisk. But I am not quite sure what's the best way to do that from a Yocto point of view. Maybe via the "U-boot boot script"

agherzan commented 2 years ago

u-boot support is something I haven't kept up with for a good while now so this will need someone to look into a bit deeper. There are a series of issues related to uboot on various rpi targets so I suspect that this needs a bit of love.

agherzan commented 2 years ago

Could it be due to https://github.com/agherzan/meta-raspberrypi/blob/master/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in ?

EDIT: Closing for now but feel free to reopen if you have more info on the matter.