From 2bb7c658698d95a98ed0f2151b3396a89b9b9773 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 26 May 2026 18:50:02 +0200 Subject: [PATCH] Apply custom modification to nano11 builder script - Switch to noprompt EFI bootloader - The regular Win 11 setup application does not work for nano11, switch to the same one tiny11core uses - Remove autounattend.xml as we'll bring our own Signed-off-by: Stefan Knoblich --- bootstrap/nano11builder-headless.ps1 | 32 +++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/bootstrap/nano11builder-headless.ps1 b/bootstrap/nano11builder-headless.ps1 index 8974c56..54e9db6 100644 --- a/bootstrap/nano11builder-headless.ps1 +++ b/bootstrap/nano11builder-headless.ps1 @@ -830,12 +830,13 @@ function Apply-RegistryTweaks { # Enable local accounts on OOBE Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE' 'BypassNRO' 'REG_DWORD' '1' + # stkn: Disable autounattend.xml, we'll bring out own instead # Copy autounattend-nano.xml as autounattend.xml - $nanoAutoUnattend = Join-Path (Split-Path $PSScriptRoot -Parent) "autounattend-nano.xml" - if (Test-Path $nanoAutoUnattend) { - Copy-Item -Path $nanoAutoUnattend -Destination "$scratchDir\Windows\System32\Sysprep\autounattend.xml" -Force - Write-Log "Copied autounattend-nano.xml to Sysprep" - } + # $nanoAutoUnattend = Join-Path (Split-Path $PSScriptRoot -Parent) "autounattend-nano.xml" + # if (Test-Path $nanoAutoUnattend) { + # Copy-Item -Path $nanoAutoUnattend -Destination "$scratchDir\Windows\System32\Sysprep\autounattend.xml" -Force + # Write-Log "Copied autounattend-nano.xml to Sysprep" + # } # Disable reserved storage Set-RegistryValue 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager' 'ShippedWithReserves' 'REG_DWORD' '0' @@ -1063,6 +1064,9 @@ function Process-BootImage { Set-RegistryValue 'HKLM\zSYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 'REG_DWORD' '1' Set-RegistryValue 'HKLM\zSYSTEM\ControlSet001\Control\BitLocker' 'PreventDeviceEncryption' 'REG_DWORD' '1' + # stkn: Switch to old-style setup application, which works for nano11 (same as tiny11core) + Set-RegistryValue 'HKLM\zSYSTEM\Setup' 'CmdLine' 'REG_SZ' 'x:\sources\setup.exe' + # Unload registry reg unload HKLM\zNTUSER 2>&1 | Out-Null reg unload HKLM\zDEFAULT 2>&1 | Out-Null @@ -1096,7 +1100,7 @@ function Convert-ToESD { function Clean-IsoRoot { Write-Log "Cleaning ISO root (keeping only essentials)..." - $keepList = @("boot", "efi", "sources", "bootmgr", "bootmgr.efi", "setup.exe", "autounattend.xml") + $keepList = @("boot", "efi", "sources", "bootmgr", "bootmgr.efi", "setup.exe") Get-ChildItem -Path $nano11Dir | Where-Object { $_.Name -notin $keepList } | ForEach-Object { Write-Log "Removing from ISO root: $($_.Name)" Remove-Item -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue @@ -1108,17 +1112,19 @@ function Clean-IsoRoot { function Create-NanoISO { Write-Log "Creating ISO image..." + # stkn: Disable autounattend.xml, we'll bring out own instead # Copy autounattend-nano.xml as autounattend.xml to ISO root - $nanoAutoUnattend = Join-Path (Split-Path $PSScriptRoot -Parent) "autounattend-nano.xml" - if (Test-Path $nanoAutoUnattend) { - Copy-Item -Path $nanoAutoUnattend -Destination "$nano11Dir\autounattend.xml" -Force - Write-Log "Copied autounattend-nano.xml to ISO root as autounattend.xml" - } + # $nanoAutoUnattend = Join-Path (Split-Path $PSScriptRoot -Parent) "autounattend-nano.xml" + # if (Test-Path $nanoAutoUnattend) { + # Copy-Item -Path $nanoAutoUnattend -Destination "$nano11Dir\autounattend.xml" -Force + # Write-Log "Copied autounattend-nano.xml to ISO root as autounattend.xml" + # } + # stkn: Switch to noprompt efi version # Verify boot files $bootFiles = @( "$nano11Dir\boot\etfsboot.com", - "$nano11Dir\efi\microsoft\boot\efisys.bin" + "$nano11Dir\efi\microsoft\boot\efisys_noprompt.bin" ) foreach ($bootFile in $bootFiles) { if (-not (Test-Path $bootFile)) { @@ -1145,7 +1151,7 @@ function Create-NanoISO { Write-Log "Building bootable ISO..." & $OSCDIMG '-m' '-o' '-u2' '-udfver102' ` - "-bootdata:2#p0,e,b$nano11Dir\boot\etfsboot.com#pEF,e,b$nano11Dir\efi\microsoft\boot\efisys.bin" ` + "-bootdata:2#p0,e,b$nano11Dir\boot\etfsboot.com#pEF,e,b$nano11Dir\efi\microsoft\boot\efisys_noprompt.bin" ` $nano11Dir $outputISO if (Test-Path $outputISO) {