OSX-KVM - March 2021 - Batch Update 1

Changes:

- Upgrade to OpenCore 0.6.7-RELEASE

- Big Sur image building script updates (Nick)
  - See https://github.com/kholia/OSX-KVM/pull/169 for details.

- Removed history to reduce repository size
This commit is contained in:
Dhiru Kholia
2021-02-13 18:35:20 +05:30
commit ca219f57e5
109 changed files with 20573 additions and 0 deletions

65
scripts/bigsur/Makefile Normal file
View File

@@ -0,0 +1,65 @@
# Builds either a recovery image (BigSur-recovery.img) or a full installer (BigSur-full.img) for Big Sur.
# To build the full installer you must run this on macOS.
# The recovery can be built on either macOS or Linux.
# For Ubuntu (or similar Linux distribution) you'll need to run this first to get the required packages:
# sudo apt install qemu-utils make
# For macOS you'll probably need to run xcode-select --install to get the commandline tools
BIG_SUR_APP=/Applications/Install\ macOS\ Big\ Sur.app
LINUX_TOOLS = qemu-img
OS :=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
OS = MACOS
endif
# If this is Linux make sure we have all our build tools available:
ifeq ($(OS),)
K := $(foreach exec,$(LINUX_TOOLS),\
$(if $(shell which $(exec)),some string,$(error "Missing required $(exec) tool for build")))
endif
all: BigSur-recovery.img
%.img : %.dmg
ln $< $@
ifeq ($(OS),MACOS)
BigSur-full.dmg : $(BIG_SUR_APP)
hdiutil create -o "$@" -size 14g -layout GPTSPUD -fs HFS+J
hdiutil attach -noverify -mountpoint /Volumes/install_build "$@"
sudo "$</Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction
# createinstallmedia leaves a bunch of subvolumes still mounted when it exits, so we need to use -force here.
hdiutil detach -force "/Volumes/Install macOS Big Sur"
else
BigSur-full.dmg :
$(error "Building a full installer requires this script to be run on macOS, run 'make BigSur-recovery.img' instead")
endif
$(BIG_SUR_APP) : InstallAssistant.pkg
sudo installer -pkg $< -target /
BigSur-recovery.dmg : BaseSystem.dmg
rm -f $@
ifeq ($(OS),MACOS)
hdiutil convert $< -format UDRW -o $@
else
qemu-img convert $< -O raw $@
endif
BaseSystem.dmg :
../../fetch-macOS-v2.py --action download --board-id Mac-E43C1C25D4880AD6
InstallAssistant.pkg :
../../fetch-macOS.py --version latest --title "macOS Big Sur"
clean :
rm -f BaseSystem.chunklist BaseSystem.dmg SharedSupport.dmg InstallAssistant.pkg BigSur-recovery.img BigSur-full.img
rm -rf content

38
scripts/create_dmg_bigsur.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Create a DMG from the Big Sur installer app
# Bail at first DMG creation error
set -e
display_help() {
echo "Usage: $(basename $0) [-h] [<path/to/install_app.app> <path/to/output_dmg_file.dmg>]"
exit 0
}
if [ "$1" == "-h" ] ; then
display_help
fi
if [ "$#" -eq 2 ]
then
in_path=$1
dmg_path=$2
elif [ "$#" -eq 0 ]
then
in_path=/Applications/Install\ macOS\ Big\ Sur.app
dmg_path=~/Desktop/BigSur.dmg
echo "Using default paths:"
echo "Install app: $in_path"
echo "Output disk: $dmg_path"
else
display_help
fi
hdiutil create -o "$dmg_path" -size 14g -layout GPTSPUD -fs HFS+J
hdiutil attach "$dmg_path" -noverify -mountpoint /Volumes/install_build
sudo "$in_path/Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction
# createinstallmedia leaves a bunch of subvolumes still mounted when it exits, so we need to use -force here.
# This might be fixed in a later Beta release:
hdiutil detach -force "/Volumes/Install macOS Big Sur"

33
scripts/create_dmg_catalina.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Bail at first DMG creation error
set -e
display_help() {
echo "Usage: $(basename $0) [-h] [<path/to/install_app.app> <path/to/output_dmg_file.dmg>]"
exit 0
}
if [ "$1" == "-h" ] ; then
display_help
fi
if [ "$#" -eq 2 ]
then
in_path=$1
dmg_path=$2
elif [ "$#" -eq 0 ]
then
in_path=/Applications/Install\ macOS\ Catalina.app
dmg_path=~/Desktop/Catalina.dmg
echo "Using default paths:"
echo "Install app: $in_path"
echo "Output disk: $dmg_path"
else
display_help
fi
hdiutil create -o "$dmg_path" -size 9g -layout GPTSPUD -fs HFS+J
hdiutil attach "$dmg_path" -noverify -mountpoint /Volumes/install_build
sudo "$in_path/Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction
hdiutil detach "/Volumes/Install macOS Catalina"

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Create a "ISO" (DMG) image for powering offline macOS installations
# Bail at first ISO creation error
set -e
display_help() {
echo "Usage: $(basename $0) [-h] [<path/to/install_app.app> <path/to/output_iso_file.iso>]"
exit 0
}
if [ "$1" == "-h" ] ; then
display_help
fi
if [ "$#" -eq 2 ]
then
in_path=$1
dmg_path=$2
elif [ "$#" -eq 0 ]
then
in_path=/Applications/Install\ macOS\ High\ Sierra.app
dmg_path=~/Desktop/HighSierra.dmg
echo "Using default paths:"
echo "Install app: $in_path"
echo "Output disk: $dmg_path"
else
display_help
fi
# Borrrowed from multiple internet sources
hdiutil create -o "$dmg_path" -size 5600m -layout GPTSPUD -fs HFS+J
hdiutil attach "$dmg_path" -noverify -mountpoint /Volumes/install_build
sudo "$in_path/Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction
# createinstallmedia may leave a bunch of subvolumes still mounted when it exits, so we need to use -force here.
hdiutil detach -force "/Volumes/Install macOS High Sierra"

38
scripts/create_dmg_mojave.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Create a "ISO" (DMG) image for powering offline macOS installations
# Bail at first ISO creation error
set -e
display_help() {
echo "Usage: $(basename $0) [-h] [<path/to/install_app.app> <path/to/output_iso_file.iso>]"
exit 0
}
if [ "$1" == "-h" ] ; then
display_help
fi
if [ "$#" -eq 2 ]
then
in_path=$1
dmg_path=$2
elif [ "$#" -eq 0 ]
then
in_path=/Applications/Install\ macOS\ Mojave.app
dmg_path=~/Desktop/Mojave.dmg
echo "Using default paths:"
echo "Install app: $in_path"
echo "Output disk: $dmg_path"
else
display_help
fi
# Borrrowed from multiple internet sources
hdiutil create -o "$dmg_path" -size 7g -layout GPTSPUD -fs HFS+J
hdiutil attach "$dmg_path" -noverify -mountpoint /Volumes/install_build
sudo "$in_path/Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction
# createinstallmedia may leave a bunch of subvolumes still mounted when it exits, so we need to use -force here.
hdiutil detach -force "/Volumes/Install macOS Mojave"

15
scripts/lsgroup.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# mafferri (https://bbs.archlinux.org)
BASE="/sys/kernel/iommu_groups"
for i in $(find $BASE -maxdepth 1 -mindepth 1 -type d); do
GROUP=$(basename $i)
echo "### Group $GROUP ###"
for j in $(find $i/devices -type l); do
DEV=$(basename $j)
echo -n " "
lspci -s $DEV
done
done

32
scripts/vfio-group.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
# mafferri (https://bbs.archlinux.org)
if [ ! -e /sys/kernel/iommu_groups/$1 ]; then
echo "IOMMU group $1 not found"
exit 1
fi
if [ ! -e /sys/bus/pci/drivers/vfio-pci ]; then
sudo modprobe vfio-pci
fi
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
if [ -e /sys/kernel/iommu_groups/$1/devices/$i/driver ]; then
if [ "$(basename $(readlink -f \
/sys/kernel/iommu_groups/$1/devices/$i/driver))" != \
"pcieport" ]; then
echo $i | sudo tee \
/sys/kernel/iommu_groups/$1/devices/$i/driver/unbind
fi
fi
done
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
if [ ! -e /sys/kernel/iommu_groups/$1/devices/$i/driver ]; then
VEN=$(cat /sys/kernel/iommu_groups/$1/devices/$i/vendor)
DEV=$(cat /sys/kernel/iommu_groups/$1/devices/$i/device)
echo $VEN $DEV | sudo tee \
/sys/bus/pci/drivers/vfio-pci/new_id
fi
done

21
scripts/vfio-ungroup.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
# mafferri (https://bbs.archlinux.org)
if [ ! -e /sys/kernel/iommu_groups/$1 ]; then
echo "IOMMU group $1 not found"
exit 1
fi
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
VEN=$(cat /sys/kernel/iommu_groups/$1/devices/$i/vendor)
DEV=$(cat /sys/kernel/iommu_groups/$1/devices/$i/device)
echo $VEN $DEV | sudo tee \
/sys/bus/pci/drivers/vfio-pci/remove_id
echo $i | sudo tee \
/sys/kernel/iommu_groups/$1/devices/$i/driver/unbind
done
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
echo $i | sudo tee /sys/bus/pci/drivers_probe
done