mirror of
https://github.com/dockur/macos.git
synced 2026-03-11 08:34:24 +00:00
feat: Use VirtIO disks instead of IDE (#5)
This commit is contained in:
parent
6cabae65c6
commit
4b99df9367
4 changed files with 55 additions and 40 deletions
48
readme.md
48
readme.md
|
|
@ -61,15 +61,15 @@ kubectl apply -f kubernetes.yml
|
|||
|
||||
- Start the container and connect to [port 8006](http://localhost:8006) using your web browser.
|
||||
|
||||
- Select `macOs Base System` with your keyboard to begin the installation.
|
||||
- Select `macOs Base System` using your keyboard to begin the installation.
|
||||
|
||||
- Select `Disk Utility` and then select the `QEMU HARDDISK Media` that has the size you specified.
|
||||
- Select `Disk Utility` and then select the largest `Apple Inc. VirtIO Block Media` disk.
|
||||
|
||||
- Click `Erase` to format the disk, you can give it any name you want.
|
||||
- Click `Erase` to format the disk, and give it a recognizable name you like.
|
||||
|
||||
- When finished, go back by closing the window and then proceed the installation by clicking `Reinstall macOS <version>`.
|
||||
- Close the window and proceed the installation by clicking `Reinstall macOS <version>`.
|
||||
|
||||
- When prompted where to install it, select the disk you created.
|
||||
- When prompted where to install it, select the disk you just created.
|
||||
|
||||
- Once you see the desktop, your OSX installation is ready for use.
|
||||
|
||||
|
|
@ -88,14 +88,14 @@ kubectl apply -f kubernetes.yml
|
|||
|
||||
| **Value** | **Version** | **Size** |
|
||||
|----|-----|----|
|
||||
| `high-sierra` | High Sierra | ? GB |
|
||||
| `mojave` | Mojave | ? GB |
|
||||
| `catalina` | Catalina | ? GB |
|
||||
| `big-sur` | Big Sur | ? GB |
|
||||
| `monterey` | Monterey | ? GB |
|
||||
| `ventura` | Ventura | 3 GB |
|
||||
| `sonoma` | Sonoma | ? GB |
|
||||
|
||||
| `ventura` | Ventura | 3.0 GB |
|
||||
| `monterey` | Monterey | ? GB |
|
||||
| `big-sur` | Big Sur | ? GB |
|
||||
| `catalina` | Catalina | ? GB |
|
||||
| `mojave` | Mojave | ? GB |
|
||||
| `high-sierra` | High Sierra | ? GB |
|
||||
|
||||
* ### How do I change the storage location?
|
||||
|
||||
To change the storage location, include the following bind mount in your compose file:
|
||||
|
|
@ -118,17 +118,6 @@ kubectl apply -f kubernetes.yml
|
|||
|
||||
This can also be used to resize the existing disk to a larger capacity without any data loss.
|
||||
|
||||
* ### How do I verify if my system supports KVM?
|
||||
|
||||
To verify if your system supports KVM, run the following commands:
|
||||
|
||||
```bash
|
||||
sudo apt install cpu-checker
|
||||
sudo kvm-ok
|
||||
```
|
||||
|
||||
If you receive an error from `kvm-ok` indicating that KVM acceleration can't be used, check the virtualization settings in the BIOS.
|
||||
|
||||
* ### How do I change the amount of CPU or RAM?
|
||||
|
||||
By default, the container will be allowed to use a maximum of 2 CPU cores and 4 GB of RAM.
|
||||
|
|
@ -140,7 +129,18 @@ kubectl apply -f kubernetes.yml
|
|||
RAM_SIZE: "8G"
|
||||
CPU_CORES: "4"
|
||||
```
|
||||
|
||||
|
||||
* ### How do I verify if my system supports KVM?
|
||||
|
||||
To verify if your system supports KVM, run the following commands:
|
||||
|
||||
```bash
|
||||
sudo apt install cpu-checker
|
||||
sudo kvm-ok
|
||||
```
|
||||
|
||||
If you receive an error from `kvm-ok` indicating that KVM acceleration can't be used, check the virtualization settings in the BIOS.
|
||||
|
||||
* ### Is this project legal?
|
||||
|
||||
Yes, this project contains only open-source code and does not distribute any copyrighted material. So under all applicable laws, this project will be considered legal.
|
||||
|
|
|
|||
11
src/boot.sh
11
src/boot.sh
|
|
@ -6,9 +6,8 @@ set -Eeuo pipefail
|
|||
|
||||
BOOT_DESC=""
|
||||
BOOT_OPTS=""
|
||||
BOOT_DRIVE="/images/OpenCore.qcow2"
|
||||
BOOT_DRIVE_ID="OpenCoreBoot"
|
||||
BOOT_DRIVE_BUS="ide.2"
|
||||
BOOT_DRIVE="/images/OpenCore.qcow2"
|
||||
SECURE="off"
|
||||
OVMF="/usr/share/OVMF"
|
||||
|
||||
|
|
@ -34,13 +33,15 @@ case "${BOOT_MODE,,}" in
|
|||
;;
|
||||
esac
|
||||
|
||||
BOOT_OPTS="$BOOT_OPTS -smbios type=2 -device vmware-svga,bus=pcie.0,addr=0x5 -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off"
|
||||
BOOT_OPTS="$BOOT_OPTS -smbios type=2 -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off"
|
||||
BOOT_OPTS="$BOOT_OPTS -device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
|
||||
|
||||
# OVMF
|
||||
BOOT_OPTS="$BOOT_OPTS -drive if=pflash,format=raw,readonly=on,file=$OVMF/$ROM"
|
||||
BOOT_OPTS="$BOOT_OPTS -drive if=pflash,format=raw,file=$OVMF/$VARS"
|
||||
|
||||
# OpenCoreBoot
|
||||
BOOT_OPTS="$BOOT_OPTS -device ide-hd,drive=$BOOT_DRIVE_ID,bus=$BOOT_DRIVE_BUS,rotation_rate=1,bootindex=1"
|
||||
BOOT_OPTS="$BOOT_OPTS -drive file=$BOOT_DRIVE,id=$BOOT_DRIVE_ID,format=qcow2,cache=writeback,aio=threads,discard=on,detect-zeroes=on,if=none"
|
||||
DISK_OPTS="$DISK_OPTS -device virtio-blk-pci,drive=${BOOT_DRIVE_ID},scsi=off,bus=pcie.0,addr=0x5,iothread=io2,bootindex=1"
|
||||
DISK_OPTS="$DISK_OPTS -drive file=$BOOT_DRIVE,id=$BOOT_DRIVE_ID,format=qcow2,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on,if=none"
|
||||
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ set -Eeuo pipefail
|
|||
: "${USB:="qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0"}"
|
||||
|
||||
APP="OSX"
|
||||
VGA="vmware"
|
||||
SUPPORT="https://github.com/dockur/osx/"
|
||||
|
||||
cd /run
|
||||
|
|
|
|||
|
|
@ -2,34 +2,47 @@
|
|||
set -Eeuo pipefail
|
||||
|
||||
# Docker environment variables
|
||||
: "${VERSION:="sonoma"}" # OSX Version
|
||||
: "${VERSION:="ventura"}" # OSX Version
|
||||
|
||||
BASE_IMG="$STORAGE/BaseSystem.img"
|
||||
BASE_IMG_ID="InstallMedia"
|
||||
BASE_IMG_BUS="ide.4"
|
||||
BASE_IMG="$STORAGE/BaseSystem.img"
|
||||
|
||||
downloadImage() {
|
||||
|
||||
local msg="Downloading $APP $VERSION image..."
|
||||
info "$msg" && html "$msg"
|
||||
/run/fetch-macOS-v2.py -s "$VERSION"
|
||||
dmg2img -i BaseSystem.dmg "$BASE_IMG"
|
||||
echo "$VERSION" > "$STORAGE/$PROCESS.version"
|
||||
|
||||
if ! /run/fetch-macOS-v2.py -s "$VERSION"; then
|
||||
error "Failed to fetch MacOS $VERSION!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
msg="Converting base image format..."
|
||||
info "$msg" && html "$msg"
|
||||
|
||||
if ! dmg2img -i BaseSystem.dmg "$BASE_IMG"; then
|
||||
error "Failed to convert base image format!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
rm -f BaseSystem.dmg
|
||||
|
||||
echo "$VERSION" > "$STORAGE/$PROCESS.version"
|
||||
}
|
||||
|
||||
if [ ! -f "$BASE_IMG" ]; then
|
||||
downloadImage
|
||||
! downloadImage && exit 34
|
||||
fi
|
||||
|
||||
STORED_VERSION=$(cat "$STORAGE/$PROCESS.version")
|
||||
|
||||
if [ "$VERSION" != "$STORED_VERSION" ]; then
|
||||
info "Different version detected switching base image from $STORED_VERSION to $VERSION"
|
||||
info "Different version detected, switching base image from $STORED_VERSION to $VERSION"
|
||||
rm -f "$BASE_IMG"
|
||||
downloadImage
|
||||
! downloadImage && exit 34
|
||||
fi
|
||||
|
||||
DISK_OPTS="$DISK_OPTS -device ide-hd,drive=$BASE_IMG_ID,bus=$BASE_IMG_BUS,rotation_rate=1"
|
||||
DISK_OPTS="$DISK_OPTS -drive file=$BASE_IMG,id=$BASE_IMG_ID,format=raw,cache=writeback,aio=threads,discard=on,detect-zeroes=on,if=none"
|
||||
DISK_OPTS="$DISK_OPTS -device virtio-blk-pci,drive=${BASE_IMG_ID},scsi=off,bus=pcie.0,addr=0x6,iothread=io2"
|
||||
DISK_OPTS="$DISK_OPTS -drive file=$BASE_IMG,id=$BASE_IMG_ID,format=raw,cache=$DISK_CACHE,aio=$DISK_IO,discard=$DISK_DISCARD,detect-zeroes=on,if=none"
|
||||
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue