diff options
Diffstat (limited to 'efi-kernel/mk.sh')
| -rwxr-xr-x | efi-kernel/mk.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/efi-kernel/mk.sh b/efi-kernel/mk.sh new file mode 100755 index 0000000..9cd32c2 --- /dev/null +++ b/efi-kernel/mk.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# EFI-загрузчик + amd64-ядро -> bootx64.efi. Нужны: BINDIR (6c/6a/6l), PLAN9SRC (include), +# и pe64.s/efi.h/mem.h из ../efi (запусти ../efi/fetch_ref.sh). +set -e; cd "$(dirname "$0")" +BIN="${BINDIR:?}"; INC="${PLAN9SRC:?}"; export objtype=amd64 +for f in pe64.s efi.h mem.h; do [ -f ../efi/$f ] || { echo "нет ../efi/$f — запусти ../efi/fetch_ref.sh"; exit 1; }; cp ../efi/$f .; done +head -162 pe64.s > pe64min.s +"$BIN/6a" kern64.s; "$BIN/6c" -I"$INC/amd64/include" -I"$INC/sys/include" kernel.c +"$BIN/6l" -l -s -T0x100000 -E _start -o kernel.out kern64.6 kernel.6 +python3 -c "d=open('kernel.out','rb').read(); open('kernel_blob.h','w').write('static unsigned char kernel_blob[]={'+','.join(hex(b) for b in d)+'};\nstatic unsigned kernel_len=%d;\n'%len(d))" +"$BIN/6a" -DIMAGEBASE=0x8000 pe64min.s +"$BIN/6c" -I"$INC/amd64/include" -I"$INC/sys/include" efi_load.c +"$BIN/6l" -l -s -R1 -T0x8000 -o boot.out pe64min.6 efi_load.6 +dd if=boot.out bs=1 skip=40 of=bootx64.efi 2>/dev/null +echo "bootx64.efi: $(ls -la bootx64.efi|awk '{print $5}') байт" |
