From 384a45f70e721a4421d7db3f72b0820f4e1fcc35 Mon Sep 17 00:00:00 2001 From: nocode Date: Thu, 9 Jul 2026 15:57:52 +0200 Subject: [PATCH] feat(fws-windows-deploy): add intel vmd driver injection support Add support for injecting Intel VMD drivers during Windows deployment. The script now: - Parses the intel_vmd configuration option from the state file - Checks for Intel VMD drivers in /usr/local/share/fws/drivers/intel-vmd/ - Injects drivers via WinPE (dism) when requested and available - Falls back to Windows inbox VMD driver with a warning if no driver found - Forces WinPE path when VMD driver injection is needed - Passes driver path to fws-windows-bcdfix for processing --- .../airootfs/usr/local/bin/fws-windows-deploy | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/configs/releng/airootfs/usr/local/bin/fws-windows-deploy b/configs/releng/airootfs/usr/local/bin/fws-windows-deploy index 6114728..3d328b3 100644 --- a/configs/releng/airootfs/usr/local/bin/fws-windows-deploy +++ b/configs/releng/airootfs/usr/local/bin/fws-windows-deploy @@ -39,7 +39,7 @@ part_dev(){ case "$1" in *[0-9]) printf '%sp%s' "$1" "$2";; *) printf '%s%s' "$1 # --- 0) État du spoke : PARSÉ en clé=valeur littéral (JAMAIS sourcé) [M3] ----- [ -r "$STATE" ] || { log "pas de $STATE → dual-boot non demandé, rien à faire."; exit 0; } -enabled=0; disk=""; size_gib=0; iso=""; edition=""; confirm_erase=0 +enabled=0; disk=""; size_gib=0; iso=""; edition=""; confirm_erase=0; intel_vmd=0 while IFS='=' read -r k v; do case "$k" in enabled) enabled="$v" ;; @@ -48,6 +48,7 @@ while IFS='=' read -r k v; do iso) iso="$v" ;; edition) edition="$v" ;; confirm_erase) confirm_erase="$v" ;; + intel_vmd) intel_vmd="$v" ;; esac done < "$STATE" [ "${enabled:-0}" = 1 ] || { log "dual-boot désactivé, rien à faire."; exit 0; } @@ -183,13 +184,26 @@ mkdir -p "$ESP_MNT/EFI/Microsoft/Boot" cp -rn "$WIN_MNT/Windows/Boot/EFI/." "$ESP_MNT/EFI/Microsoft/Boot/" 2>/dev/null || true WIN_PARTUUID="$(blkid -s PARTUUID -o value "$WIN_PART" 2>/dev/null)" DISK_GUID="$(sgdisk -p "$WIN_DISK" 2>/dev/null | sed -n 's/^Disk identifier (GUID): *//p')" -if /usr/local/lib/fws/fws-bcd-write "$ESP_MNT" "$WIN_MNT" "$WIN_PARTUUID" "$DISK_GUID"; then +# Pilote Intel VMD à injecter ? (case cochée dans le spoke + .inf présents). +DRV="" +if [ "${intel_vmd:-0}" = 1 ]; then + if ls /usr/local/share/fws/drivers/intel-vmd/*.inf >/dev/null 2>&1; then + DRV=/usr/local/share/fws/drivers/intel-vmd + log "Intel VMD demandé + pilote présent → injection via WinPE (dism)." + else + warn "Intel VMD demandé mais AUCUN pilote dans .../drivers/intel-vmd/ — Windows tentera son pilote VMD inbox (25H2). Dépose le pilote Intel si le boot échoue." + fi +fi +# Avec un pilote VMD à injecter, on FORCE la voie WinPE (dism y tourne). Sinon +# hivex (qui bascule de toute façon sur WinPE tant que non validé). +if [ -z "$DRV" ] && /usr/local/lib/fws/fws-bcd-write "$ESP_MNT" "$WIN_MNT" "$WIN_PARTUUID" "$DISK_GUID"; then log "BCD écrit (voie hivex)." BCDFIX=0 else - warn "Voie hivex non validée → repli WinPE-bcdboot (1 reboot auto)." + [ -n "$DRV" ] && log "Bascule WinPE (bcdboot + injection pilote VMD)." \ + || warn "Voie hivex non validée → repli WinPE-bcdboot (1 reboot auto)." umount "$WIN_MNT" 2>/dev/null || true - /usr/local/bin/fws-windows-bcdfix "$ISO_MNT" "$ESP_MNT" "$WIN_DISK" 1 \ + /usr/local/bin/fws-windows-bcdfix "$ISO_MNT" "$ESP_MNT" "$WIN_DISK" 1 "$DRV" \ || die "repli WinPE-bcdfix a échoué — Windows non bootable (FWS reste seul bootable)" BCDFIX=1 mount "$WIN_PART" "$WIN_MNT" 2>/dev/null || die "remontage NTFS échoué"