diff --git a/.gitignore b/.gitignore index 89c977d3..b17eb13d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -*.efi -*.iso -build \ No newline at end of file +grubfm*.efi +grubfm.iso +build +tools/non-free/* \ No newline at end of file diff --git a/boot/grub/boot.sh b/boot/grub/boot.sh index 2d116fea..ea601337 100644 --- a/boot/grub/boot.sh +++ b/boot/grub/boot.sh @@ -33,11 +33,18 @@ for dev in (*); do chainloader ($root)/efi/microsoft/boot/bootmgfw.efi; } fi; - if test -f ($device)/efi/boot/bootx64.efi; then - menuentry "加载位于${device}的启动管理器 " $device --class uefi{ - set root=$2; - chainloader ($root)/efi/boot/bootx64.efi; - } + if regexp 'efi64' "$grub_firmware"; then + if test -f ($device)/efi/boot/bootx64.efi; then + menuentry "加载位于${device}的启动管理器 " $device --class uefi{ + set root=$2; chainloader ($root)/efi/boot/bootx64.efi; + } + fi; + else + if test -f ($device)/efi/boot/bootia32.efi; then + menuentry "加载位于${device}的启动管理器 " $device --class uefi{ + set root=$2; chainloader ($root)/efi/boot/bootia32.efi; + } + fi; fi; if test -f ($device)/System/Library/CoreServices/boot.efi; then menuentry "启动位于${device}的 macOS " $device --class macOS{ diff --git a/boot/grub/fonts/unicode.pf2.xz b/boot/grub/fonts/unicode.pf2.xz index 03f48058..985644ff 100755 Binary files a/boot/grub/fonts/unicode.pf2.xz and b/boot/grub/fonts/unicode.pf2.xz differ diff --git a/boot/grub/init.sh b/boot/grub/init.sh index fcb240fd..fbe8755f 100644 --- a/boot/grub/init.sh +++ b/boot/grub/init.sh @@ -19,8 +19,12 @@ if regexp 'pc' "$grub_platform"; then modlist="915resolution all_video bitmap bitmap_scale blocklist cat cmp cpuid crc datetime dd disk drivemap elf file getkey gfxmenu gfxterm gfxterm_background gfxterm_menu gptsync hashsum hexdump hwmatch jpeg loadenv lsapm macho memdisk multiboot multiboot2 net offsetio parttool png procfs random search_fs_uuid search_label sendkey squash4 syslinuxcfg terminfo tga time trig true vbe vga video video_bochs video_cirrus video_colors video_fb videoinfo xnu"; else modlist="all_video video_bochs video_cirrus efi_gop efi_uga gfxterm gfxterm_background gfxmenu jpeg png tga font"; - search -s -f -q /efi/boot/bootia32.efi; - search -s -f -q /efi/boot/bootx64.efi; + search -s -f -q /efi/microsoft/boot/bootmgfw.efi; + if regexp 'efi32' "$grub_firmware"; then + search -s -f -q /efi/boot/bootia32.efi; + else + search -s -f -q /efi/boot/bootx64.efi; + fi fi for module in $modlist; do insmod $module; diff --git a/boot/grub/locale/zh_CN.mo b/boot/grub/locale/zh_CN.mo index 340353f6..cf2efec8 100755 Binary files a/boot/grub/locale/zh_CN.mo and b/boot/grub/locale/zh_CN.mo differ diff --git a/boot/grub/main.sh b/boot/grub/main.sh index 19dd493d..2a00f1b3 100644 --- a/boot/grub/main.sh +++ b/boot/grub/main.sh @@ -152,6 +152,17 @@ function open{ linux16 $prefix/tools/memdisk iso raw; initrd16 "$file_name"; } + else + if regexp 'efi32' "$grub_firmware"; then + set efi_file="bootia32.efi"; + else + set efi_file="bootx64.efi"; + fi; + if test -f "(loop)/efi/boot/${efi_file}"; then + menuentry "仅加载EFI文件" --class uefi{ + chainloader (loop)/efi/boot/${efi_file}; + } + fi; fi; fi; if regexp 'pc' $grub_platform; then diff --git a/build.bat b/build.bat index 3d13857b..056e55b9 100644 --- a/build.bat +++ b/build.bat @@ -15,7 +15,6 @@ for /f "tokens=1,*" %%a in ("%modlist%") do ( ) md build\boot\grub\tools copy legacy\memdisk build\boot\grub\tools\ -copy legacy\wimboot build\boot\grub\tools\ cd build %~dp0\find ./boot | %~dp0\cpio -o -H newc > ./fm.loop cd .. @@ -32,8 +31,8 @@ find ./boot | cpio.exe -o -H newc > ./build/memdisk.cpio set /p modules= < mods.lst @echo i386-efi -grub-mkimage\grub-mkimage.exe -m build\memdisk.cpio -d i386-efi -p (memdisk)/boot/grub -c config.cfg -o grubfmia32.efi -O i386-efi %modules% +grub-mkimage\grub-mkimage.exe -m build\memdisk.cpio -d i386-efi -p (memdisk)/boot/grub -c config32.cfg -o grubfmia32.efi -O i386-efi %modules% @echo x86_64-efi -grub-mkimage\grub-mkimage.exe -m build\memdisk.cpio -d x86_64-efi -p (memdisk)/boot/grub -c config.cfg -o grubfmx64.efi -O x86_64-efi %modules% +grub-mkimage\grub-mkimage.exe -m build\memdisk.cpio -d x86_64-efi -p (memdisk)/boot/grub -c config64.cfg -o grubfmx64.efi -O x86_64-efi %modules% del build\memdisk.cpio \ No newline at end of file diff --git a/build.sh b/build.sh index 21ae7f15..b6947b66 100755 --- a/build.sh +++ b/build.sh @@ -26,7 +26,6 @@ do done mkdir build/boot/grub/tools cp legacy/memdisk build/boot/grub/tools/ -cp legacy/wimboot build/boot/grub/tools/ cd build find ./boot | cpio -o -H newc > ./fm.loop cd .. @@ -48,8 +47,8 @@ find ./boot | cpio -o -H newc > ./build/memdisk.cpio modules=$(cat mods.lst) echo "x86_64-efi" -$mkimage -m ./build/memdisk.cpio -d ./x86_64-efi -p "(memdisk)/boot/grub" -c config.cfg -o grubfmx64.efi -O x86_64-efi $modules +$mkimage -m ./build/memdisk.cpio -d ./x86_64-efi -p "(memdisk)/boot/grub" -c config64.cfg -o grubfmx64.efi -O x86_64-efi $modules echo "i386-efi" -$mkimage -m ./build/memdisk.cpio -d ./i386-efi -p "(memdisk)/boot/grub" -c config.cfg -o grubfmia32.efi -O i386-efi $modules +$mkimage -m ./build/memdisk.cpio -d ./i386-efi -p "(memdisk)/boot/grub" -c config32.cfg -o grubfmia32.efi -O i386-efi $modules rm build/* \ No newline at end of file diff --git a/config.cfg b/config.cfg deleted file mode 100755 index d2407ec6..00000000 --- a/config.cfg +++ /dev/null @@ -1 +0,0 @@ -normal (memdisk)/boot/grub/init.sh diff --git a/config32.cfg b/config32.cfg new file mode 100644 index 00000000..8dc9e386 --- /dev/null +++ b/config32.cfg @@ -0,0 +1,3 @@ +set grub_firmware="efi32" +export grub_firmware +normal (memdisk)/boot/grub/init.sh diff --git a/config64.cfg b/config64.cfg new file mode 100644 index 00000000..27a7375d --- /dev/null +++ b/config64.cfg @@ -0,0 +1,3 @@ +set grub_firmware="efi64" +export grub_firmware +normal (memdisk)/boot/grub/init.sh diff --git a/grub-mkimage/grub-mkimage.exe b/grub-mkimage/grub-mkimage.exe index 5a68ab72..72d6689c 100755 Binary files a/grub-mkimage/grub-mkimage.exe and b/grub-mkimage/grub-mkimage.exe differ diff --git a/i386-efi/btrfs.mod b/i386-efi/btrfs.mod index eabf1692..4506b5ab 100644 Binary files a/i386-efi/btrfs.mod and b/i386-efi/btrfs.mod differ diff --git a/i386-efi/cryptodisk.mod b/i386-efi/cryptodisk.mod index d5b6bea0..1b5fb640 100644 Binary files a/i386-efi/cryptodisk.mod and b/i386-efi/cryptodisk.mod differ diff --git a/i386-efi/fbinst.mod b/i386-efi/fbinst.mod index 0e2f7a21..56380198 100644 Binary files a/i386-efi/fbinst.mod and b/i386-efi/fbinst.mod differ diff --git a/i386-efi/gdb_grub b/i386-efi/gdb_grub new file mode 100644 index 00000000..e322d3dc --- /dev/null +++ b/i386-efi/gdb_grub @@ -0,0 +1,85 @@ +### +### Load debuging information about GNU GRUB 2 modules into GDB +### automatically. Needs readelf, Perl and gmodule.pl script +### +### Has to be launched from the writable and trusted +### directory containing *.image and *.module +### +### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $ +### Lubomir Kundrak +### + +# Add section numbers and addresses to .segments.tmp +define dump_module_sections + set $mod = $arg0 + + # FIXME: save logging status + set logging file .segments.tmp + set logging redirect on + set logging overwrite off + set logging on + + printf "%s", $mod->name + set $segment = $mod->segment + while ($segment) + printf " %i 0x%lx", $segment->section, $segment->addr + set $segment = $segment->next + end + printf "\n" + + set logging off + # FIXME: restore logging status +end +document dump_module_sections + Gather information about module whose mod structure was + given for use with match_and_load_symbols +end + +# Generate and execute GDB commands and delete temporary files +# afterwards +define match_and_load_symbols + shell perl gmodule.pl <.segments.tmp >.loadsym.gdb + source .loadsym.gdb + shell rm -f .segments.tmp .loadsym.gdb +end +document match_and_load_symbols + Launch script, that matches section names with information + generated by dump_module_sections and load debugging info + apropriately +end + +### + +define load_module + dump_module_sections $arg0 + match_and_load_symbols +end +document load_module + Load debugging information for module given as argument. +end + +define load_all_modules + set $this = grub_dl_head + while ($this != 0) + dump_module_sections $this + set $this = $this->next + end + match_and_load_symbols +end +document load_all_modules + Load debugging information for all loaded modules. +end + +### + +set confirm off +file kernel.exec +target remote :1234 + +# inform when module is loaded +break grub_dl_add +commands + silent + load_module mod + cont +end diff --git a/i386-efi/linux.mod b/i386-efi/linux.mod index d47c41b1..afe06375 100644 Binary files a/i386-efi/linux.mod and b/i386-efi/linux.mod differ diff --git a/i386-efi/nativedisk.mod b/i386-efi/nativedisk.mod index 9572ea08..db1646a8 100644 Binary files a/i386-efi/nativedisk.mod and b/i386-efi/nativedisk.mod differ diff --git a/i386-efi/setjmp_test.mod b/i386-efi/setjmp_test.mod index a02c19e1..13518be1 100644 Binary files a/i386-efi/setjmp_test.mod and b/i386-efi/setjmp_test.mod differ diff --git a/i386-pc/btrfs.mod b/i386-pc/btrfs.mod index ed65cb0d..f6d6f4af 100644 Binary files a/i386-pc/btrfs.mod and b/i386-pc/btrfs.mod differ diff --git a/i386-pc/cryptodisk.mod b/i386-pc/cryptodisk.mod index b2409a5a..49885053 100644 Binary files a/i386-pc/cryptodisk.mod and b/i386-pc/cryptodisk.mod differ diff --git a/i386-pc/efiemu.mod b/i386-pc/efiemu.mod index 86528602..51f9bdc0 100644 Binary files a/i386-pc/efiemu.mod and b/i386-pc/efiemu.mod differ diff --git a/i386-pc/fbinst.mod b/i386-pc/fbinst.mod index a8c39a69..18cd8bb4 100644 Binary files a/i386-pc/fbinst.mod and b/i386-pc/fbinst.mod differ diff --git a/i386-pc/gdb_grub b/i386-pc/gdb_grub new file mode 100644 index 00000000..e322d3dc --- /dev/null +++ b/i386-pc/gdb_grub @@ -0,0 +1,85 @@ +### +### Load debuging information about GNU GRUB 2 modules into GDB +### automatically. Needs readelf, Perl and gmodule.pl script +### +### Has to be launched from the writable and trusted +### directory containing *.image and *.module +### +### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $ +### Lubomir Kundrak +### + +# Add section numbers and addresses to .segments.tmp +define dump_module_sections + set $mod = $arg0 + + # FIXME: save logging status + set logging file .segments.tmp + set logging redirect on + set logging overwrite off + set logging on + + printf "%s", $mod->name + set $segment = $mod->segment + while ($segment) + printf " %i 0x%lx", $segment->section, $segment->addr + set $segment = $segment->next + end + printf "\n" + + set logging off + # FIXME: restore logging status +end +document dump_module_sections + Gather information about module whose mod structure was + given for use with match_and_load_symbols +end + +# Generate and execute GDB commands and delete temporary files +# afterwards +define match_and_load_symbols + shell perl gmodule.pl <.segments.tmp >.loadsym.gdb + source .loadsym.gdb + shell rm -f .segments.tmp .loadsym.gdb +end +document match_and_load_symbols + Launch script, that matches section names with information + generated by dump_module_sections and load debugging info + apropriately +end + +### + +define load_module + dump_module_sections $arg0 + match_and_load_symbols +end +document load_module + Load debugging information for module given as argument. +end + +define load_all_modules + set $this = grub_dl_head + while ($this != 0) + dump_module_sections $this + set $this = $this->next + end + match_and_load_symbols +end +document load_all_modules + Load debugging information for all loaded modules. +end + +### + +set confirm off +file kernel.exec +target remote :1234 + +# inform when module is loaded +break grub_dl_add +commands + silent + load_module mod + cont +end diff --git a/i386-pc/linux.mod b/i386-pc/linux.mod index 283ab8f0..86528e77 100644 Binary files a/i386-pc/linux.mod and b/i386-pc/linux.mod differ diff --git a/i386-pc/nativedisk.mod b/i386-pc/nativedisk.mod index 00627342..37f51c99 100644 Binary files a/i386-pc/nativedisk.mod and b/i386-pc/nativedisk.mod differ diff --git a/i386-pc/setjmp_test.mod b/i386-pc/setjmp_test.mod index 1f512459..eff6e877 100644 Binary files a/i386-pc/setjmp_test.mod and b/i386-pc/setjmp_test.mod differ diff --git a/tools/efi64/HashTool.efi b/tools/efi64/HashTool.efi new file mode 100644 index 00000000..5973cdbf Binary files /dev/null and b/tools/efi64/HashTool.efi differ diff --git a/tools/efi64/MokManager.efi b/tools/efi64/MokManager.efi new file mode 100644 index 00000000..f36a1884 Binary files /dev/null and b/tools/efi64/MokManager.efi differ diff --git a/tools/efi64/gdisk.efi b/tools/efi64/gdisk.efi new file mode 100644 index 00000000..1b586da4 Binary files /dev/null and b/tools/efi64/gdisk.efi differ diff --git a/tools/efi64/shell.efi b/tools/efi64/shell.efi new file mode 100644 index 00000000..6f89c55e Binary files /dev/null and b/tools/efi64/shell.efi differ diff --git a/tools/efi64/shim.efi b/tools/efi64/shim.efi new file mode 100644 index 00000000..f939c347 Binary files /dev/null and b/tools/efi64/shim.efi differ diff --git a/tools/legacy/elua b/tools/legacy/elua new file mode 100644 index 00000000..1e62050a Binary files /dev/null and b/tools/legacy/elua differ diff --git a/legacy/grldr b/tools/legacy/grldr old mode 100755 new mode 100644 similarity index 100% rename from legacy/grldr rename to tools/legacy/grldr diff --git a/tools/legacy/invaders b/tools/legacy/invaders new file mode 100644 index 00000000..73da9ccf Binary files /dev/null and b/tools/legacy/invaders differ diff --git a/tools/legacy/memtest86p b/tools/legacy/memtest86p new file mode 100644 index 00000000..affaaab9 Binary files /dev/null and b/tools/legacy/memtest86p differ diff --git a/tools/legacy/tetrasm b/tools/legacy/tetrasm new file mode 100644 index 00000000..f4e79b22 Binary files /dev/null and b/tools/legacy/tetrasm differ diff --git a/legacy/wimboot b/tools/legacy/wimboot old mode 100755 new mode 100644 similarity index 100% rename from legacy/wimboot rename to tools/legacy/wimboot diff --git a/x86_64-efi/acpi.mod b/x86_64-efi/acpi.mod index 2ae4d158..81911437 100644 Binary files a/x86_64-efi/acpi.mod and b/x86_64-efi/acpi.mod differ diff --git a/x86_64-efi/cryptodisk.mod b/x86_64-efi/cryptodisk.mod index 7c21e709..05f0f434 100644 Binary files a/x86_64-efi/cryptodisk.mod and b/x86_64-efi/cryptodisk.mod differ diff --git a/x86_64-efi/fbinst.mod b/x86_64-efi/fbinst.mod index 5b6d43f4..95b2904e 100644 Binary files a/x86_64-efi/fbinst.mod and b/x86_64-efi/fbinst.mod differ diff --git a/x86_64-efi/gdb_grub b/x86_64-efi/gdb_grub new file mode 100644 index 00000000..e322d3dc --- /dev/null +++ b/x86_64-efi/gdb_grub @@ -0,0 +1,85 @@ +### +### Load debuging information about GNU GRUB 2 modules into GDB +### automatically. Needs readelf, Perl and gmodule.pl script +### +### Has to be launched from the writable and trusted +### directory containing *.image and *.module +### +### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $ +### Lubomir Kundrak +### + +# Add section numbers and addresses to .segments.tmp +define dump_module_sections + set $mod = $arg0 + + # FIXME: save logging status + set logging file .segments.tmp + set logging redirect on + set logging overwrite off + set logging on + + printf "%s", $mod->name + set $segment = $mod->segment + while ($segment) + printf " %i 0x%lx", $segment->section, $segment->addr + set $segment = $segment->next + end + printf "\n" + + set logging off + # FIXME: restore logging status +end +document dump_module_sections + Gather information about module whose mod structure was + given for use with match_and_load_symbols +end + +# Generate and execute GDB commands and delete temporary files +# afterwards +define match_and_load_symbols + shell perl gmodule.pl <.segments.tmp >.loadsym.gdb + source .loadsym.gdb + shell rm -f .segments.tmp .loadsym.gdb +end +document match_and_load_symbols + Launch script, that matches section names with information + generated by dump_module_sections and load debugging info + apropriately +end + +### + +define load_module + dump_module_sections $arg0 + match_and_load_symbols +end +document load_module + Load debugging information for module given as argument. +end + +define load_all_modules + set $this = grub_dl_head + while ($this != 0) + dump_module_sections $this + set $this = $this->next + end + match_and_load_symbols +end +document load_all_modules + Load debugging information for all loaded modules. +end + +### + +set confirm off +file kernel.exec +target remote :1234 + +# inform when module is loaded +break grub_dl_add +commands + silent + load_module mod + cont +end diff --git a/x86_64-efi/linux.mod b/x86_64-efi/linux.mod index 5c1c679e..6df89124 100644 Binary files a/x86_64-efi/linux.mod and b/x86_64-efi/linux.mod differ diff --git a/x86_64-efi/nativedisk.mod b/x86_64-efi/nativedisk.mod index 94aa3482..eb36f5f7 100644 Binary files a/x86_64-efi/nativedisk.mod and b/x86_64-efi/nativedisk.mod differ diff --git a/x86_64-efi/setjmp_test.mod b/x86_64-efi/setjmp_test.mod index 818f017f..b7180880 100644 Binary files a/x86_64-efi/setjmp_test.mod and b/x86_64-efi/setjmp_test.mod differ