Files
flash-build/build-bridges64.ps1
2026-11-13 07:52:38 +03:00

46 lines
1.8 KiB
PowerShell

# 64-битные переходники + проверка наличия 32-битной прошивки OVMF в WSL.
$ErrorActionPreference = 'Stop'
$grub = 'C:\PF\grub2-a1ive\grub'
$dir = "$grub\x86_64-efi"
$out = 'C:\PF\KRD\images'
$mods = 'normal search search_fs_file chain part_msdos part_gpt fat ntfs exfat configfile echo test linux'
$cfgVentoy = @(
'set timeout=0',
'set default=0',
'search --no-floppy --file --set=vtoy /ventoy/vtoyjump64.exe',
'if [ -z "$vtoy" ]; then',
' search --no-floppy --file --set=vtoy /ventoy/ventoy.cpio',
'fi',
'if [ -n "$vtoy" ]; then',
' chainloader ($vtoy)/EFI/BOOT/fbx64.efi',
'else',
' echo "VTOYEFI not found"',
' sleep 5',
'fi'
) -join "`n"
$cfgKrd = @(
'set timeout=0',
'set default=0',
'search --no-floppy --file --set=krd /efi/Paravis/KRD/live/vmlinuz',
'if [ -z "$krd" ]; then',
' echo "KRD not found"',
' sleep 5',
'else',
' linux ($krd)/efi/Paravis/KRD/live/vmlinuz boot=live components live-media-path=/efi/Paravis/KRD/live locales=ru_RU.UTF-8',
' initrd ($krd)/efi/Paravis/KRD/live/initrd.img',
'fi'
) -join "`n"
foreach ($item in @(@('ventoy64.efi', $cfgVentoy), @('krd64.efi', $cfgKrd))) {
$efi = $item[0]; $cfg = $item[1]
$cfgPath = Join-Path $env:TEMP ("$efi.cfg")
[IO.File]::WriteAllText($cfgPath, $cfg, (New-Object System.Text.UTF8Encoding($false)))
$o = Join-Path $out $efi
if (Test-Path $o) { Remove-Item $o -Force }
& "$grub\grub-mkstandalone.exe" "--directory=$dir" -O x86_64-efi -o $o `
"--modules=$mods" "boot/grub/grub.cfg=$cfgPath" 2>&1 | Select-Object -First 6
if (Test-Path $o) { ' OK {0}: {1:N0} байт' -f $efi,(Get-Item $o).Length } else { ' FAIL {0}' -f $efi }
}