Skip to content

uboot: failsafe: support boot into initramfs#82

Merged
hanwckf merged 1 commit into
hanwckf:masterfrom
1715173329:initramfs
Sep 12, 2024
Merged

uboot: failsafe: support boot into initramfs#82
hanwckf merged 1 commit into
hanwckf:masterfrom
1715173329:initramfs

Conversation

@1715173329
Copy link
Copy Markdown
Contributor

@1715173329 1715173329 commented Sep 11, 2024

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 ...

sort uri handlers while at it.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
@hanwckf hanwckf merged commit 15ac366 into hanwckf:master Sep 12, 2024
@1715173329 1715173329 deleted the initramfs branch September 12, 2024 09:27
@lgs2007m
Copy link
Copy Markdown
Contributor

lgs2007m commented Sep 14, 2024

使用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
Copy link
Copy Markdown
Contributor

lgs2007m commented Oct 9, 2024

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

case FW_TYPE_INITRD: return "initramfs";

const char *fw_to_part_name(failsafe_fw_t fw)
{
switch (fw)
{
case FW_TYPE_GPT: return "gpt";
case FW_TYPE_BL2: return "bl2";
case FW_TYPE_FIP: return "fip";
case FW_TYPE_FW: return "fw";
default: return "err";
}
}

@1715173329
Copy link
Copy Markdown
Contributor Author

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

@lgs2007m
Copy link
Copy Markdown
Contributor

lgs2007m commented Oct 9, 2024

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

明白,感谢大佬解答

@hdfla
Copy link
Copy Markdown

hdfla commented Sep 30, 2025

I encountered another same weird problem.
When i use initramfs with ~40MB of size, it refuses to boot with the same message till Working FDT set to xxx:
"New format image overwritten.
Must reset the board to recover."
The initramfs-kernel.bin is ramdisk uncompressed, file has no problem, as it works on rr-fork uboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants