UEFI: Greasy edition

* This is a last minute hack to get UEFI into R1 Beta 1
* This is extremely greasy and not that great

Change-Id: I3519dba7c97e3e01fe1d7f23d7b06f61f2ffedb7
Reviewed-on: https://review.haiku-os.org/578
Reviewed-by: Alexander von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
Alexander von Gluck IV 2018-09-16 19:25:27 -05:00
parent 9396f1649f
commit 3066e6bb4e

67
3rdparty/kallisti5/greasy_uefi.sh vendored Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# THIS IS NOT THE FINAL SOLUTION
# DIRTY HAX FOR R1 BETA 1!
if [ $# -lt 2 ]; then
echo "$0 <greasy profile> <greasy source dir>"
exit 1
fi
PROFILE="$1"
SOURCE="$2"
HAIKU_BOOT_PLATFORM=efi jam -q haiku_loader.efi
unset HAIKU_BOOT_PLATFORM
EFI_LOADER=./objects/haiku/x86_64/release/system/boot/efi/haiku_loader.efi
ANYBOOT=./objects/linux/x86_64/release/tools/anyboot/anyboot
cat << EOF | patch -t -p1 -d${SOURCE}
diff --git a/build/jam/images/AnybootImage b/build/jam/images/AnybootImage
index b1bdca7783..6b71c16aaa 100644
--- a/build/jam/images/AnybootImage
+++ b/build/jam/images/AnybootImage
@@ -12,11 +12,14 @@ rule BuildAnybootImage anybootImage : mbrPart : isoPart : imageFile {
Depends \$(anybootImage) : \$(mbrPart) ;
Depends \$(anybootImage) : \$(imageFile) ;
- BuildAnybootImage1 \$(anybootImage) : \$(anyboot) \$(mbrPart) \$(isoPart) \$(imageFile) ;
+ # WE HAX THE BEST HAX FOR R1BETA1
+ local efiPart = "efi.img" ;
+
+ BuildAnybootImage1 \$(anybootImage) : \$(anyboot) \$(mbrPart) \$(efiPart) \$(isoPart) \$(imageFile) ;
}
actions BuildAnybootImage1 {
- \$(2[1]) -b \$(2[2]) \$(2[3]) \$(2[4]) \$(1)
+ \$(2[1]) -b \$(2[2]) -e \$(2[3]) \$(2[4]) \$(2[5]) \$(1)
}
local baseMBR = base_mbr.bin ;
EOF
EFI_OUT=efi.img
rm ${EFI_OUT}
echo "dd image..."
dd if=/dev/zero of=${EFI_OUT} bs=1M count=2
echo "mtools scripting..."
echo "drive i: file=\"${EFI_OUT}\" cylinders=8 heads=255 sectors=63 mformat_only" > ${EFI_OUT}.mtools
echo "mformat EFI partition..."
MTOOLSRC=${EFI_OUT}.mtools mformat -L 32 -v "UEFI" i:
echo "construct EFI filesystem..."
MTOOLSRC=${EFI_OUT}.mtools mmd i:/EFI
MTOOLSRC=${EFI_OUT}.mtools mmd i:/EFI/BOOT
MTOOLSRC=${EFI_OUT}.mtools mcopy ${EFI_LOADER} i:/EFI/BOOT/BOOTX64.EFI
MTOOLSRC=${EFI_OUT}.mtools mdir i:
MTOOLSRC=${EFI_OUT}.mtools mdir i:/EFI/BOOT
echo "cleanup..."
rm ${EFI_OUT}.mtools
jam -q @${PROFILE}-anyboot
git -C ${SOURCE} checkout build/jam/images/AnybootImage