Implement rebuild script and AUTO-VM.ISO for rebuilding and testing code during development.

The build-temp-vm script will perform the same logic as the build-iso script, the only difference being it will not perform ISO extraction logic whenever the VM is closed. Changes made inside the temporary VM will NOT be preserved. The AUTO-VM bootstrap ISO (which similarly has the system and kernel rebuilding logic on boot but has the ISO generation steps removed) is created by slightly modifying the standard AutoFullDistro0.ZC script file, then using sync.sh to sync the repo contents and update the AUTO iso. Since this setup exists separate from the ISO process, the modified AUTO iso can simply be renamed to AUTO-VM.ISO and the default one re-checked out via git to restore it.
This commit is contained in:
TomAwezome 2022-08-18 22:06:50 -04:00
parent 92a36b3ada
commit 87de096d19
3 changed files with 65 additions and 1 deletions

BIN
build/AUTO-VM.ISO Executable file

Binary file not shown.

63
build/build-temp-vm.sh Executable file
View file

@ -0,0 +1,63 @@
#!/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.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
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
#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

@ -22,7 +22,8 @@ U0 Auto()
in_str = MStrPrint("Sleep(700);In(\"CC\\n%d\\n\\n1024\\n768\\n\\n\\n\");", ata_port);
OnceDrive('C', in_str);
Free(in_str);
in_str = MStrPrint("BootHDIns;OnceFlush;Once(\"#include \\\"/Misc/Auto/AutoFullDistro1\\\";;Auto;\");Reboot;");
// in_str = MStrPrint("BootHDIns;OnceFlush;Once(\"#include \\\"/Misc/Auto/AutoFullDistro1\\\";;Auto;\");Reboot;");
in_str = MStrPrint("BootHDIns;OnceFlush;Reboot;");
OnceDrive('C', in_str);
OutU8(0x501,0x31);
}