Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Commit

Permalink
Extra (#10)
Browse files Browse the repository at this point in the history
* misc improvement

* efi tools

* tools: elua & gdisk

* update grub2 : f555402
  • Loading branch information
a1ive committed Apr 12, 2017
1 parent 2f061f4 commit 1123458
Show file tree
Hide file tree
Showing 45 changed files with 298 additions and 17 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.efi
*.iso
build
grubfm*.efi
grubfm.iso
build
tools/non-free/*
17 changes: 12 additions & 5 deletions boot/grub/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
Binary file modified boot/grub/fonts/unicode.pf2.xz
Binary file not shown.
8 changes: 6 additions & 2 deletions boot/grub/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Binary file modified boot/grub/locale/zh_CN.mo
Binary file not shown.
11 changes: 11 additions & 0 deletions boot/grub/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand All @@ -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
5 changes: 2 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand All @@ -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/*
1 change: 0 additions & 1 deletion config.cfg

This file was deleted.

3 changes: 3 additions & 0 deletions config32.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set grub_firmware="efi32"
export grub_firmware
normal (memdisk)/boot/grub/init.sh
3 changes: 3 additions & 0 deletions config64.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set grub_firmware="efi64"
export grub_firmware
normal (memdisk)/boot/grub/init.sh
Binary file modified grub-mkimage/grub-mkimage.exe
Binary file not shown.
Binary file modified i386-efi/btrfs.mod
Binary file not shown.
Binary file modified i386-efi/cryptodisk.mod
Binary file not shown.
Binary file modified i386-efi/fbinst.mod
Binary file not shown.
85 changes: 85 additions & 0 deletions i386-efi/gdb_grub
Original file line number Diff line number Diff line change
@@ -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 <lkudrak@skosi.org>
###

# 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
Binary file modified i386-efi/linux.mod
Binary file not shown.
Binary file modified i386-efi/nativedisk.mod
Binary file not shown.
Binary file modified i386-efi/setjmp_test.mod
Binary file not shown.
Binary file modified i386-pc/btrfs.mod
Binary file not shown.
Binary file modified i386-pc/cryptodisk.mod
Binary file not shown.
Binary file modified i386-pc/efiemu.mod
Binary file not shown.
Binary file modified i386-pc/fbinst.mod
Binary file not shown.
85 changes: 85 additions & 0 deletions i386-pc/gdb_grub
Original file line number Diff line number Diff line change
@@ -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 <lkudrak@skosi.org>
###

# 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
Binary file modified i386-pc/linux.mod
Binary file not shown.
Binary file modified i386-pc/nativedisk.mod
Binary file not shown.
Binary file modified i386-pc/setjmp_test.mod
Binary file not shown.
Binary file added tools/efi64/HashTool.efi
Binary file not shown.
Binary file added tools/efi64/MokManager.efi
Binary file not shown.
Binary file added tools/efi64/gdisk.efi
Binary file not shown.
Binary file added tools/efi64/shell.efi
Binary file not shown.
Binary file added tools/efi64/shim.efi
Binary file not shown.
Binary file added tools/legacy/elua
Binary file not shown.
File renamed without changes.
Binary file added tools/legacy/invaders
Binary file not shown.
Binary file added tools/legacy/memtest86p
Binary file not shown.
Binary file added tools/legacy/tetrasm
Binary file not shown.
File renamed without changes.
Binary file modified x86_64-efi/acpi.mod
Binary file not shown.
Binary file modified x86_64-efi/cryptodisk.mod
Binary file not shown.
Binary file modified x86_64-efi/fbinst.mod
Binary file not shown.
85 changes: 85 additions & 0 deletions x86_64-efi/gdb_grub
Original file line number Diff line number Diff line change
@@ -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 <lkudrak@skosi.org>
###

# 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
Binary file modified x86_64-efi/linux.mod
Binary file not shown.
Binary file modified x86_64-efi/nativedisk.mod
Binary file not shown.
Binary file modified x86_64-efi/setjmp_test.mod
Binary file not shown.

0 comments on commit 1123458

Please sign in to comment.