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
No known key found for this signature in database
GPG Key ID: A9EB2589C60F7268
3 changed files with 10 additions and 7 deletions

View File

@ -132,7 +132,7 @@ const DriverState = enum {
const Driver = struct {
used: bool = false,
name_buffer: [24]u8 = undefined,
name_buffer: [64]u8 = undefined, // fits a full binary path (abi.maximum_process_name)
name_len: usize = 0,
// The assigned device id (becomes argv[1]), or protocol.no_device.
device_id: u64 = protocol.no_device,

View File

@ -447,7 +447,7 @@ CASES = [
r"device-manager: child added[\s\S]*"
r"device-manager: test mode: killing the reporter[\s\S]*"
r"device-manager: child removed[\s\S]*"
r"device-manager: restarting usb-xhci-bus[\s\S]*"
r"device-manager: restarting \S*usb-xhci-bus[\s\S]*"
r"device-manager: child added",
"fail": r"DANOS-TEST-RESULT: FAIL"},
# USB HID end to end: boot the full tree, enumerate the xHCI, and let the

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