Skip to content

Commit

Permalink
get UEFI ISO built with ADK
Browse files Browse the repository at this point in the history
  • Loading branch information
Default User committed Feb 14, 2024
1 parent e39aa2c commit 7a2faab
Show file tree
Hide file tree
Showing 19 changed files with 165 additions and 423 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ The Windows worker can run Linux commands using Windows Subsystem for Linux.
| Name | Type | Script Reference | Comment |
| ---- | ---- | ---------------- | ------- |
| Automation Worker Windows Base Directory | Text | `automationworkerwindowsbasedirectory` | Base directory for deploying temporary files to build the ISO on a Windows Worker.<br><br>eg. "C:/attune_auto_installer" |
| Automation Worker Windows Base Directory Share Path | Text | `automationworkerwindowsbasedirectorysharepath` | eg. "/c$/attune_auto_installer" |
| Automation Worker Windows Node | Windows Node | `automationworkerwindowsnode` | The Windows automation worker node used to perform tasks to create the ISO. |
| Automation Worker Windows User: Administrator | Windows Credential | `automationworkerwindowsuseradministrator` | Administrator user on the Windows Automation Worker node. |
| Drivers and Autounattend Drive Letter | Text | `driversandautounattenddriveletter` | The Windows drive letter containing the drivers and autounattend.xml as a single letter.<br><br>This will be different for each install method.<br>D for "Single ISO"<br>E for "Dual ISO"<br>X for "WinPE ISO" |
Expand All @@ -156,6 +155,7 @@ The Windows worker can run Linux commands using Windows Subsystem for Linux.
| Post Install Setup Script Drive Letter | Text | `postinstallsetupscriptdriveletter` | The Windows drive letter containing the Post Install PowerShell setup script post_install_setup.ps1 as a single letter as seen by the Windows installer.<br><br>This will be different for each install method.<br><br>D for "Single ISO"<br>E for "Dual ISO"<br>C for "WinPE ISO" |
| Samba Server IP Address | Text | `sambaserveripaddress` | |
| Windows Folder On Samba | Text | `windowsfolderonsamba` | The Windows folder on the Samba server. This parameter is used by startnet.cmd and can take these values:<br><br>- windows10<br>- windows2016<br>- windows2019<br>- windows2022 |
| Automation Worker Windows Base Directory Share Path | Text | `automationworkerwindowsbasedirectorysharepath` | Base directory for deploying temporary files to build the ISO on a Windows Worker.<br><br>eg. "/c$/attune_auto_installer" |



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,10 @@ <h3 id="cleanupbuildfilesandisosonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$DIR=&quot;C:\attuneautomationworker\build-{newOsNode.fqn}&quot;
$DIR=&quot;{automationWorkerWindowsBaseDirectory}\build-{newOsNode.fqn}&quot;

if (Test-Path $DIR) {
Remove-Path -Recursive $DIR
Remove-Item $DIR -Recurse -Force -Verbose
}
</code>
</pre>
Expand Down Expand Up @@ -993,7 +993,7 @@ <h3 id="extractwindowsbootimgonwindowsworker">
<code class="language-sql py-0">
if (${{isBiosBoot}}) {

$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;


Expand Down Expand Up @@ -1081,7 +1081,7 @@ <h3 id="extractwindowsisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;

Set-Location $BUILD_DIR
Expand Down Expand Up @@ -1156,7 +1156,7 @@ <h3 id="copyefisysnopromptbinintoefisysbinonwindowsworker">
<code class="language-sql py-0">
if ( ${{isUefiBoot}} ) {

$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;

Set-Location $BUILD_DIR
Expand Down Expand Up @@ -1225,7 +1225,7 @@ <h3 id="createbiosbootisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_FOLDER=&quot;build-{newOsNode.fqn}&quot;

# This is so we place the &quot;attune_wsl_create_bios_boot_iso.sh&quot; outside the $BUILD_FOLDER
Expand Down Expand Up @@ -1327,49 +1327,23 @@ <h3 id="createuefibootisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_FOLDER=&quot;build-{newOsNode.fqn}&quot;

# This is so we place the &quot;tmpBash.sh&quot; outside the $BUILD_FOLDER
# Set location to ISO_BUILD
Set-Location $ISO_BUILD

if ( ${{isUefiBoot}} ) {
$isoName = &quot;kickstart_{newOsNode.fqn}.iso&quot;
$bootData = &quot;2#p0,e,b${BUILD_FOLDER}\boot\etfsboot.com#pEF,e,b${BUILD_FOLDER}\efi\microsoft\boot\efisys.bin&quot;

$scriptContent=@&quot;
mkisofs \
-allow-limited-size \
-iso-level 4 \
-full-iso9660-filenames \
-rock \
-b boot/etfsboot.com \
-no-emul-boot \
-boot-load-seg 0 \
-boot-load-size 8 \
-hide boot.catalog \
-eltorito-alt-boot \
-no-emul-boot \
-b efi/microsoft/boot/efisys.bin \
-boot-load-size 1 \
-udf \
-untranslated-filenames \
-disable-deep-relocation \
-o kickstart_{newOsNode.fqn}.iso \
&#x27;${BUILD_FOLDER}&#x27;
&quot;@

# Replace CRLF with LF
$scriptContent = $scriptContent.replace(&quot;`r`n&quot;,&quot;`n&quot;)

$FILE = &quot;attune_wsl_create_uefi_boot_iso.sh&quot;

Set-Content -Path $FILE -NoNewline -Value $scriptContent

wsl -d Ubuntu --user root --exec bash &quot;${FILE}&quot;
# Command to create UEFI compatible ISO
&amp; &quot;C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe&quot; `
-m -o -u2 -udfver102 -bootdata:$bootData &quot;${BUILD_FOLDER}&quot; $isoName

if ($LASTEXITCODE -ne 0) {
Write-Error &#x27;Failed to extract boot.img&#x27;
Write-Error &#x27;Failed to create UEFI boot ISO&#x27;
}

} else {
Write-Host &quot;Skipping for BIOS boot.&quot;
}
Expand Down Expand Up @@ -1551,12 +1525,12 @@ <h3 id="copydriversdropinfolderonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;${ISO_BUILD}\build-{newOsNode.fqn}&quot;

Set-Location &quot;${BUILD_DIR}&quot;

$DRIVERS_DROP_IN_FOLDER = &quot;C:\attuneautomationworker\drivers-{newOsNode.fqn}&quot;
$DRIVERS_DROP_IN_FOLDER = &quot;{automationWorkerWindowsBaseDirectory}\drivers-{newOsNode.fqn}&quot;
$DESTINATION_DRIVERS_FOLDER = &quot;drivers&quot;

if ( -Not (Test-Path &quot;${DESTINATION_DRIVERS_FOLDER}&quot;) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,10 +868,10 @@ <h3 id="cleanupbuildfilesandisosonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$DIR=&quot;C:\attuneautomationworker\build-{newOsNode.fqn}&quot;
$DIR=&quot;{automationWorkerWindowsBaseDirectory}\build-{newOsNode.fqn}&quot;

if (Test-Path $DIR) {
Remove-Path -Recursive $DIR
Remove-Item $DIR -Recurse -Force -Verbose
}
</code>
</pre>
Expand Down Expand Up @@ -992,7 +992,7 @@ <h3 id="extractwindowsbootimgonwindowsworker">
<code class="language-sql py-0">
if (${{isBiosBoot}}) {

$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;


Expand Down Expand Up @@ -1080,7 +1080,7 @@ <h3 id="extractwindowsisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;

Set-Location $BUILD_DIR
Expand Down Expand Up @@ -1277,12 +1277,12 @@ <h3 id="copydriversdropinfolderonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;${ISO_BUILD}\build-{newOsNode.fqn}&quot;

Set-Location &quot;${BUILD_DIR}&quot;

$DRIVERS_DROP_IN_FOLDER = &quot;C:\attuneautomationworker\drivers-{newOsNode.fqn}&quot;
$DRIVERS_DROP_IN_FOLDER = &quot;{automationWorkerWindowsBaseDirectory}\drivers-{newOsNode.fqn}&quot;
$DESTINATION_DRIVERS_FOLDER = &quot;drivers&quot;

if ( -Not (Test-Path &quot;${DESTINATION_DRIVERS_FOLDER}&quot;) ) {
Expand Down Expand Up @@ -1352,7 +1352,7 @@ <h3 id="copyefisysnopromptbinintoefisysbinonwindowsworker">
<code class="language-sql py-0">
if ( ${{isUefiBoot}} ) {

$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;

Set-Location $BUILD_DIR
Expand Down Expand Up @@ -1421,7 +1421,7 @@ <h3 id="createbiosbootisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_FOLDER=&quot;build-{newOsNode.fqn}&quot;

# This is so we place the &quot;attune_wsl_create_bios_boot_iso.sh&quot; outside the $BUILD_FOLDER
Expand Down Expand Up @@ -1523,49 +1523,23 @@ <h3 id="createuefibootisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_FOLDER=&quot;build-{newOsNode.fqn}&quot;

# This is so we place the &quot;tmpBash.sh&quot; outside the $BUILD_FOLDER
# Set location to ISO_BUILD
Set-Location $ISO_BUILD

if ( ${{isUefiBoot}} ) {
$isoName = &quot;kickstart_{newOsNode.fqn}.iso&quot;
$bootData = &quot;2#p0,e,b${BUILD_FOLDER}\boot\etfsboot.com#pEF,e,b${BUILD_FOLDER}\efi\microsoft\boot\efisys.bin&quot;

$scriptContent=@&quot;
mkisofs \
-allow-limited-size \
-iso-level 4 \
-full-iso9660-filenames \
-rock \
-b boot/etfsboot.com \
-no-emul-boot \
-boot-load-seg 0 \
-boot-load-size 8 \
-hide boot.catalog \
-eltorito-alt-boot \
-no-emul-boot \
-b efi/microsoft/boot/efisys.bin \
-boot-load-size 1 \
-udf \
-untranslated-filenames \
-disable-deep-relocation \
-o kickstart_{newOsNode.fqn}.iso \
&#x27;${BUILD_FOLDER}&#x27;
&quot;@

# Replace CRLF with LF
$scriptContent = $scriptContent.replace(&quot;`r`n&quot;,&quot;`n&quot;)

$FILE = &quot;attune_wsl_create_uefi_boot_iso.sh&quot;

Set-Content -Path $FILE -NoNewline -Value $scriptContent

wsl -d Ubuntu --user root --exec bash &quot;${FILE}&quot;
# Command to create UEFI compatible ISO
&amp; &quot;C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe&quot; `
-m -o -u2 -udfver102 -bootdata:$bootData &quot;${BUILD_FOLDER}&quot; $isoName

if ($LASTEXITCODE -ne 0) {
Write-Error &#x27;Failed to extract boot.img&#x27;
Write-Error &#x27;Failed to create UEFI boot ISO&#x27;
}

} else {
Write-Host &quot;Skipping for BIOS boot.&quot;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,10 @@ <h3 id="cleanupbuildfilesandisosonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$DIR=&quot;C:\attuneautomationworker\build-{newOsNode.fqn}&quot;
$DIR=&quot;{automationWorkerWindowsBaseDirectory}\build-{newOsNode.fqn}&quot;

if (Test-Path $DIR) {
Remove-Path -Recursive $DIR
Remove-Item $DIR -Recurse -Force -Verbose
}
</code>
</pre>
Expand Down Expand Up @@ -863,7 +863,7 @@ <h3 id="deploywin11dvdisoonwindowsworker">
</div>
<div class="row py-1">
<code class="language-bash">
/c$/attuneautomationworker/build-{newOsNode.fqn}
{automationWorkerWindowsBaseDirectorySharePath}/build-{newOsNode.fqn}, relative to the home directory
</code>
</div>

Expand Down Expand Up @@ -923,7 +923,7 @@ <h3 id="extractwindowsbootimgonwindowsworker">
<code class="language-sql py-0">
if (${{isBiosBoot}}) {

$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;


Expand Down Expand Up @@ -1011,7 +1011,7 @@ <h3 id="extractwindowsisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;

Set-Location $BUILD_DIR
Expand Down Expand Up @@ -1208,12 +1208,12 @@ <h3 id="copydriversdropinfolderonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;${ISO_BUILD}\build-{newOsNode.fqn}&quot;

Set-Location &quot;${BUILD_DIR}&quot;

$DRIVERS_DROP_IN_FOLDER = &quot;C:\attuneautomationworker\drivers-{newOsNode.fqn}&quot;
$DRIVERS_DROP_IN_FOLDER = &quot;{automationWorkerWindowsBaseDirectory}\drivers-{newOsNode.fqn}&quot;
$DESTINATION_DRIVERS_FOLDER = &quot;drivers&quot;

if ( -Not (Test-Path &quot;${DESTINATION_DRIVERS_FOLDER}&quot;) ) {
Expand Down Expand Up @@ -1283,7 +1283,7 @@ <h3 id="copyefisysnopromptbinintoefisysbinonwindowsworker">
<code class="language-sql py-0">
if ( ${{isUefiBoot}} ) {

$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_DIR=&quot;$ISO_BUILD\build-{newOsNode.fqn}&quot;

Set-Location $BUILD_DIR
Expand Down Expand Up @@ -1352,7 +1352,7 @@ <h3 id="createbiosbootisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_FOLDER=&quot;build-{newOsNode.fqn}&quot;

# This is so we place the &quot;attune_wsl_create_bios_boot_iso.sh&quot; outside the $BUILD_FOLDER
Expand Down Expand Up @@ -1454,49 +1454,23 @@ <h3 id="createuefibootisoonwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$ISO_BUILD=&quot;C:\attuneautomationworker&quot;
$ISO_BUILD=&quot;{automationWorkerWindowsBaseDirectory}&quot;
$BUILD_FOLDER=&quot;build-{newOsNode.fqn}&quot;

# This is so we place the &quot;tmpBash.sh&quot; outside the $BUILD_FOLDER
# Set location to ISO_BUILD
Set-Location $ISO_BUILD

if ( ${{isUefiBoot}} ) {
$isoName = &quot;kickstart_{newOsNode.fqn}.iso&quot;
$bootData = &quot;2#p0,e,b${BUILD_FOLDER}\boot\etfsboot.com#pEF,e,b${BUILD_FOLDER}\efi\microsoft\boot\efisys.bin&quot;

$scriptContent=@&quot;
mkisofs \
-allow-limited-size \
-iso-level 4 \
-full-iso9660-filenames \
-rock \
-b boot/etfsboot.com \
-no-emul-boot \
-boot-load-seg 0 \
-boot-load-size 8 \
-hide boot.catalog \
-eltorito-alt-boot \
-no-emul-boot \
-b efi/microsoft/boot/efisys.bin \
-boot-load-size 1 \
-udf \
-untranslated-filenames \
-disable-deep-relocation \
-o kickstart_{newOsNode.fqn}.iso \
&#x27;${BUILD_FOLDER}&#x27;
&quot;@

# Replace CRLF with LF
$scriptContent = $scriptContent.replace(&quot;`r`n&quot;,&quot;`n&quot;)

$FILE = &quot;attune_wsl_create_uefi_boot_iso.sh&quot;

Set-Content -Path $FILE -NoNewline -Value $scriptContent

wsl -d Ubuntu --user root --exec bash &quot;${FILE}&quot;
# Command to create UEFI compatible ISO
&amp; &quot;C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe&quot; `
-m -o -u2 -udfver102 -bootdata:$bootData &quot;${BUILD_FOLDER}&quot; $isoName

if ($LASTEXITCODE -ne 0) {
Write-Error &#x27;Failed to extract boot.img&#x27;
Write-Error &#x27;Failed to create UEFI boot ISO&#x27;
}

} else {
Write-Host &quot;Skipping for BIOS boot.&quot;
}
Expand Down
Loading

0 comments on commit 7a2faab

Please sign in to comment.