hanwckf / bl-mt798x

ATF and u-boot for mt798x.
732 stars 206 forks source link

uboot: failsafe: support boot into initramfs #82

Closed 1715173329 closed 2 months ago

1715173329 commented 2 months ago

sort uri handlers while at it.


When testing on U-Boot 2023.07, I found a strange issue on CMCC RAX3000M eMMC board which failed to boot into its initramfs, while other images are fine. This issue only appeared in this version, I have no idea why.

## Loading kernel from FIT Image at 440000d4 ...
   Using 'config-1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  ARM64 OpenWrt Linux-6.6.50
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x440001bc
     Data Size:    5583486 Bytes = 5.3 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x44000000
     Entry Point:  0x44000000
     Hash algo:    crc32
     Hash value:   8a170c4c
     Hash algo:    sha1
     Hash value:   4dcc2d3939c7bbacc5c7c1fb7b39f508eb8f481f
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading ramdisk from FIT Image at 440000d4 ...
   Using 'config-1' configuration
   Trying 'initrd-1' ramdisk subimage
     Description:  ARM64 OpenWrt cmcc_rax3000m initrd
     Type:         RAMDisk Image
     Compression:  uncompressed
     Data Start:   0x44553574
     Data Size:    7517088 Bytes = 7.2 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: unavailable
     Entry Point:  unavailable
     Hash algo:    crc32
     Hash value:   c4b0b0e1
     Hash algo:    sha1
     Hash value:   d9e803070304069db0d7bd75b32662f1dc986a65
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 440000d4 ...
   Using 'config-1' configuration
   Trying 'fdt-1' fdt subimage
     Description:  ARM64 OpenWrt cmcc_rax3000m device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x44c7ea20
     Data Size:    24912 Bytes = 24.3 KiB
     Architecture: AArch64
     Load Address: 0x43f00000
     Hash algo:    crc32
     Hash value:   550473af
     Hash algo:    sha1
     Hash value:   5dab832b0fad3f30cd750f090bbfcd0c6edc073c
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Loading fdt from 0x44c7ea20 to 0x43f00000
## Loading fdt from FIT Image at 440000d4 ...
   Using 'mt7981b-cmcc-rax3000m-emmc' configuration
   Trying 'fdt-mt7981b-cmcc-rax3000m-emmc' fdt subimage
     Description:  ARM64 OpenWrt cmcc_rax3000m device tree overlay mt7981b-cmcc-rax3000m-emmc
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x44c84cc0
     Data Size:    3050 Bytes = 3 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   0846e2e7
     Hash algo:    sha1
     Hash value:   d2ff0eb8d6ab1d01985620614801f68d57dfc6a8
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x43f00000
Working FDT set to 43f00000
   Uncompressing Kernel Image
lzma compressed: uncompress error 1
Must RESET board to recover
resetting ...
lgs2007m commented 2 months ago

使用uboot202206源码编译的京东云百里uboot,也遇到问题。可以启动主线的initramfs-recovery.itb,无法启动hanwckf大佬仓库编译出来的initramfs-kernel.bin。 切换回hanwckf大佬releases20240123的百里uboot直接load image不行,换全年我编译的uboot202206的uboot直接load image也不行,看来可能是hanwckf大佬仓库编译的initramfs-kernel.bin有问题吧

## Loading kernel from FIT Image at 460000e0 ...
   Using 'config-1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  ARM64 OpenWrt Linux-5.4.255
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x46000210
     Data Size:    39845938 Bytes = 38 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x48080000
     Entry Point:  0x48080000
     Hash algo:    crc32
     Hash value:   3abf71b9
     Hash algo:    sha1
     Hash value:   88e46d48587652c60977d69397e1bfa81059fd27
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 460000e0 ...
   Using 'config-1' configuration
   Trying 'fdt-1' fdt subimage
     Description:  ARM64 OpenWrt jdcloud_re-cp-03 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x48600384
     Data Size:    23071 Bytes = 22.5 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   d1d3ba37
     Hash algo:    sha1
     Hash value:   26d7c27c88094a83a995a14af0f781c473afd278
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x48600384
   Uncompressing Kernel Image
lzma compressed: uncompress error 1
Must RESET board to recover
resetting ...
lgs2007m commented 1 month ago

@1715173329 大佬,偶然看到,在uboot-202307中的fw_to_part_name函数,是否少了一个initramfs项?这个fw_to_part_name函数只用于failsafe_validate_image函数,应该也要用到吧

case FW_TYPE_INITRD: return "initramfs";

https://github.com/hanwckf/bl-mt798x/blob/290e6a9ce0d658f43b6c9ee4b8a3508961cd1417/uboot-mtk-20230718-09eda825/board/mediatek/common/failsafe.c#L23-L33

1715173329 commented 1 month ago

initramfs 不走 mtk 的 validate,简单的 fdt check 过了就直接 bootm。

lgs2007m commented 1 month ago

initramfs 不走 mtk 的 validate,简单的 fdt check 过了就直接 bootm。

明白,感谢大佬解答