Skip to content

os: every driver the board binds goes into the image, plus a probe that lists the missing ones - #593

Merged
bong-water-water-bong merged 2 commits into
mainfrom
1bit/os-hw-probe-drivers
Oct 26, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
1bit/os-hw-probe-drivers

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Owner, after the candidate 8 boot: "Do a hardware probe and ensure all drivers are present on the usb stick."

Probe. os/mini/hwprobe.py (new, Apache-2.0) walks every bus on the build machine, which is the appliance's own board, maps each bound device to its kernel module and lists the modules the built image root does not carry. Run on strixhalo against the candidate 8 root: 80 modules in the image, 34 distinct driver modules bound on the board, 21 missing. Nine of those are built into this kernel (modprobe --show-depends resolves nothing: pcieport, i2c_designware_platform, pinctrl_amd, rtc_cmos, 8250, i8042, atkbd, tpm_crb, thermal), so they were never absent. The rest were modules the image never named.

Added to the image (mkimage.sh module list, dependencies resolved as before) and to init's load loop (BusyBox init has no udev, so nothing loads itself):

module device
usbhid, hid_generic, evdev USB keyboard and mouse (#590, already in main)
k10temp CPU temperature: what the fan logic and the release check read
i2c_piix4, spd5118 FCH SMBus and the DIMM temperature sensors
amd_pmc the power management controller
psmouse, serio_raw the PS/2 path behind i8042
btusb (+ the Bluetooth stack, 11 modules) MT7925 Bluetooth; its firmware BT_RAM_CODE_MT7925_1_1_hdr.bin is already shipped
snd_hda_intel, snd_usb_audio HDA audio and the KVM's USB audio
sdhci_pci (+ sdhci, mmc_core, cqhci) the GL9755 SD reader
intel_rapl_msr package power readings

Checked: every added module resolves for 7.3.0-rc4-1bit-perfopt with modprobe --show-depends; bash -n on both scripts; the probe runs with python3 -I. Follow-up worth doing: run hwprobe.py in the package stage and fail the build when a bound driver is missing from the image.

🤖 Generated with Claude Code

…t says which are missing

Owner, after the candidate 8 boot: do a hardware probe and make sure all drivers are on the stick.
os/mini/hwprobe.py walks every bus on the build machine (the appliance's own board), maps each bound
device to its kernel module and lists the modules the built image root does not carry. Against the
candidate 8 root it found 21 missing; 9 of them are built into this kernel (modprobe --show-depends
resolves nothing), the rest are modules the image never named: the USB keyboard set (#590), k10temp
(CPU temperature, what the fan logic and the checks read), i2c_piix4 (SMBus) and spd5118 (DIMM
sensors), amd_pmc, psmouse and serio_raw, btusb (the MT7925 Bluetooth firmware is already shipped),
snd_hda_intel and snd_usb_audio, sdhci_pci, intel_rapl_msr. All of them join mkimage.sh's module list
(dependencies resolved as before) and init.sh's load loop, since BusyBox init has no udev.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 0ab53c8)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

590 - Partially compliant

Compliant requirements:

  • usbhid, hid_generic, and evdev drivers are added to the module list in mkimage.sh
  • These drivers are loaded in init.sh before the console and menu start
  • The console keyboard should now work as the necessary USB HID drivers are included

Non-compliant requirements:

  • The PR description mentions that the hardware probe script hwprobe.py was added to identify missing drivers, but this is not explicitly verified in the code diff

Requires further human verification:

  • Verification that the hardware probe script correctly identifies all missing drivers on the build machine
  • Confirmation that the added drivers are sufficient for the console keyboard to function properly
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential Incomplete Driver Detection

The hwprobe.py script may not detect all bound drivers on the build machine, as it only checks specific bus types. It could miss drivers bound on other buses or those that do not have a standard device path structure. This could lead to missing drivers that are actually needed for the appliance to function correctly.

for bus in ("pci","usb","platform","acpi","i2c","serio","hid","spi","mmc","sdio","thunderbolt","typec","usb-serial","nvme","scsi","input","pnp"):
    for dev in sorted(glob.glob(f"/sys/bus/{bus}/devices/*")):
        drv = os.path.join(dev, "driver")
        if not os.path.islink(drv): continue
        drvname = os.path.basename(os.readlink(drv))
        modlink = os.path.join(drv, "module")
        mod = os.path.basename(os.readlink(modlink)) if os.path.islink(modlink) else "(built-in)"
        desc = ""
        if bus == "pci":
            try:
                out = subprocess.run(["lspci","-s",os.path.basename(dev)], capture_output=True, text=True).stdout.strip()
                desc = out.split(" ",1)[1][:70] if " " in out else out
            except Exception: pass
        elif bus == "usb":
            for f in ("product","manufacturer"):
                p = os.path.join(dev,f)
                if os.path.exists(p): desc += open(p).read().strip()[:30]+" "
        elif bus in ("platform","acpi","i2c","serio","hid","pnp"):
            desc = os.path.basename(dev)[:40]
        rows.append((bus, os.path.basename(dev), drvname, mod, desc.strip()))
Module List Hardcoding

The module list in mkimage.sh is hardcoded, which makes it difficult to maintain and update. If new drivers are needed in the future, the list must be manually updated, increasing the chance of human error and potentially missing critical drivers.

mods="nvme ahci amd_pmf amdgpu amdxdna r8169 realtek mt7925e xhci_pci usb_storage uas sd_mod vfat ext4 nls_iso8859_1 nls_cp437 nls_ascii virtio_net virtio_blk thunderbolt thunderbolt_net typec ucsi_acpi typec_displayport usbhid hid_generic evdev k10temp i2c_piix4 amd_pmc psmouse serio_raw btusb snd_hda_intel snd_usb_audio sdhci_pci intel_rapl_msr spd5118"
for m in $mods; do
    modprobe -S "$kver" --show-depends "$m" 2>/dev/null | awk '$1 == "insmod" {print $2}'
done | sort -u | while read -r ko; do mkdir -p "$root$(dirname "$ko")"; cp "$ko" "$root$ko"; done

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 0ab53c8

@bong-water-water-bong
bong-water-water-bong merged commit 09b6284 into main Oct 26, 2026
8 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/os-hw-probe-drivers branch October 26, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant