50 lines
1.9 KiB
PowerShell
50 lines
1.9 KiB
PowerShell
# Сборка двух маленьких EFI (i386-efi) для ia32 Xorboot:
|
|
# ventoy32.efi — находит Ventoy на VTOYEFI и передаёт ему управление
|
|
# krd32.efi — грузит KRD 24 (vmlinuz + initrd + live-boot)
|
|
$ErrorActionPreference = 'Stop'
|
|
$grub = 'C:\PF\grub2-a1ive\grub'
|
|
$dir = "$grub\i386-efi"
|
|
$out = 'C:\PF\KRD\images'
|
|
New-Item -ItemType Directory -Force $out | Out-Null
|
|
|
|
$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/vtoyjump32.exe',
|
|
'if [ -z "$vtoy" ]; then',
|
|
' search --no-floppy --file --set=vtoy /ventoy/ventoy_x86.cpio',
|
|
'fi',
|
|
'if [ -n "$vtoy" ]; then',
|
|
' chainloader ($vtoy)/EFI/BOOT/grubia32.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 @(@('ventoy32.efi', $cfgVentoy), @('krd32.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 i386-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 }
|
|
}
|