MUSE Pi Pro 的 UEFI 启动 GRUB 的时候会遇到 relocation overflow

目前 Ubuntu 25.04 和 Debian 13 官方 ISO 镜像的 grub 在启动的时候都会遇到 relocation overflow 这个报错,导致无法进入 GRUB
我用来生成 GRUB image 的指令是:

grub-mkimage -O riscv64-efi -o bootriscv64.efi --prefix=/EFI/boot iso9660

这个问题可以通过下载 Ubuntu / Debian 官方的通用 RISC-V ISO 并尝试启动来复现

如果能够解决,那么加上进迭的 dtb 与 firmware,就有可能制作出能启动的 Ubuntu / Debian Live System 和 Installer ISO,体验会好很多

很有趣的是 Bianbu OS 上用 grub-mkimage 生成的 GRUB 反而没有问题,请问 Bianbu OS 上是怎么解决这个问题的?(还有顺便问一下那个 efi-env 获取 product_name 的细节,比如需要在生成镜像的时候包含哪个 mod)

1 个赞

在/etc/apt/sources.list.d/bianbu.sources中的deb后面添加deb-src,再sudo apt update;apt source grub2,grub需要添加如下patch:

Author: spacemit
Date:   Thu Dec 5 10:38:09 2024 +0800

    relocation-overflow: fix boot fail while run it from UEFI with multi-range memory layout

    patch source:
    https://lf-rise.atlassian.net/wiki/spaces/HOME/pages/8586141/DI_01_01+GRUB+-+Relocation+overflow+on+RISC-V+with+multi-range+memory+layout

    a relocation problem happened in grub_arch_dl_relocate_symbols() of
     grub-core/kern/riscv/dl.c:

            case R_RISCV_CALL:
            case R_RISCV_CALL_PLT:
              {
                grub_uint32_t *abs_place = place;
                grub_ssize_t off = sym_addr - (grub_addr_t) place;
                grub_uint32_t hi20, lo12;

                if (off != (grub_int32_t) off)
                  return grub_error (GRUB_ERR_BAD_MODULE, "relocation
    overflow");

    It requires `off' in the range of int32, but it's not enforced since the
    >4GB memory can be used.

    This patch MAY be repaced in the future.

    Change-Id: Ie9bedb15ca05071c908f3e0ace2da19edcba976b```
1 个赞