1
0

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 <stkn@bitplumber.de>
This commit is contained in:
2026-05-26 18:50:02 +02:00
parent f1c1713726
commit 2bb7c65869
+19 -13
View File
@@ -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) {