diff --git a/grub2-bios/LICENSE b/grub2-bios/LICENSE new file mode 100644 index 0000000..814759f --- /dev/null +++ b/grub2-bios/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Paravis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/grub2-bios/README.md b/grub2-bios/README.md new file mode 100644 index 0000000..062cb9d --- /dev/null +++ b/grub2-bios/README.md @@ -0,0 +1,20 @@ +# Legacy GRUB2 helper files + +Helper scripts and menu sources for the Legacy BIOS GRUB2 bootloader installed +by `Change_BootLoader.exe`. + +## Contents + +- `grub.cfg` — GRUB2 BIOS menu; +- `menu/linux.cfg`, `menu/msdart.cfg`, `menu/strelec.cfg`, `menu/utilits.cfg`; +- `prefix.cfg`; +- `make-paravis-mbr.ps1` — builds the Paravis MBR table image; +- `install-grub2-mbr.ps1` — installs GRUB2 to the MBR; +- `g4d-menu.txt` — grub4dos menu source. + +The C++ changer expects these files on the PARAVIS partition under +`\efi\Paravis\Boot\grub2\bios\`. + +## License + +MIT. diff --git a/grub2-bios/g4d-menu.txt b/grub2-bios/g4d-menu.txt new file mode 100644 index 0000000..66c7aaa --- /dev/null +++ b/grub2-bios/g4d-menu.txt @@ -0,0 +1,59 @@ +default 1 +gfxmenu (bd)/efi/Paravis/boot/g4d/grldr.gfx + +title Super Grub2 (поиск и запуск ОС) +map --unmap=0:0x03 > nul +map --unhook +find --set-root /efi/Paravis/boot/super/super.iso +map --mem /efi/Paravis/boot/super/super.iso (0xff) +map --hook +chainloader (0xff) +boot + +title Поиск и запуск Windows 7-11 +chainloader (bd)/efi/Paravis/Boot/mgr/search + +title Установка Windows 7, 10, 11 x64 +chainloader (bd)/efi/Paravis/Boot/mgr/setup64 + +title Установка Windows 7, 10 x86 +chainloader (bd)/efi/Paravis/Boot/mgr/setup86 + +title Запуск Windows 7 PE BootPass +chainloader (bd)/efi/Paravis/Boot/mgr/bootpass + +title Ventoy (ISO образы) +find --set-root /ventoy/core.img +kernel /ventoy/core.img +boot +title Kaspersky Rescue Disk 24 +set path=/efi/Paravis/KRD +set lang=ru +find --set-root %path%/live/vmlinuz +kernel %path%/live/vmlinuz boot=live components live-media-path=%path%/live locales=ru_RU.UTF-8 +initrd %path%/live/initrd.img + +title +chainloader (bd)/grldr + +title Windows 8, 10, 11 PE Sergei Strelec +chainloader (bd)/efi/Paravis/boot/g4d/boot/str + +title Утилиты для диагностики +chainloader (bd)/efi/Paravis/boot/g4d/boot/util + +title Восстановление Windows (MSDaRT) +chainloader (bd)/efi/Paravis/boot/g4d/boot/dart + +title Запуск / Установка Linux +chainloader (bd)/efi/Paravis/boot/g4d/boot/linux + +title +chainloader (bd)/grldr + +title Выключение +halt + +title Перезагрузка +reboot + diff --git a/grub2-bios/grub.cfg b/grub2-bios/grub.cfg new file mode 100644 index 0000000..d43a8a2 --- /dev/null +++ b/grub2-bios/grub.cfg @@ -0,0 +1,86 @@ +set timeout=30 +set default=1 +set p1=$root + +insmod all_video +insmod gfxterm +insmod gfxmenu +insmod ntldr +insmod linux16 +insmod linux +insmod multiboot +set gfxmode=1024x768,auto +terminal_output gfxterm +loadfont ($p1)/efi/Paravis/Boot/grub2/theme/paravis.pf2 +set theme=($p1)/efi/Paravis/Boot/grub2/theme/main/theme_bios.txt +export theme + +menuentry "Super Grub2 (поиск и запуск ОС) (1)" --hotkey=1 { + linux16 ($p1)/efi/Paravis/Boot/loaders/memdisk iso raw + initrd16 ($p1)/efi/Paravis/boot/super/super.iso + boot +} + +menuentry "Поиск и запуск Windows 7-11 (2)" --hotkey=2 { + ntldr ($p1)/efi/Paravis/Boot/mgr/search +} + +menuentry "Установка Windows 7, 10, 11 x64 (3)" --hotkey=3 { + ntldr ($p1)/efi/Paravis/Boot/mgr/setup64 +} + +menuentry "Установка Windows 7, 10 x86 (4)" --hotkey=4 { + ntldr ($p1)/efi/Paravis/Boot/mgr/setup86 +} + +menuentry "Запуск Windows 7 PE BootPass (5)" --hotkey=5 { + ntldr ($p1)/efi/Paravis/Boot/mgr/bootpass +} + +menuentry "Ventoy (ISO образы) (6)" --hotkey=6 { + set vt= + search --no-floppy --file --set=vt /ventoy/core.img + if [ -z "$vt" ]; then + echo "Ventoy не найден" + else + multiboot ($vt)/ventoy/core.img + boot + fi +} + +menuentry "Kaspersky Rescue Disk 24 (7)" --hotkey=7 { + linux ($p1)/efi/Paravis/KRD/live/vmlinuz boot=live components live-media-path=/efi/Paravis/KRD/live locales=ru_RU.UTF-8 + initrd ($p1)/efi/Paravis/KRD/live/initrd.img +} + +menuentry " " { + set sep=1 +} + +menuentry "Windows 8, 10, 11 PE Sergei Strelec (Q)" --hotkey=q { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/menu/strelec.cfg +} + +menuentry "Утилиты для диагностики (W)" --hotkey=w { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/menu/utilits.cfg +} + +menuentry "Восстановление Windows (MSDaRT) (E)" --hotkey=e { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/menu/msdart.cfg +} + +menuentry "Запуск / Установка Linux (T)" --hotkey=t { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/menu/linux.cfg +} + +menuentry " " { + set sep=1 +} + +menuentry "Перезагрузка (R)" --hotkey=r { + reboot +} + +menuentry "Выключение (S)" --hotkey=s { + halt +} diff --git a/grub2-bios/install-grub2-mbr.ps1 b/grub2-bios/install-grub2-mbr.ps1 new file mode 100644 index 0000000..cd0a065 --- /dev/null +++ b/grub2-bios/install-grub2-mbr.ps1 @@ -0,0 +1,29 @@ +param( + [Parameter(Mandatory=$true)][int]$Disk, + [Parameter(Mandatory=$true)][string]$File +) + +$ErrorActionPreference = 'Stop' + +$data = [IO.File]::ReadAllBytes($File) +if ($data.Length -lt 513) { throw "Bad GRUB2 MBR image: $File" } + +$path = "\\.\PhysicalDrive$Disk" +$fs = [IO.File]::Open($path, [IO.FileMode]::Open, [IO.FileAccess]::ReadWrite, [IO.FileShare]::ReadWrite) +try { + $mbr = New-Object byte[] 512 + $fs.Read($mbr, 0, 512) | Out-Null + + # boot code 0..439; partition table/disk signature 440..511 остаются от целевого диска + [Array]::Copy($data, 0, $mbr, 0, 440) + $fs.Position = 0 + $fs.Write($mbr, 0, 512) + + # core.img (уже с Reed-Solomon, как в рабочем MBR) — сразу после MBR + $fs.Position = 512 + $fs.Write($data, 512, $data.Length - 512) + $fs.Flush() +} +finally { + $fs.Close() +} diff --git a/grub2-bios/make-paravis-mbr.ps1 b/grub2-bios/make-paravis-mbr.ps1 new file mode 100644 index 0000000..5347d62 --- /dev/null +++ b/grub2-bios/make-paravis-mbr.ps1 @@ -0,0 +1,25 @@ +param( + [Parameter(Mandatory=$true)][int]$Disk, + [Parameter(Mandatory=$true)][string]$Boot, + [Parameter(Mandatory=$true)][string]$Out +) + +$ErrorActionPreference = 'Stop' + +$bootData = [IO.File]::ReadAllBytes($Boot) +if ($bootData.Length -lt 512) { throw "Bad boot.img: $Boot" } + +$mbr = New-Object byte[] 512 +$fs = [IO.File]::Open("\\.\PhysicalDrive$Disk", [IO.FileMode]::Open, [IO.FileAccess]::Read, [IO.FileShare]::ReadWrite) +try { + $fs.Read($mbr, 0, 512) | Out-Null +} +finally { + $fs.Close() +} + +# 0..439 — наш boot-код; 440..511 — текущая таблица разделов/подпись диска +$img = New-Object byte[] 512 +[Array]::Copy($bootData, 0, $img, 0, 440) +[Array]::Copy($mbr, 440, $img, 440, 72) +[IO.File]::WriteAllBytes($Out, $img) diff --git a/grub2-bios/menu/linux.cfg b/grub2-bios/menu/linux.cfg new file mode 100644 index 0000000..140e6c9 --- /dev/null +++ b/grub2-bios/menu/linux.cfg @@ -0,0 +1,28 @@ +set p1=$root + +set theme=($p1)/efi/Paravis/Boot/grub2/theme/linux/theme.txt +export theme + +menuentry "Запуск Linux Mint x64 (1)" --hotkey=1 { + linux ($p1)/efi/Paravis/Linux/x64/vmlinuz boot=casper ignore_uuid live-media-path=/efi/Paravis/Linux/x64/ locale=ru_RU.UTF-8 console-setup/layoutcode=ru quiet splash -- + initrd ($p1)/efi/Paravis/Linux/x64/initrd.lz +} + +menuentry "Запуск antiX x86 (2)" --hotkey=2 { + linux ($p1)/efi/Paravis/Linux/x86/vmlinuz quiet from=all lang=ru_RU kbd=ru bdir=/efi/Paravis/Linux/x86 + initrd ($p1)/efi/Paravis/Linux/x86/initrd.gz +} + +menuentry "Установка Linux Mint x64 (3)" --hotkey=3 { + linux ($p1)/efi/Paravis/Linux/x64/vmlinuz boot=casper ignore_uuid live-media-path=/efi/Paravis/Linux/x64/ locale=ru_RU.UTF-8 console-setup/layoutcode=ru only-ubiquity quiet splash -- + initrd ($p1)/efi/Paravis/Linux/x64/initrd.lz +} + +menuentry "Установка antiX x86 (4)" --hotkey=4 { + linux ($p1)/efi/Paravis/Linux/x86/vmlinuz quiet from=all lang=ru_RU kbd=ru bdir=/efi/Paravis/Linux/x86 antix_install + initrd ($p1)/efi/Paravis/Linux/x86/initrd.gz +} + +menuentry "Возврат в главное меню" { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/grub.cfg +} diff --git a/grub2-bios/menu/msdart.cfg b/grub2-bios/menu/msdart.cfg new file mode 100644 index 0000000..f5b3906 --- /dev/null +++ b/grub2-bios/menu/msdart.cfg @@ -0,0 +1,29 @@ +set p1=$root + +set theme=($p1)/efi/Paravis/Boot/grub2/theme/msdart/theme.txt +export theme + +menuentry "Windows 7 MSDaRT x86 (1)" --hotkey=1 { + ntldr ($p1)/efi/Paravis/Boot/mgr/dart7x86 +} + +menuentry "Windows 7 MSDaRT x64 (2)" --hotkey=2 { + ntldr ($p1)/efi/Paravis/Boot/mgr/dart7x64 +} + +menuentry "Windows 10 MSDaRT x86 (3)" --hotkey=3 { + ntldr ($p1)/efi/Paravis/Boot/mgr/dart10x86 +} + +menuentry "Windows 10 MSDaRT x64 (4)" --hotkey=4 { + ntldr ($p1)/efi/Paravis/Boot/mgr/dart10x64 +} + +menuentry "Windows 11 MSDaRT x64 (5)" --hotkey=5 { + ntldr ($p1)/efi/Paravis/Boot/mgr/dart11 +} + +menuentry "Возврат в главное меню (6)" --hotkey=6 { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/grub.cfg +} + diff --git a/grub2-bios/menu/strelec.cfg b/grub2-bios/menu/strelec.cfg new file mode 100644 index 0000000..3b31336 --- /dev/null +++ b/grub2-bios/menu/strelec.cfg @@ -0,0 +1,25 @@ +set p1=$root + +set theme=($p1)/efi/Paravis/Boot/grub2/theme/strelec/theme.txt +export theme + +menuentry "Windows 8 Native PE Sergei Strelec (1)" --hotkey=1 { + ntldr ($p1)/efi/Paravis/Boot/mgr/str8nat +} + +menuentry "Windows 8 x86 PE Sergei Strelec (2)" --hotkey=2 { + ntldr ($p1)/efi/Paravis/Boot/mgr/strelec8 +} + +menuentry "Windows 10 x64 PE Sergei Strelec (3)" --hotkey=3 { + ntldr ($p1)/efi/Paravis/Boot/mgr/strelec10 +} + +menuentry "Windows 11 x64 PE Sergei Strelec (4)" --hotkey=4 { + ntldr ($p1)/efi/Paravis/Boot/mgr/strelec11 +} + +menuentry "Возврат в главное меню (5)" --hotkey=5 { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/grub.cfg +} + diff --git a/grub2-bios/menu/utilits.cfg b/grub2-bios/menu/utilits.cfg new file mode 100644 index 0000000..cb985d2 --- /dev/null +++ b/grub2-bios/menu/utilits.cfg @@ -0,0 +1,36 @@ +set p1=$root + +set theme=($p1)/efi/Paravis/Boot/grub2/theme/utilits/theme.txt +export theme + +menuentry "Paragon Hard Disk Manager (1)" --hotkey=1 { + linux ($p1)/efi/Paravis/Utilities/phdm.krn root=/dev/ram0 splash=silent vga=0x314 language=ru_RU.UTF-8 + initrd ($p1)/efi/Paravis/Utilities/phdm.fs +} + +menuentry "Acronis Disk Director Home (2)" --hotkey=2 { + linux16 ($p1)/efi/Paravis/Boot/loaders/memdisk iso raw + initrd16 ($p1)/efi/Paravis/Utilities/ADD + boot +} + +menuentry "Acronis Backup Advanced x86/x64 (3)" --hotkey=3 { + linux16 ($p1)/efi/Paravis/Boot/loaders/memdisk iso raw + initrd16 ($p1)/efi/Paravis/Utilities/ABA + boot +} + +menuentry "Memtest86+ (4)" --hotkey=4 { + linux16 ($p1)/efi/Paravis/Boot/loaders/memdisk iso raw + initrd16 ($p1)/efi/Paravis/Boot/mem/mt86.iso + boot +} + +menuentry "Ultimate Boot CD (5)" --hotkey=5 { + ntldr ($p1)/efi/Paravis/Boot/g4d/UBCD +} + +menuentry "Возврат в главное меню (6)" --hotkey=6 { + configfile ($p1)/efi/Paravis/Boot/grub2/bios/grub.cfg +} + diff --git a/grub2-bios/prefix.cfg b/grub2-bios/prefix.cfg new file mode 100644 index 0000000..519c8bf --- /dev/null +++ b/grub2-bios/prefix.cfg @@ -0,0 +1,2 @@ +search --file --set=root /efi/Paravis/Boot/grub2/bios/grub.cfg +set prefix=($root)/efi/Paravis/Boot/grub2/bios