boot: fix ramdisk paths lost to FAT name uppercasing; widen driver-name buffers

The EFI loader now ENUMERATES /system rather than opening files by name,
so the on-disk name must be exact, not merely case-insensitively
findable. make-fat-image.py stored 8.3-fitting lowercase names as bare
uppercase short entries ('init' -> INIT), garbling the ramdisk paths;
now any name whose case the 8.3 entry cannot reproduce gets a long-name
chain carrying the exact name.

device-manager's driver table stored names in 24 bytes — silently
truncating '/system/drivers/usb-xhci-bus' and failing the spawn; widen
to 64 (= abi.maximum_process_name). The usb-report harness regex learns
that restart lines name drivers by path.
This commit is contained in:
Daniel Samson
2026-07-21 15:13:19 +01:00
parent 2d0858caf6
commit 1cf9985da6
3 changed files with 10 additions and 7 deletions
+8 -5
View File
@@ -179,14 +179,17 @@ def short_name_for(name, used):
else:
base, ext = name, ""
upper_base, upper_ext = base.upper(), ext.upper()
# A name fits 8.3 if it is short enough and uses valid characters; a lowercase
# name is simply stored uppercased (FAT is case-insensitive, so the bootloader
# and the danos driver still find it). Only genuinely non-8.3 names (too long,
# e.g. initial-ramdisk.img) get a mangled short name plus LFN entries.
# A name fits 8.3 if it is short enough and uses valid characters. The raw
# 8.3 entry is always uppercase; if that loses the real name's case (e.g.
# "init" -> "INIT"), a long-name chain carries the exact name. This matters
# because the EFI loader *enumerates* /system to build the ramdisk — it gets
# back whatever the directory stores, so the stored name must be exact, not
# merely case-insensitively findable.
fits = (1 <= len(base) <= 8 and len(ext) <= 3
and all(c in VALID_83 for c in upper_base + upper_ext))
if fits:
return (upper_base.ljust(8) + upper_ext.ljust(3)).encode("ascii"), False
exact = base == upper_base and ext == upper_ext
return (upper_base.ljust(8) + upper_ext.ljust(3)).encode("ascii"), not exact
# Mangle to STEM~N.EXT.
stem = "".join(c for c in upper_base if c in VALID_83 and c != " ")[:6] or "FILE"
index = 1