From 1cf9985da67b0d9ee1ae91425c642fb9d0ac1ef5 Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Tue, 21 Jul 2026 15:13:19 +0100 Subject: [PATCH] boot: fix ramdisk paths lost to FAT name uppercasing; widen driver-name buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- system/services/device-manager/device-manager.zig | 2 +- test/qemu_test.py | 2 +- tools/make-fat-image.py | 13 ++++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/system/services/device-manager/device-manager.zig b/system/services/device-manager/device-manager.zig index f138ddd..1d3164d 100644 --- a/system/services/device-manager/device-manager.zig +++ b/system/services/device-manager/device-manager.zig @@ -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, diff --git a/test/qemu_test.py b/test/qemu_test.py index 0ae317d..19e0eff 100644 --- a/test/qemu_test.py +++ b/test/qemu_test.py @@ -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 diff --git a/tools/make-fat-image.py b/tools/make-fat-image.py index 1a47314..7e85bf1 100644 --- a/tools/make-fat-image.py +++ b/tools/make-fat-image.py @@ -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