Add QEMU_BIN_PATH variable

This commit is contained in:
tinkeros 2022-12-11 19:06:40 -06:00
parent 946c51fa4d
commit f4c5814c4b
2 changed files with 16 additions and 10 deletions

View file

@ -24,9 +24,12 @@ TMPISODIR="$TMPDIR/iso"
TMPDISK="$TMPDIR/ZealOS.raw"
TMPMOUNT="$TMPDIR/mnt"
# Change this if your default QEMU version does not work and you have installed a different version elsewhere.
QEMU_BIN_PATH=$(dirname "$(which qemu-system-x86_64)")
mount_tempdisk() {
sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
sudo $QEMU_BIN_PATH/qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
sudo partprobe /dev/nbd0
sudo mount /dev/nbd0p1 $TMPMOUNT
}
@ -34,7 +37,7 @@ mount_tempdisk() {
umount_tempdisk() {
sync
sudo umount $TMPMOUNT
sudo qemu-nbd -d /dev/nbd0
sudo $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
}
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
@ -46,8 +49,8 @@ echo "Building ZealBooter..."
set +e
echo "Making temp vdisk, running auto-install ..."
qemu-img create -f raw $TMPDISK 1024M
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit
$QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit
echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..."
rm ../src/Home/Registry.ZC 2> /dev/null
@ -59,7 +62,7 @@ sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
umount_tempdisk
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit
LIMINE_BINARY_BRANCH="v4.x-branch-binary"
@ -128,11 +131,11 @@ if [ "$TESTING" = true ]; then
cd ..
fi
echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..."
qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso
echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..."
qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso
echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..."
qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso
fi
# comment these 2 lines if you want lingering old Distro ISOs

View file

@ -11,6 +11,9 @@ SCRIPT_DIR=$(realpath "$(dirname "$0")")
SCRIPT_NAME=$(basename "$0")
EXPECTED_DIR=$(realpath "$PWD")
# Change this if your default QEMU version does not work and you have installed a different version elsewhere.
QEMU_BIN_PATH=$(dirname "$(which qemu-system-x86_64)")
if test "${EXPECTED_DIR}" != "${SCRIPT_DIR}"
then
( cd "$SCRIPT_DIR" || exit ; "./$SCRIPT_NAME" "$@" );
@ -50,7 +53,7 @@ print_usage() {
mount_vdisk() {
echo "Mounting virtual disk..."
sudo qemu-nbd -c /dev/nbd0 "$ZEALDISK"
sudo $QEMU_BIN_PATH/qemu-nbd -c /dev/nbd0 "$ZEALDISK"
sudo partprobe /dev/nbd0
sudo mount /dev/nbd0p1 $TMPMOUNT
}
@ -59,7 +62,7 @@ umount_vdisk() {
echo "Unmounting virtual disk..."
sync
sudo umount $TMPMOUNT
sudo qemu-nbd -d /dev/nbd0
sudo $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
sudo rm -rf $TMPMOUNT
}