A Letter Case Mystery: IPFire Boot Failure on Loongson 3A6000
一个字母的大小写:IPFire 在龙芯 3A6000 上的启动谜案
The Problem
My Morefine M700S runs a Loongson 3A6000. I wrote the IPFire LoongArch ISO to a USB stick with dd, plugged it in, powered on the machine, and selected the USB drive from the boot menu — and nothing happened. The screen stayed on the boot device selection menu as if the USB stick didn't exist. This problem persisted for quite some time.
The Initial Suspect: GRUB 2.16
The IPFire ISO boot failure had been ongoing for a while. My first suspicion was IPFire's upgrade to GRUB 2.16. GRUB version changes often introduce boot path modifications, and IPFire's Bugzilla had reports of systems failing to boot after the 2.16 upgrade. To test this hypothesis, I spent considerable time syncing LoongFire (my own IPFire port for LoongArch) with IPFire's codebase, including GRUB versions and configurations. The result: LoongFire never reproduced the problem. Same GRUB, same architecture, yet one booted and the other didn't. The issue clearly wasn't GRUB itself.
The Accidental Discovery: Case Difference
The breakthrough came while working on something else. I happened to compare the lfs/cdrom files of LoongFire and IPFire, and noticed a subtle difference in how the EFI bootloader was named: letter case. LoongFire used all-uppercase BOOTLOONGARCH64.EFI, while IPFire used lowercase bootLOONGARCH64.efi. This made me suspect that the Loongson firmware might have a problem with case sensitivity when reading ISO 9660 filesystems.
Finding the Root Cause: Debian Mailing List
With this suspicion, I searched for information (with DeepSeek's assistance) and eventually found the key report on the Debian LoongArch mailing list. A 3A6000 (Morefine M700S) owner confirmed that actual Loongson firmware treats ISO 9660 filesystems case-sensitively, only recognizing the all-uppercase EFI/BOOT/BOOTLOONGARCH64.EFI. When written to a FAT32 partition instead, lowercase filenames work because FAT itself is case-insensitive. This explained why the dd-written USB produced no reaction at all after being selected in the boot menu — the firmware simply couldn't find the bootloader it was looking for.
GRUB upstream had also merged a patch in June 2024 switching the LoongArch removable EFI path to uppercase, precisely because Loongson firmware couldn't handle non-uppercase paths.
The Fix
In IPFire's lfs/cdrom, the EFI filename is constructed from $(EFI_ARCH). The fix is to change only LoongArch, leaving other platforms untouched:
ifeq "$(EFI_ARCH)" "LOONGARCH64"
EFI_BOOT_FILE = BOOTLOONGARCH64.EFI
else
EFI_BOOT_FILE = boot$(EFI_ARCH).efi
endif
x86 keeps bootx64.efi, ARM keeps bootaa64.efi, and only LoongArch becomes all-uppercase. Uppercase is the standard UEFI naming convention anyway, and it works on devices unaffected by the firmware bug, so there's no downside.
The patch was tested on my Morefine M700S: rebuilt the ISO, wrote it with dd, rebooted, selected the USB drive from the boot menu, and the GRUB menu appeared as expected. The commit message documents the test hardware:
Tested on a Morefine M700S (Loongson 3A6000).
Conclusion
If you're wrestling with a Loongson machine where "the USB is written, you selected it in the boot menu, and nothing happens," first rule out the firmware case-sensitivity bug. Better yet, simply make sure the EFI boot filename is capitalized — uppercase works across all firmware, so it's the safer default.
问题
我的 Morefine M700S 搭载龙芯 3A6000。把 IPFire 龙架构的 ISO 用 dd 写入 U 盘后,插入机器,开机,在启动菜单里选择从 U 盘启动——然后毫无反应,屏幕始终停留在启动盘选择界面,仿佛那个 U 盘根本不存在。这个问题困扰了我相当长一段时间。
起初的误判:GRUB 2.16
IPFire 的 ISO 启动失败已经持续好一段时间了。我起初怀疑这和 IPFire 升级 GRUB 到 2.16 有关。毕竟 GRUB 版本更迭经常引入引导路径的变化,IPFire Bugzilla 上也有关于 GRUB 2.16 导致系统无法启动的报告。为了验证这个猜想,我花费了很多时间把 LoongFire(我自己维护的 IPFire 龙架构移植版本)和 IPFire 的代码同步,包括 GRUB 的版本和配置。但结果是:LoongFire 始终没有复现 IPFire 的问题。同样的 GRUB、同样的架构,一个能启动,一个不能。这说明问题不在 GRUB 本身。
意外发现:大小写差异
转机出现在解决另一个问题的过程中。我偶然对比了 LoongFire 的 lfs/cdrom 和 IPFire 的 lfs/cdrom,注意到两者在 EFI 引导文件命名上存在一个细微的区别:大小写。LoongFire 用的是全大写的 BOOTLOONGARCH64.EFI,而 IPFire 用的是小写的 bootLOONGARCH64.efi。这个发现让我初步怀疑,龙芯固件对 ISO 9660 文件系统的大小写处理可能有问题。
找到根源:Debian 邮件列表
带着这个怀疑,我在 DeepSeek 的帮助下检索相关信息,最终找到了 Debian LoongArch 邮件列表中的关键报告。有 3A6000(Morefine M700S)用户明确指出:龙芯实际固件在处理 ISO 9660 文件系统时是大小写敏感的,只识别全大写的 EFI/BOOT/BOOTLOONGARCH64.EFI;而如果用 FAT32 分区方式写入(文件系统本身不区分大小写),小写文件名反而能正常工作。这也解释了为什么 dd 写入的 U 盘在启动菜单里被选中后毫无反应——固件根本找不到它要的引导文件。
GRUB 上游也在 2024 年 6 月合并了相关补丁,将 LoongArch 可移动 EFI 镜像路径改为全大写,理由正是龙芯固件无法处理非大写路径。
修复方案
IPFire 的 lfs/cdrom 中,EFI 文件名由 $(EFI_ARCH) 拼接生成。修复的关键是只改龙架构,不动其他平台:
ifeq "$(EFI_ARCH)" "LOONGARTCH64"
EFI_BOOT_FILE = BOOTLOONGARCH64.EFI
else
EFI_BOOT_FILE = boot$(EFI_ARCH).efi
endif
x86 仍然是 bootx64.efi,ARM 仍然是 bootaa64.efi,只有 LoongArch 变成全大写。全大写本身就是 UEFI 规范的标准命名形式,对不受该固件 bug 影响的设备同样有效,因此没有副作用。
补丁在我的 Morefine M700S 上测试通过:重新构建 ISO、dd 写入 U 盘、重启,在启动菜单中选择 U 盘后 GRUB 菜单如期出现。提交信息中也注明了测试机型:
Tested on a Morefine M700S (Loongson 3A6000).
结语
如果你也在龙芯机器上遇到"U 盘写好了、启动菜单里也选了,却毫无反应"的情况,请先排查是否踩中了固件的大小写敏感 bug。更稳妥的做法是:直接确保 EFI 引导文件名使用大写——大写形式对所有固件都有效,是更安全的默认选择。