Model the A6 crypto, interrupt, USB, and platform blocks needed to boot SecureROM through iBSS into iBEC Recovery. Add local lab identity, IMG3, and APTicket tooling, patched macOS recovery utilities, UART and GDB access, and English end-user documentation.
57 lines
1.6 KiB
PowerShell
57 lines
1.6 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[ValidateSet('Debug', 'Release')]
|
|
[string]$Configuration = 'Release'
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$projectDir = $PSScriptRoot
|
|
. (Join-Path $projectDir '..\QemuA6Ude\common.ps1')
|
|
$msvcRoot = Find-Qa6MsvcRoot
|
|
$vsInstall = (Resolve-Path (Join-Path $msvcRoot '..\..\..\..')).Path
|
|
$vsDevCmd = Join-Path $vsInstall 'Common7\Tools\VsDevCmd.bat'
|
|
$cl = Join-Path $msvcRoot 'bin\Hostx64\x64\cl.exe'
|
|
$outputDir = Join-Path $projectDir "build\$Configuration\x64"
|
|
$exePath = Join-Path $outputDir 'QemuA6UsbBridge.exe'
|
|
|
|
if (-not (Test-Path -LiteralPath $vsDevCmd -PathType Leaf)) {
|
|
throw "Visual Studio environment not found: $vsDevCmd"
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $outputDir | Out-Null
|
|
|
|
$environmentCommand = 'call "{0}" -arch=x64 -host_arch=x64 >nul && set' -f $vsDevCmd
|
|
$environmentLines = & cmd.exe /d /s /c $environmentCommand
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw 'Unable to load the x64 MSVC environment.'
|
|
}
|
|
foreach ($line in $environmentLines) {
|
|
$separator = $line.IndexOf('=')
|
|
if ($separator -gt 0) {
|
|
$name = $line.Substring(0, $separator)
|
|
$value = $line.Substring($separator + 1)
|
|
Set-Item -Path "Env:$name" -Value $value
|
|
}
|
|
}
|
|
|
|
$arguments = @('/nologo', '/W4', '/D_CRT_SECURE_NO_WARNINGS', '/MT')
|
|
if ($Configuration -eq 'Release') {
|
|
$arguments += @('/O2')
|
|
} else {
|
|
$arguments += @('/Od', '/Zi')
|
|
}
|
|
$arguments += @(
|
|
"/Fo:$outputDir\bridge.obj",
|
|
(Join-Path $projectDir 'bridge.c'),
|
|
"/Fe:$exePath",
|
|
'/link', 'ws2_32.lib'
|
|
)
|
|
|
|
& $cl @arguments
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "USB bridge build failed ($LASTEXITCODE)."
|
|
}
|
|
|
|
Write-Host "Bridge built: $exePath"
|