Skip to content

Commit 9fa3de4

Browse files
committed
fix(quickemu): remove integrated OpenCore support, require OpenCore.qcow2
- Remove integrated OpenCore creation/extraction code from quickget: require_mtools/sgdisk helpers, create_macos_disk_with_opencore, download_opencore and related logic - Simplify quickemu macOS boot flow to expect a separate OpenCore.qcow2 or ESP.qcow2; streamline device/drive argument construction - Remove mtools and gptfdisk from devshell.nix and package.nix - Always download OpenCore.qcow2 via legacy method and update status messages Signed-off-by: Martin Wimpress <martin@wimpress.org>
1 parent a98a416 commit 9fa3de4

File tree

5 files changed

+15
-288
lines changed

5 files changed

+15
-288
lines changed

debian/control

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ Architecture: all
1515
Depends:
1616
coreutils,
1717
curl,
18-
gdisk,
1918
genisoimage,
2019
jq,
2120
mesa-utils,
22-
mtools,
2321
pciutils,
2422
procps,
2523
python3-minimal,

devshell.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ mkShell {
1616
gawk
1717
gnugrep
1818
gnused
19-
gptfdisk
2019
jq
21-
mtools
2220
pciutils
2321
procps
2422
python3

package.nix

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
gawk,
1111
gnugrep,
1212
gnused,
13-
gptfdisk,
1413
jq,
1514
mesa-demos,
16-
mtools,
1715
pciutils,
1816
procps,
1917
python3,
@@ -38,9 +36,7 @@ let
3836
gawk
3937
gnugrep
4038
gnused
41-
gptfdisk
4239
jq
43-
mtools
4440
pciutils
4541
procps
4642
python3

quickemu

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -915,32 +915,21 @@ function configure_bios() {
915915
fi
916916

917917
# Check for OpenCore bootloader
918-
# Backwards compatibility: If OpenCore.qcow2 exists, use legacy two-disk boot method
919-
# If OpenCore.qcow2 is absent, assume OpenCore is integrated in the main disk
920918
if [ -e "${VMDIR}/OpenCore.qcow2" ]; then
921919
MAC_BOOTLOADER="${VMDIR}/OpenCore.qcow2"
922-
MAC_BOOT_MODE="legacy"
923920
elif [ -e "${VMDIR}/ESP.qcow2" ]; then
924921
# Backwards compatibility for Clover
925922
MAC_BOOTLOADER="${VMDIR}/ESP.qcow2"
926-
MAC_BOOT_MODE="legacy"
927923
else
928-
# New method: OpenCore is integrated in the main disk's EFI partition
929-
# No separate bootloader file needed
930-
MAC_BOOTLOADER=""
931-
MAC_BOOT_MODE="integrated"
924+
MAC_MISSING="Bootloader"
932925
fi
933926

934927
if [ -n "${MAC_MISSING}" ]; then
935928
echo "ERROR! macOS ${MAC_MISSING} was not found."
936929
echo " Use 'quickget' to download the required files."
937930
exit 1
938931
fi
939-
if [ "${MAC_BOOT_MODE}" == "integrated" ]; then
940-
BOOT_STATUS="EFI (macOS), OVMF ($(basename "${EFI_CODE}")), OpenCore (integrated), SecureBoot (${secureboot})."
941-
else
942-
BOOT_STATUS="EFI (macOS), OVMF ($(basename "${EFI_CODE}")), SecureBoot (${secureboot})."
943-
fi
932+
BOOT_STATUS="EFI (macOS), OVMF ($(basename "${EFI_CODE}")), SecureBoot (${secureboot})."
944933
elif [[ "${boot}" == *"efi"* ]]; then
945934
EFI_VARS="${VMDIR}/OVMF_VARS.fd"
946935

@@ -1182,15 +1171,7 @@ function configure_storage() {
11821171
# Only check disk image size if preallocation is off
11831172
if [ "${preallocation}" == "off" ]; then
11841173
DISK_CURR_SIZE=$(${STAT} -c%s "${disk_img}")
1185-
# For macOS with integrated OpenCore, the disk is pre-created with an EFI
1186-
# partition containing OpenCore (~500MB). Use a higher threshold (1GB) to
1187-
# distinguish between "just EFI" and "EFI + installed macOS".
1188-
if [ "${guest_os}" == "macos" ] && [ "${MAC_BOOT_MODE}" == "integrated" ]; then
1189-
DISK_MIN_SIZE_CHECK=$((1024 * 1024 * 1024))
1190-
else
1191-
DISK_MIN_SIZE_CHECK="${DISK_MIN_SIZE}"
1192-
fi
1193-
if [ "${DISK_CURR_SIZE}" -le "${DISK_MIN_SIZE_CHECK}" ]; then
1174+
if [ "${DISK_CURR_SIZE}" -le "${DISK_MIN_SIZE}" ]; then
11941175
echo " Looks unused, booting from ${iso}${img}"
11951176
if [ -z "${iso}" ] && [ -z "${img}" ]; then
11961177
echo "ERROR! You haven't specified a .iso or .img image to boot from."
@@ -1608,7 +1589,6 @@ function vm_boot() {
16081589
OS_RELEASE="Unknown OS"
16091590
MACHINE_TYPE="${MACHINE_TYPE:-q35}"
16101591
MAC_BOOTLOADER=""
1611-
MAC_BOOT_MODE=""
16121592
MAC_MISSING=""
16131593
MAC_DISK_DEV="${MAC_DISK_DEV:-ide-hd,bus=ahci.2}"
16141594
NET_DEVICE="${NET_DEVICE:-virtio-net-pci}"
@@ -1973,36 +1953,19 @@ function vm_boot() {
19731953

19741954
if [ "${guest_os}" == "macos" ]; then
19751955
# shellcheck disable=SC2054
1976-
args+=(-device ahci,id=ahci)
1956+
args+=(-device ahci,id=ahci
1957+
-device ide-hd,bus=ahci.0,drive=BootLoader,bootindex=0
1958+
-drive id=BootLoader,if=none,format=qcow2,file="${MAC_BOOTLOADER}")
19771959

1978-
if [ -n "${MAC_BOOTLOADER}" ]; then
1979-
# Legacy mode: boot from separate OpenCore.qcow2
1960+
if [ -n "${img}" ]; then
19801961
# shellcheck disable=SC2054
1981-
args+=(-device ide-hd,bus=ahci.0,drive=BootLoader,bootindex=0
1982-
-drive id=BootLoader,if=none,format=qcow2,file="${MAC_BOOTLOADER}")
1983-
1984-
if [ -n "${img}" ]; then
1985-
# shellcheck disable=SC2054
1986-
args+=(-device ide-hd,bus=ahci.1,drive=RecoveryImage
1987-
-drive id=RecoveryImage,if=none,format=raw,file="${img}")
1988-
fi
1989-
1990-
# shellcheck disable=SC2054,SC2206
1991-
args+=(-device ${MAC_DISK_DEV},drive=SystemDisk
1992-
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
1993-
else
1994-
# Integrated mode: OpenCore is in the main disk's EFI partition
1995-
# Boot directly from the main disk
1996-
# shellcheck disable=SC2054,SC2206
1997-
args+=(-device ${MAC_DISK_DEV},drive=SystemDisk,bootindex=0
1998-
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
1999-
2000-
if [ -n "${img}" ]; then
2001-
# shellcheck disable=SC2054
2002-
args+=(-device ide-hd,bus=ahci.0,drive=RecoveryImage
2003-
-drive id=RecoveryImage,if=none,format=raw,file="${img}")
2004-
fi
1962+
args+=(-device ide-hd,bus=ahci.1,drive=RecoveryImage
1963+
-drive id=RecoveryImage,if=none,format=raw,file="${img}")
20051964
fi
1965+
1966+
# shellcheck disable=SC2054,SC2206
1967+
args+=(-device ${MAC_DISK_DEV},drive=SystemDisk
1968+
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
20061969
elif [ "${guest_os}" == "kolibrios" ]; then
20071970
# shellcheck disable=SC2054,SC2206
20081971
args+=(-device ahci,id=ahci

0 commit comments

Comments
 (0)