Implement build-temp-vm-uefi-1 script that performs an additional BIOS mode reboot to allow for automatic kernel recompile before booting into UEFI mode with Limine.

This commit is contained in:
TomAwezome 2022-08-19 00:56:11 -04:00
parent fd52452c70
commit 12201e46b6
3 changed files with 70 additions and 2 deletions

BIN
build/AUTO-VM-1.ISO Executable file

Binary file not shown.

67
build/build-temp-vm-uefi-1.sh Executable file
View file

@ -0,0 +1,67 @@
#!/bin/sh
# Build OS using AUTO.ISO minimal auto-install as bootstrap to merge codebase, recompile system, and start temporary VM
# make sure we are in the correct directory
SCRIPT_DIR=$(realpath "$(dirname "$0")")
SCRIPT_NAME=$(basename "$0")
EXPECTED_DIR=$(realpath "$PWD")
if test "${EXPECTED_DIR}" != "${SCRIPT_DIR}"
then
( cd "$SCRIPT_DIR" || exit ; "./$SCRIPT_NAME" "$@" );
exit
fi
# Uncomment if you use doas instead of sudo
#alias sudo=doas
TMPDIR="/tmp/zealtmp"
TMPDISK="$TMPDIR/ZealOS.raw"
TMPMOUNT="$TMPDIR/mnt"
mount_tempdisk() {
sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
sudo partprobe /dev/nbd0
sudo mount /dev/nbd0p1 $TMPMOUNT
}
umount_tempdisk() {
sync
sudo umount $TMPMOUNT
sudo qemu-nbd -d /dev/nbd0
}
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
echo "Making temp vdisk, running auto-install..."
qemu-img create -f raw $TMPDISK 192M
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -cdrom AUTO-VM-1.ISO -device isa-debug-exit
echo "Mounting vdisk and copying src/..."
rm ../src/Home/Registry.ZC 2> /dev/null
rm ../src/Home/MakeHome.ZC 2> /dev/null
mount_tempdisk
sudo cp -r ../src/* $TMPMOUNT
[ ! -d "limine" ] && git clone https://github.com/limine-bootloader/limine.git --branch=v3.0-branch-binary --depth=1
sudo mkdir -p $TMPMOUNT/EFI/BOOT
sudo cp limine/BOOTX64.EFI $TMPMOUNT/EFI/BOOT/BOOTX64.EFI
umount_tempdisk
#echo "Generating ISO..."
echo "Running temporary VM"
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -device isa-debug-exit
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -bios /usr/share/ovmf/OVMF.fd
#echo "Extracting ISO from vdisk..."
#rm ./ZealOS-*.iso 2> /dev/null # comment this line if you want lingering old ISOs
#mount_tempdisk
#cp $TMPMOUNT/Tmp/MyDistro.ISO.C ./ZealOS-$(date +%Y-%m-%d-%H_%M_%S).iso
#umount_tempdisk
echo "Deleting temp folder..."
rm -rf $TMPDIR
echo "Finished."
#ls -lh ZealOS-*.iso

View file

@ -23,7 +23,8 @@ U0 Auto()
OnceDrive('C', in_str);
Free(in_str);
// in_str = MStrPrint("BootHDIns;OnceFlush;Once(\"#include \\\"/Misc/Auto/AutoFullDistro1\\\";;Auto;\");Reboot;");
in_str = MStrPrint("BootHDIns;OnceFlush;Reboot;");
// in_str = MStrPrint("BootHDIns;OnceFlush;Reboot;");
in_str = MStrPrint("BootHDIns;OnceFlush;OutU8(0x501,0x31);");
OnceDrive('C', in_str);
OutU8(0x501,0x31);
}