mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Merge pull request #77 from tinkeros/parameterize-qemu-path
Add QEMU_BIN_PATH variable
This commit is contained in:
commit
1d778f6322
2 changed files with 16 additions and 10 deletions
|
@ -24,9 +24,12 @@ TMPISODIR="$TMPDIR/iso"
|
||||||
TMPDISK="$TMPDIR/ZealOS.raw"
|
TMPDISK="$TMPDIR/ZealOS.raw"
|
||||||
TMPMOUNT="$TMPDIR/mnt"
|
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() {
|
mount_tempdisk() {
|
||||||
sudo modprobe nbd
|
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 partprobe /dev/nbd0
|
||||||
sudo mount /dev/nbd0p1 $TMPMOUNT
|
sudo mount /dev/nbd0p1 $TMPMOUNT
|
||||||
}
|
}
|
||||||
|
@ -34,7 +37,7 @@ mount_tempdisk() {
|
||||||
umount_tempdisk() {
|
umount_tempdisk() {
|
||||||
sync
|
sync
|
||||||
sudo umount $TMPMOUNT
|
sudo umount $TMPMOUNT
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
sudo $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
|
||||||
}
|
}
|
||||||
|
|
||||||
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
|
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
|
||||||
|
@ -46,8 +49,8 @@ echo "Building ZealBooter..."
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
echo "Making temp vdisk, running auto-install ..."
|
echo "Making temp vdisk, running auto-install ..."
|
||||||
qemu-img create -f raw $TMPDISK 1024M
|
$QEMU_BIN_PATH/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-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/ ..."
|
echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..."
|
||||||
rm ../src/Home/Registry.ZC 2> /dev/null
|
rm ../src/Home/Registry.ZC 2> /dev/null
|
||||||
|
@ -59,7 +62,7 @@ sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
|
||||||
umount_tempdisk
|
umount_tempdisk
|
||||||
|
|
||||||
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
|
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"
|
LIMINE_BINARY_BRANCH="v4.x-branch-binary"
|
||||||
|
|
||||||
|
@ -128,11 +131,11 @@ if [ "$TESTING" = true ]; then
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..."
|
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 ..."
|
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 ..."
|
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
|
fi
|
||||||
|
|
||||||
# comment these 2 lines if you want lingering old Distro ISOs
|
# comment these 2 lines if you want lingering old Distro ISOs
|
||||||
|
|
|
@ -11,6 +11,9 @@ SCRIPT_DIR=$(realpath "$(dirname "$0")")
|
||||||
SCRIPT_NAME=$(basename "$0")
|
SCRIPT_NAME=$(basename "$0")
|
||||||
EXPECTED_DIR=$(realpath "$PWD")
|
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}"
|
if test "${EXPECTED_DIR}" != "${SCRIPT_DIR}"
|
||||||
then
|
then
|
||||||
( cd "$SCRIPT_DIR" || exit ; "./$SCRIPT_NAME" "$@" );
|
( cd "$SCRIPT_DIR" || exit ; "./$SCRIPT_NAME" "$@" );
|
||||||
|
@ -50,7 +53,7 @@ print_usage() {
|
||||||
|
|
||||||
mount_vdisk() {
|
mount_vdisk() {
|
||||||
echo "Mounting virtual disk..."
|
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 partprobe /dev/nbd0
|
||||||
sudo mount /dev/nbd0p1 $TMPMOUNT
|
sudo mount /dev/nbd0p1 $TMPMOUNT
|
||||||
}
|
}
|
||||||
|
@ -59,7 +62,7 @@ umount_vdisk() {
|
||||||
echo "Unmounting virtual disk..."
|
echo "Unmounting virtual disk..."
|
||||||
sync
|
sync
|
||||||
sudo umount $TMPMOUNT
|
sudo umount $TMPMOUNT
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
sudo $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
|
||||||
sudo rm -rf $TMPMOUNT
|
sudo rm -rf $TMPMOUNT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue