AHCI storage for laptop images, plaintext password fix
Laptop images now use AHCI storage + e1000 network instead of VirtIO. This fixes "inaccessible boot device" on real hardware — the AHCI→NVMe driver transition is handled by Windows, unlike VirtIO→NVMe which isn't. - makeImage: useAHCI flag switches disk to ide-hd and network to e1000 - customizeImage: auto-detects useAHCI from original image, propagates it - win10/win11 laptop images: useAHCI = true - vmix run: --ahci flag for running laptop images in QEMU - generalize: PlainText password tags in OOBE unattend XML Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
89a0673f54
commit
bfca98166a
6 changed files with 27 additions and 11 deletions
10
flake.nix
10
flake.nix
|
|
@ -77,10 +77,12 @@
|
||||||
RUN_INPUT="$1"; shift
|
RUN_INPUT="$1"; shift
|
||||||
RUN_MEM=4096
|
RUN_MEM=4096
|
||||||
RUN_SMP=4
|
RUN_SMP=4
|
||||||
|
RUN_AHCI=false
|
||||||
while [[ ''${#} -gt 0 ]]; do
|
while [[ ''${#} -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--mem) RUN_MEM="$2"; shift 2 ;;
|
--mem) RUN_MEM="$2"; shift 2 ;;
|
||||||
--smp) RUN_SMP="$2"; shift 2 ;;
|
--smp) RUN_SMP="$2"; shift 2 ;;
|
||||||
|
--ahci) RUN_AHCI=true; shift ;;
|
||||||
*) echo "Unknown option: $1"; exit 1 ;;
|
*) echo "Unknown option: $1"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
@ -115,8 +117,12 @@
|
||||||
-drive if=pflash,format=raw,file=/tmp/vmix-run-vars-$$.fd \
|
-drive if=pflash,format=raw,file=/tmp/vmix-run-vars-$$.fd \
|
||||||
-rtc base=localtime,clock=host \
|
-rtc base=localtime,clock=host \
|
||||||
-device qemu-xhci -device usb-tablet \
|
-device qemu-xhci -device usb-tablet \
|
||||||
-drive file="$RUN_IMAGE",format=qcow2,if=virtio,snapshot=on \
|
$(if [[ "$RUN_AHCI" == "true" ]]; then
|
||||||
-nic user,model=virtio-net-pci \
|
echo "-drive file=$RUN_IMAGE,format=qcow2,if=none,id=disk0,snapshot=on -device ide-hd,drive=disk0"
|
||||||
|
else
|
||||||
|
echo "-drive file=$RUN_IMAGE,format=qcow2,if=virtio,snapshot=on"
|
||||||
|
fi) \
|
||||||
|
-nic user,model=$(if [[ "$RUN_AHCI" == "true" ]]; then echo e1000; else echo virtio-net-pci; fi) \
|
||||||
-device virtio-serial-pci \
|
-device virtio-serial-pci \
|
||||||
-chardev spicevmc,id=vdagent,debug=0,name=vdagent \
|
-chardev spicevmc,id=vdagent,debug=0,name=vdagent \
|
||||||
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0
|
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
customImageName = (if name != "" then name else "custom") + "-${originalImageName}-vmix.qcow2";
|
customImageName = (if name != "" then name else "custom") + "-${originalImageName}-vmix.qcow2";
|
||||||
resultImg = "./disk.qcow2";
|
resultImg = "./disk.qcow2";
|
||||||
|
|
||||||
|
isAHCI = originalImage.useAHCI or false;
|
||||||
hasRegistry = windowsRegistry != "";
|
hasRegistry = windowsRegistry != "";
|
||||||
hasAuditScript = auditScript != "";
|
hasAuditScript = auditScript != "";
|
||||||
|
|
||||||
|
|
@ -98,9 +99,11 @@
|
||||||
-drive if=pflash,format=raw,file=vars.fd \
|
-drive if=pflash,format=raw,file=vars.fd \
|
||||||
-rtc base=localtime,clock=host \
|
-rtc base=localtime,clock=host \
|
||||||
-device qemu-xhci -device usb-tablet \
|
-device qemu-xhci -device usb-tablet \
|
||||||
-drive file=${resultImg},format=qcow2,if=virtio \
|
${if isAHCI
|
||||||
|
then "-drive file=${resultImg},format=qcow2,if=none,id=disk0 -device ide-hd,drive=disk0"
|
||||||
|
else "-drive file=${resultImg},format=qcow2,if=virtio"} \
|
||||||
${cdromArgs} \
|
${cdromArgs} \
|
||||||
-nic user,model=virtio-net-pci"
|
-nic user,model=${if isAHCI then "e1000" else "virtio-net-pci"}"
|
||||||
|
|
||||||
timeout 1800 qemu-system-x86_64 $VMIX_DISPLAY $QEMU_ARGS || \
|
timeout 1800 qemu-system-x86_64 $VMIX_DISPLAY $QEMU_ARGS || \
|
||||||
if [[ "$VMIX_DISPLAY" == "-display sdl" ]]; then
|
if [[ "$VMIX_DISPLAY" == "-display sdl" ]]; then
|
||||||
|
|
@ -127,4 +130,4 @@
|
||||||
requiredSystemFeatures = [ "kvm" ];
|
requiredSystemFeatures = [ "kvm" ];
|
||||||
} // lib.optionalAttrs impure { __noChroot = true; }) builderCommand;
|
} // lib.optionalAttrs impure { __noChroot = true; }) builderCommand;
|
||||||
in
|
in
|
||||||
builtImage // { _vmixOsType = "windows"; }
|
builtImage // { _vmixOsType = "windows"; useAHCI = isAHCI; }
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
smp ? 4,
|
smp ? 4,
|
||||||
memSize ? 4096,
|
memSize ? 4096,
|
||||||
vncDisplay ? null, # e.g. ":10" to enable VNC on port 5910 for monitoring
|
vncDisplay ? null, # e.g. ":10" to enable VNC on port 5910 for monitoring
|
||||||
|
useAHCI ? false, # use AHCI storage instead of VirtIO (for physical hardware deployment)
|
||||||
windowsVersionForVirtioDrivers ? "w10", # "w10", "w11", "2k22", "2k19", etc.
|
windowsVersionForVirtioDrivers ? "w10", # "w10", "w11", "2k22", "2k19", etc.
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -65,10 +66,12 @@ let
|
||||||
-drive if=pflash,format=raw,file=vars.fd \
|
-drive if=pflash,format=raw,file=vars.fd \
|
||||||
-rtc base=localtime,clock=host \
|
-rtc base=localtime,clock=host \
|
||||||
-device qemu-xhci -device usb-tablet \
|
-device qemu-xhci -device usb-tablet \
|
||||||
-drive file=disk.qcow2,format=qcow2,if=virtio \
|
${if useAHCI
|
||||||
|
then "-drive file=disk.qcow2,format=qcow2,if=none,id=disk0 -device ide-hd,drive=disk0"
|
||||||
|
else "-drive file=disk.qcow2,format=qcow2,if=virtio"} \
|
||||||
-drive file=${iso},media=cdrom,readonly=on \
|
-drive file=${iso},media=cdrom,readonly=on \
|
||||||
-drive file=${drivers.virtio-iso},media=cdrom,readonly=on \
|
-drive file=${drivers.virtio-iso},media=cdrom,readonly=on \
|
||||||
-nic user,model=virtio-net-pci"
|
-nic user,model=${if useAHCI then "e1000" else "virtio-net-pci"}"
|
||||||
|
|
||||||
timeout 3600 qemu-system-x86_64 $VMIX_DISPLAY $QEMU_ARGS || \
|
timeout 3600 qemu-system-x86_64 $VMIX_DISPLAY $QEMU_ARGS || \
|
||||||
if [[ "$VMIX_DISPLAY" == "-display sdl" ]]; then
|
if [[ "$VMIX_DISPLAY" == "-display sdl" ]]; then
|
||||||
|
|
@ -82,4 +85,4 @@ let
|
||||||
echo "=== vmix: ${name} install complete ==="
|
echo "=== vmix: ${name} install complete ==="
|
||||||
mv disk.qcow2 $out
|
mv disk.qcow2 $out
|
||||||
'';
|
'';
|
||||||
in drv // { _vmixOsType = "windows"; }
|
in drv // { _vmixOsType = "windows"; inherit useAHCI; }
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ in
|
||||||
<LocalAccount wcm:action="add">
|
<LocalAccount wcm:action="add">
|
||||||
<Password>
|
<Password>
|
||||||
<Value>${password}</Value>
|
<Value>${password}</Value>
|
||||||
|
<PlainText>true</PlainText>
|
||||||
</Password>
|
</Password>
|
||||||
<Group>Administrators</Group>
|
<Group>Administrators</Group>
|
||||||
<Name>${username}</Name>
|
<Name>${username}</Name>
|
||||||
|
|
@ -136,6 +137,7 @@ in
|
||||||
<AutoLogon>
|
<AutoLogon>
|
||||||
<Password>
|
<Password>
|
||||||
<Value>${password}</Value>
|
<Value>${password}</Value>
|
||||||
|
<PlainText>true</PlainText>
|
||||||
</Password>
|
</Password>
|
||||||
<Enabled>true</Enabled>
|
<Enabled>true</Enabled>
|
||||||
<Username>${username}</Username>
|
<Username>${username}</Username>
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,6 @@ with windows;
|
||||||
name = "win10-ltsc-2021-laptop";
|
name = "win10-ltsc-2021-laptop";
|
||||||
upstreamISO = upstreamISOs.win10-ltsc-2021;
|
upstreamISO = upstreamISOs.win10-ltsc-2021;
|
||||||
productKey = "M7XTQ-FN8P6-TTKYV-9D4CC-J462D";
|
productKey = "M7XTQ-FN8P6-TTKYV-9D4CC-J462D";
|
||||||
|
useAHCI = true;
|
||||||
}) templates.bundles.laptop;
|
}) templates.bundles.laptop;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ with windows;
|
||||||
upstreamISO = upstreamISOs.win11-ltsc-2024;
|
upstreamISO = upstreamISOs.win11-ltsc-2024;
|
||||||
productKey = "M7XTQ-FN8P6-TTKYV-9D4CC-J462D";
|
productKey = "M7XTQ-FN8P6-TTKYV-9D4CC-J462D";
|
||||||
bypassRequirements = true;
|
bypassRequirements = true;
|
||||||
|
useAHCI = true;
|
||||||
windowsVersionForVirtioDrivers = "w11";
|
windowsVersionForVirtioDrivers = "w11";
|
||||||
}) (templates.bundles.laptop ++ [ templates.reg.disableUCPD ]);
|
}) (templates.bundles.laptop ++ [ templates.reg.disableUCPD ]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue