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

31 lines
1.3 KiB
PowerShell

# Финальные переходники KRD (с командой boot) для ia32 и x64.
$ErrorActionPreference = 'Stop'
$grub = 'C:\PF\grub2-a1ive\grub'
$out = 'C:\PF\KRD\images'
$mods = 'normal search search_fs_file chain part_msdos part_gpt fat ntfs exfat configfile echo test linux'
$cfg = @(
'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',
' boot',
'fi'
) -join "`n"
foreach ($arch in @(@('krd32.efi','i386-efi'), @('krd64.efi','x86_64-efi'))) {
$efi = $arch[0]; $platform = $arch[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=$grub\$platform" -O $platform -o $o `
"--modules=$mods" "boot/grub/grub.cfg=$cfgPath" 2>&1 | Select-Object -First 5
' {0}: {1:N0} байт' -f $efi,(Get-Item $o).Length
}