mirror of
https://github.com/luchina-gabriel/OSX-PROXMOX.git
synced 2026-09-25 20:47:01 +00:00
Compare commits
17
Commits
d114481901
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
209f6df3a4 | ||
|
|
252186c717 | ||
|
|
e1888a949b | ||
|
|
0294682ed3 | ||
|
|
aa97b72f31 | ||
|
|
28ededa7b8 | ||
|
|
e0433f28d4 | ||
|
|
d06f2af3fa | ||
|
|
b3d2b2b9f4 | ||
|
|
d0eb22b5ff | ||
|
|
978dbee98d | ||
|
|
b0b88d8986 | ||
|
|
52433409c3 | ||
|
|
f4e5385402 | ||
|
|
b107e428c5 | ||
|
|
be1eb827c6 | ||
|
|
e873faad91 |
@@ -1,163 +0,0 @@
|
|||||||
[device "ehci"]
|
|
||||||
driver = "ich9-usb-ehci1"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1d.7"
|
|
||||||
|
|
||||||
[device "uhci-1"]
|
|
||||||
driver = "ich9-usb-uhci1"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1d.0"
|
|
||||||
masterbus = "ehci.0"
|
|
||||||
firstport = "0"
|
|
||||||
|
|
||||||
[device "uhci-2"]
|
|
||||||
driver = "ich9-usb-uhci2"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1d.1"
|
|
||||||
masterbus = "ehci.0"
|
|
||||||
firstport = "2"
|
|
||||||
|
|
||||||
[device "uhci-3"]
|
|
||||||
driver = "ich9-usb-uhci3"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1d.2"
|
|
||||||
masterbus = "ehci.0"
|
|
||||||
firstport = "4"
|
|
||||||
|
|
||||||
[device "ehci-2"]
|
|
||||||
driver = "ich9-usb-ehci2"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1a.7"
|
|
||||||
|
|
||||||
[device "uhci-4"]
|
|
||||||
driver = "ich9-usb-uhci4"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1a.0"
|
|
||||||
masterbus = "ehci-2.0"
|
|
||||||
firstport = "0"
|
|
||||||
|
|
||||||
[device "uhci-5"]
|
|
||||||
driver = "ich9-usb-uhci5"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1a.1"
|
|
||||||
masterbus = "ehci-2.0"
|
|
||||||
firstport = "2"
|
|
||||||
|
|
||||||
[device "uhci-6"]
|
|
||||||
driver = "ich9-usb-uhci6"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1a.2"
|
|
||||||
masterbus = "ehci-2.0"
|
|
||||||
firstport = "4"
|
|
||||||
|
|
||||||
# FIXME: Remove this audio0 device at the next possible time
|
|
||||||
# see: https://pve.proxmox.com/pipermail/pve-devel/2019-July/038417.html
|
|
||||||
# https://pve.proxmox.com/pipermail/pve-devel/2019-July/038428.html
|
|
||||||
[device "audio0"]
|
|
||||||
driver = "ich9-intel-hda"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1b.0"
|
|
||||||
|
|
||||||
|
|
||||||
[device "ich9-pcie-port-1"]
|
|
||||||
driver = "pcie-root-port"
|
|
||||||
x-speed = "16"
|
|
||||||
x-width = "32"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1c.0"
|
|
||||||
port = "1"
|
|
||||||
chassis = "1"
|
|
||||||
|
|
||||||
[device "ich9-pcie-port-2"]
|
|
||||||
driver = "pcie-root-port"
|
|
||||||
x-speed = "16"
|
|
||||||
x-width = "32"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1c.1"
|
|
||||||
port = "2"
|
|
||||||
chassis = "2"
|
|
||||||
|
|
||||||
[device "ich9-pcie-port-3"]
|
|
||||||
driver = "pcie-root-port"
|
|
||||||
x-speed = "16"
|
|
||||||
x-width = "32"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1c.2"
|
|
||||||
port = "3"
|
|
||||||
chassis = "3"
|
|
||||||
|
|
||||||
[device "ich9-pcie-port-4"]
|
|
||||||
driver = "pcie-root-port"
|
|
||||||
x-speed = "16"
|
|
||||||
x-width = "32"
|
|
||||||
multifunction = "on"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1c.3"
|
|
||||||
port = "4"
|
|
||||||
chassis = "4"
|
|
||||||
|
|
||||||
##
|
|
||||||
# Example PCIe switch with two downstream ports
|
|
||||||
#
|
|
||||||
#[device "pcie-switch-upstream-port-1"]
|
|
||||||
# driver = "x3130-upstream"
|
|
||||||
# bus = "ich9-pcie-port-4"
|
|
||||||
# addr = "00.0"
|
|
||||||
#
|
|
||||||
#[device "pcie-switch-downstream-port-1-1"]
|
|
||||||
# driver = "xio3130-downstream"
|
|
||||||
# multifunction = "on"
|
|
||||||
# bus = "pcie-switch-upstream-port-1"
|
|
||||||
# addr = "00.0"
|
|
||||||
# port = "1"
|
|
||||||
# chassis = "5"
|
|
||||||
#
|
|
||||||
#[device "pcie-switch-downstream-port-1-2"]
|
|
||||||
# driver = "xio3130-downstream"
|
|
||||||
# multifunction = "on"
|
|
||||||
# bus = "pcie-switch-upstream-port-1"
|
|
||||||
# addr = "00.1"
|
|
||||||
# port = "1"
|
|
||||||
# chassis = "6"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[device "pcidmi"]
|
|
||||||
driver = "i82801b11-bridge"
|
|
||||||
bus = "pcie.0"
|
|
||||||
addr = "1e.0"
|
|
||||||
|
|
||||||
[device "pci.0"]
|
|
||||||
driver = "pci-bridge"
|
|
||||||
bus = "pcidmi"
|
|
||||||
addr = "1.0"
|
|
||||||
chassis_nr = "1"
|
|
||||||
|
|
||||||
[device "pci.1"]
|
|
||||||
driver = "pci-bridge"
|
|
||||||
bus = "pcidmi"
|
|
||||||
addr = "2.0"
|
|
||||||
chassis_nr = "2"
|
|
||||||
|
|
||||||
[device "pci.2"]
|
|
||||||
driver = "pci-bridge"
|
|
||||||
bus = "pcidmi"
|
|
||||||
addr = "3.0"
|
|
||||||
chassis_nr = "3"
|
|
||||||
|
|
||||||
[device "pci.3"]
|
|
||||||
driver = "pci-bridge"
|
|
||||||
bus = "pcidmi"
|
|
||||||
addr = "4.0"
|
|
||||||
chassis_nr = "4"
|
|
||||||
Binary file not shown.
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
macOS/VM Crash when try connect in WiFi [for BCM94360, in macOS Sonoma or Sequoia]
|
macOS/VM Crash when try connect in WiFi [for BCM94360, in macOS Sonoma, Sequoia or Tahoe]
|
||||||
|
|
||||||
|
FOR PVE v7 ONLY
|
||||||
|
|
||||||
1. Run osx-setup and choose option '200 - Add Promox VE NO Subscription repository'
|
1. Run osx-setup and choose option '200 - Add Promox VE NO Subscription repository'
|
||||||
|
|
||||||
+312
@@ -0,0 +1,312 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# apply-wifi-reset-bus.sh
|
||||||
|
#
|
||||||
|
# Forca secondary bus reset (hot reset no link) em placas WiFi PCIe usadas em
|
||||||
|
# passthrough VFIO, e persiste a configuracao via regra udev.
|
||||||
|
#
|
||||||
|
# Contexto: em varios chips Intel (AX210 8086:2725 e afins) o FLR completa sem
|
||||||
|
# erro mas nao devolve o card a um estado carregavel de firmware. Sintoma: a
|
||||||
|
# placa funciona no primeiro "qm start" depois do boot do host e falha em todos
|
||||||
|
# os starts seguintes -- o driver do guest nao atacha. O secondary bus reset
|
||||||
|
# resolve porque faz hot reset no link PCIe.
|
||||||
|
#
|
||||||
|
# Uso: sudo ./apply-wifi-reset-bus.sh [--all-vendors]
|
||||||
|
#
|
||||||
|
# --all-vendors lista placas de rede sem fio de qualquer fabricante
|
||||||
|
# (por padrao filtra apenas Intel, vendor 0x8086)
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PCI_DEVICES=/sys/bus/pci/devices
|
||||||
|
RULES_DIR=/etc/udev/rules.d
|
||||||
|
FILTER_VENDOR=0x8086
|
||||||
|
VENDOR_LABEL="Intel"
|
||||||
|
|
||||||
|
[[ "${1:-}" == "--all-vendors" ]] && { FILTER_VENDOR=""; VENDOR_LABEL="qualquer fabricante"; }
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- aparencia --
|
||||||
|
if [[ -t 1 ]]; then
|
||||||
|
B=$'\e[1m'; R=$'\e[31m'; G=$'\e[32m'; Y=$'\e[33m'; C=$'\e[36m'; Z=$'\e[0m'
|
||||||
|
else
|
||||||
|
B=""; R=""; G=""; Y=""; C=""; Z=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
info() { printf '%s\n' "$*"; }
|
||||||
|
ok() { printf '%s\n' "${G}✓${Z} $*"; }
|
||||||
|
warn() { printf '%s\n' "${Y}!${Z} $*"; }
|
||||||
|
err() { printf '%s\n' "${R}✗${Z} $*" >&2; }
|
||||||
|
head1() { printf '\n%s\n' "${B}$*${Z}"; }
|
||||||
|
die() { err "$*"; exit 1; }
|
||||||
|
|
||||||
|
# --------------------------------------------------------- estado / cleanup --
|
||||||
|
SYSPATH=""
|
||||||
|
ORIG_METHOD=""
|
||||||
|
RESTORE_NEEDED=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if (( RESTORE_NEEDED )) && [[ -n "$SYSPATH" && -n "$ORIG_METHOD" ]]; then
|
||||||
|
warn "Restaurando reset_method original (${ORIG_METHOD}) apos falha."
|
||||||
|
printf '%s\n' "$ORIG_METHOD" > "$SYSPATH/reset_method" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
# ------------------------------------------------------------ pre-requisitos --
|
||||||
|
(( EUID == 0 )) || die "Rode como root (sudo $0)."
|
||||||
|
|
||||||
|
for bin in lspci udevadm; do
|
||||||
|
command -v "$bin" >/dev/null 2>&1 \
|
||||||
|
|| die "Comando '$bin' nao encontrado. Instale pciutils / systemd-udev."
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ -d "$PCI_DEVICES" ]] || die "$PCI_DEVICES nao existe. Este script e para Linux."
|
||||||
|
|
||||||
|
# ------------------------------------------------------------- enumeracao ----
|
||||||
|
# Classe PCI 0x0280 = Network controller (wireless). Ethernet e 0x0200.
|
||||||
|
declare -a SLOTS=() NAMES=() DRIVERS=() METHODS=()
|
||||||
|
|
||||||
|
for dev in "$PCI_DEVICES"/*/; do
|
||||||
|
slot=$(basename "$dev")
|
||||||
|
[[ -r "$dev/vendor" && -r "$dev/class" ]] || continue
|
||||||
|
|
||||||
|
vendor=$(<"$dev/vendor")
|
||||||
|
[[ -z "$FILTER_VENDOR" || "$vendor" == "$FILTER_VENDOR" ]] || continue
|
||||||
|
|
||||||
|
class=$(<"$dev/class")
|
||||||
|
[[ "${class:0:6}" == "0x0280" ]] || continue
|
||||||
|
|
||||||
|
name=$(lspci -Dnn -s "$slot" 2>/dev/null | cut -d' ' -f2- || true)
|
||||||
|
[[ -n "$name" ]] || name="(descricao indisponivel)"
|
||||||
|
|
||||||
|
if [[ -L "$dev/driver" ]]; then
|
||||||
|
driver=$(basename "$(readlink -f "$dev/driver")")
|
||||||
|
else
|
||||||
|
driver="(nenhum)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -r "$dev/reset_method" ]]; then
|
||||||
|
method=$(<"$dev/reset_method")
|
||||||
|
else
|
||||||
|
method="(indisponivel)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
SLOTS+=("$slot"); NAMES+=("$name"); DRIVERS+=("$driver"); METHODS+=("$method")
|
||||||
|
done
|
||||||
|
|
||||||
|
(( ${#SLOTS[@]} )) || die "Nenhuma placa WiFi PCIe de ${VENDOR_LABEL} encontrada.
|
||||||
|
Se a placa e de outro fabricante, rode com --all-vendors."
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------- menu ----
|
||||||
|
head1 "Placas WiFi PCIe detectadas (${VENDOR_LABEL})"
|
||||||
|
printf '\n'
|
||||||
|
printf ' %-3s %-15s %-11s %-14s %s\n' "#" "SLOT" "DRIVER" "RESET_METHOD" "DISPOSITIVO"
|
||||||
|
printf ' %-3s %-15s %-11s %-14s %s\n' "---" "---------------" "-----------" "--------------" "-----------"
|
||||||
|
for i in "${!SLOTS[@]}"; do
|
||||||
|
marker=""
|
||||||
|
[[ "${METHODS[$i]}" == "bus" ]] && marker=" ${G}(ja em bus)${Z}"
|
||||||
|
printf ' %-3s %-15s %-11s %-14s %s%s\n' \
|
||||||
|
"$((i+1))" "${SLOTS[$i]}" "${DRIVERS[$i]}" "${METHODS[$i]}" "${NAMES[$i]:0:60}" "$marker"
|
||||||
|
done
|
||||||
|
printf '\n'
|
||||||
|
|
||||||
|
if (( ${#SLOTS[@]} == 1 )); then
|
||||||
|
prompt="Selecione a placa [1] (Enter aceita, q sai): "
|
||||||
|
default_choice=1
|
||||||
|
else
|
||||||
|
prompt="Selecione a placa [1-${#SLOTS[@]}] (q sai): "
|
||||||
|
default_choice=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
choice=""
|
||||||
|
while true; do
|
||||||
|
read -r -p "$prompt" choice || die "Entrada interrompida."
|
||||||
|
[[ "$choice" == "q" || "$choice" == "Q" ]] && { info "Cancelado."; exit 0; }
|
||||||
|
[[ -z "$choice" && -n "$default_choice" ]] && choice="$default_choice"
|
||||||
|
if [[ "$choice" =~ ^[0-9]+$ ]] && (( choice >= 1 && choice <= ${#SLOTS[@]} )); then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
err "Opcao invalida."
|
||||||
|
done
|
||||||
|
|
||||||
|
IDX=$((choice-1))
|
||||||
|
SLOT="${SLOTS[$IDX]}"
|
||||||
|
SYSPATH="$PCI_DEVICES/$SLOT"
|
||||||
|
NAME="${NAMES[$IDX]}"
|
||||||
|
CURRENT="${METHODS[$IDX]}"
|
||||||
|
RULE_FILE="$RULES_DIR/99-pci-reset-bus-${SLOT//[:.]/-}.rules"
|
||||||
|
|
||||||
|
head1 "Placa selecionada"
|
||||||
|
info " Slot : $SLOT"
|
||||||
|
info " Dispositivo : $NAME"
|
||||||
|
info " Driver atual : ${DRIVERS[$IDX]}"
|
||||||
|
info " reset_method : $CURRENT"
|
||||||
|
info " Regra udev : $RULE_FILE"
|
||||||
|
|
||||||
|
# -------------------------------------------------------- validacoes previas --
|
||||||
|
[[ -w "$SYSPATH/reset_method" ]] \
|
||||||
|
|| die "$SYSPATH/reset_method nao existe ou nao e gravavel.
|
||||||
|
Este kernel nao expoe controle de reset para esse dispositivo."
|
||||||
|
|
||||||
|
head1 "Verificacoes"
|
||||||
|
|
||||||
|
# Estado atual x persistencia: 'bus' setado na mao nao sobrevive ao reboot.
|
||||||
|
RULE_EXISTS=0
|
||||||
|
[[ -f "$RULE_FILE" ]] && RULE_EXISTS=1
|
||||||
|
|
||||||
|
if [[ "$CURRENT" == "bus" ]]; then
|
||||||
|
if (( RULE_EXISTS )); then
|
||||||
|
ok "Ja esta em 'bus' E a regra udev ja existe."
|
||||||
|
info " Conteudo atual de $RULE_FILE:"
|
||||||
|
sed 's/^/ /' "$RULE_FILE"
|
||||||
|
printf '\n'
|
||||||
|
read -r -p "Reescrever a regra e revalidar mesmo assim? [s/N] " again
|
||||||
|
[[ "$again" =~ ^[sSyY]$ ]] || { info "Nada a fazer. Saindo."; exit 0; }
|
||||||
|
else
|
||||||
|
warn "Ja esta em 'bus', mas NAO ha regra udev para este dispositivo."
|
||||||
|
warn "Isso indica que o valor foi setado a mao e sera perdido no proximo"
|
||||||
|
warn "reboot do host. O script vai criar a regra para tornar permanente."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
info " reset_method atual: '$CURRENT' -> sera forcado para 'bus'."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Aviso sobre VMs em execucao: mexer no reset de um device em uso por uma VM
|
||||||
|
# ligada pode derrubar o dispositivo dentro dela.
|
||||||
|
if command -v qm >/dev/null 2>&1; then
|
||||||
|
running=$(qm list 2>/dev/null | awk 'NR>1 && $3=="running" {print $1}' | tr '\n' ' ' || true)
|
||||||
|
if [[ -n "${running// }" ]]; then
|
||||||
|
warn "VMs em execucao: ${running}"
|
||||||
|
warn "Se alguma usa $SLOT em passthrough, desligue-a antes de continuar."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '\n'
|
||||||
|
read -r -p "Aplicar o patch em ${SLOT}? [s/N] " confirm
|
||||||
|
[[ "$confirm" =~ ^[sSyY]$ ]] || { info "Cancelado."; exit 0; }
|
||||||
|
|
||||||
|
# A partir daqui mexemos no sistema.
|
||||||
|
ORIG_METHOD="$CURRENT"
|
||||||
|
RESTORE_NEEDED=1
|
||||||
|
|
||||||
|
# --------------------------------- passo 1: descobrir metodos disponiveis ----
|
||||||
|
head1 "1/5 Consultando metodos de reset suportados"
|
||||||
|
|
||||||
|
AVAILABLE=""
|
||||||
|
if printf 'default\n' > "$SYSPATH/reset_method" 2>/dev/null; then
|
||||||
|
AVAILABLE=$(<"$SYSPATH/reset_method")
|
||||||
|
info " Metodos disponiveis: $AVAILABLE"
|
||||||
|
else
|
||||||
|
warn "Kernel nao aceitou 'default'; pulando a checagem previa."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$AVAILABLE" ]] && ! grep -qw "bus" <<<"$AVAILABLE"; then
|
||||||
|
die "O dispositivo $SLOT nao suporta secondary bus reset.
|
||||||
|
Metodos disponiveis: $AVAILABLE
|
||||||
|
Isso normalmente significa que ele nao esta sozinho no root port PCIe.
|
||||||
|
Um bus reset ali afetaria dispositivos vizinhos, entao o kernel nao oferece."
|
||||||
|
fi
|
||||||
|
ok "Secondary bus reset ('bus') e suportado."
|
||||||
|
|
||||||
|
# ---------------------------------------- passo 2: escrever a regra udev -----
|
||||||
|
head1 "2/5 Gravando a regra udev"
|
||||||
|
|
||||||
|
if (( RULE_EXISTS )); then
|
||||||
|
BACKUP="${RULE_FILE}.bak.$(date +%Y%m%d%H%M%S)"
|
||||||
|
cp -a "$RULE_FILE" "$BACKUP"
|
||||||
|
info " Backup do arquivo anterior: $BACKUP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > "$RULE_FILE" <<RULE_EOF
|
||||||
|
# Gerado por apply-wifi-reset-bus.sh em $(date -Is)
|
||||||
|
#
|
||||||
|
# $NAME
|
||||||
|
#
|
||||||
|
# O FLR neste dispositivo completa sem erro mas nao o devolve a um estado
|
||||||
|
# carregavel de firmware entre execucoes da VM. Forca secondary bus reset,
|
||||||
|
# que faz hot reset no link PCIe.
|
||||||
|
SUBSYSTEM=="pci", KERNEL=="$SLOT", ATTR{reset_method}="bus"
|
||||||
|
RULE_EOF
|
||||||
|
|
||||||
|
ok "Regra gravada em $RULE_FILE"
|
||||||
|
sed 's/^/ /' "$RULE_FILE"
|
||||||
|
|
||||||
|
# ----------------------------------------------- passo 3: recarregar udev ----
|
||||||
|
head1 "3/5 Recarregando o udev"
|
||||||
|
|
||||||
|
udevadm control --reload
|
||||||
|
ok "Regras recarregadas."
|
||||||
|
|
||||||
|
# ------------------------------ passo 4: validar que a REGRA e quem aplica ---
|
||||||
|
head1 "4/5 Validando"
|
||||||
|
|
||||||
|
# Zera para o default antes do trigger. Se depois do trigger o valor virar
|
||||||
|
# 'bus', a prova e de que foi a regra que aplicou -- e nao um valor residual.
|
||||||
|
if printf 'default\n' > "$SYSPATH/reset_method" 2>/dev/null; then
|
||||||
|
pre=$(<"$SYSPATH/reset_method")
|
||||||
|
info " Antes do trigger : $pre"
|
||||||
|
if [[ "$pre" == "bus" ]]; then
|
||||||
|
warn "Valor default ja e 'bus'; a validacao nao consegue isolar o efeito"
|
||||||
|
warn "da regra, mas a regra esta gravada corretamente."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Nao foi possivel zerar para default; validacao sera menos conclusiva."
|
||||||
|
fi
|
||||||
|
|
||||||
|
udevadm trigger --action=add "$SYSPATH"
|
||||||
|
udevadm settle --timeout=10 || true
|
||||||
|
|
||||||
|
FINAL=$(<"$SYSPATH/reset_method")
|
||||||
|
info " Depois do trigger: $FINAL"
|
||||||
|
|
||||||
|
if [[ "$FINAL" != "bus" ]]; then
|
||||||
|
err "A regra nao surtiu efeito. reset_method continua '$FINAL'."
|
||||||
|
printf '\n'
|
||||||
|
info "Fallback: use um servico systemd, que roda mais tarde no boot e nao"
|
||||||
|
info "depende da janela do evento 'add' do udev:"
|
||||||
|
cat <<'FALLBACK_EOF'
|
||||||
|
|
||||||
|
cat > /etc/systemd/system/pci-reset-bus.service <<'EOF'
|
||||||
|
[Unit]
|
||||||
|
Description=Forca secondary bus reset no dispositivo PCI
|
||||||
|
After=sysinit.target
|
||||||
|
Before=pve-guests.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/bin/sh -c 'echo bus > /sys/bus/pci/devices/SLOT_AQUI/reset_method'
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable pci-reset-bus.service
|
||||||
|
|
||||||
|
FALLBACK_EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ok "reset_method = bus, aplicado pela regra udev."
|
||||||
|
|
||||||
|
# --------------------------------------------------------- passo 5: final ----
|
||||||
|
RESTORE_NEEDED=0
|
||||||
|
|
||||||
|
head1 "5/5 Concluido"
|
||||||
|
printf '\n'
|
||||||
|
ok "Patch aplicado em ${B}${SLOT}${Z} (${NAME})"
|
||||||
|
printf '\n'
|
||||||
|
info "${Y}Falta o teste definitivo: reinicie o host.${Z}"
|
||||||
|
info "O valor de reset_method nao persiste sozinho -- ele volta ao default a"
|
||||||
|
info "cada boot. O que persiste e a regra udev, e so um reboot prova que ela"
|
||||||
|
info "esta sendo aplicada cedo o bastante."
|
||||||
|
printf '\n'
|
||||||
|
info "Depois do reboot, confirme com:"
|
||||||
|
printf '\n'
|
||||||
|
info " ${C}cat /sys/bus/pci/devices/${SLOT}/reset_method${Z} # esperado: bus"
|
||||||
|
printf '\n'
|
||||||
|
info "Se voltar '${AVAILABLE:-flr bus}', o evento 'add' do udev disparou cedo"
|
||||||
|
info "demais no boot; nesse caso troque pelo servico systemd (o script mostra"
|
||||||
|
info "o modelo quando a validacao falha)."
|
||||||
|
printf '\n'
|
||||||
|
info "Para reverter: ${C}rm ${RULE_FILE} && udevadm control --reload${Z}"
|
||||||
|
printf '\n'
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# Disable screensaver
|
||||||
|
defaults -currentHost write com.apple.screensaver idleTime 0
|
||||||
|
|
||||||
|
# Disable transparency and motion effects
|
||||||
|
defaults write com.apple.universalaccess reduceTransparency -bool true
|
||||||
|
defaults write com.apple.universalaccess reduceMotion -bool true
|
||||||
|
|
||||||
|
# Disable Dock animations
|
||||||
|
defaults write com.apple.dock launchanim -bool false
|
||||||
|
defaults write com.apple.dock autohide-delay -float 0
|
||||||
|
defaults write com.apple.dock autohide-time-modifier -float 0
|
||||||
|
defaults write com.apple.dock expose-animation-duration -float 0.1
|
||||||
|
defaults write com.apple.dock no-glass -bool true
|
||||||
|
defaults write com.apple.dock no-bouncing -bool true
|
||||||
|
defaults write com.apple.dock magnification -bool false
|
||||||
|
defaults write com.apple.dock show-recents -bool false
|
||||||
|
defaults write com.apple.dock mineffect -string "scale"
|
||||||
|
defaults write com.apple.dock springboard-show-duration -float 0
|
||||||
|
defaults write com.apple.dock springboard-hide-duration -float 0
|
||||||
|
defaults write com.apple.dock springboard-page-duration -float 0
|
||||||
|
defaults write com.apple.dock workspaces-swoosh-animation-off -bool true
|
||||||
|
defaults write com.apple.dock minimize-to-application -bool true
|
||||||
|
defaults write com.apple.dock slow-motion-allowed -bool false
|
||||||
|
defaults write com.apple.dock missioncontrol-animation-duration -float 0.1
|
||||||
|
defaults write com.apple.dock workspaces-edge-delay -float 0
|
||||||
|
defaults write com.apple.dock springboard-blur-radius -int 0
|
||||||
|
|
||||||
|
# Disable general window and system animations
|
||||||
|
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
|
||||||
|
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
|
||||||
|
defaults write -g NSMenuAnimationDuration -float 0
|
||||||
|
defaults write -g NSPopUpMenuAnimationDuration -float 0
|
||||||
|
defaults write -g NSComboBoxAnimationDuration -float 0
|
||||||
|
defaults write -g NSToolbarAnimationDuration -float 0
|
||||||
|
defaults write -g NSToolbarFullScreenAnimationDuration -float 0
|
||||||
|
defaults write -g NSSheetAnimationEnabled -bool false
|
||||||
|
defaults write -g NSWindowAnimationsEnabled -bool false
|
||||||
|
defaults write -g NSViewAnimationsEnabled -bool false
|
||||||
|
defaults write -g NSScrollAnimationEnabled -bool false
|
||||||
|
defaults write -g NSUseAnimatedFocusRing -bool false
|
||||||
|
defaults write -g NSScrollViewRubberbanding -bool false
|
||||||
|
defaults write -g NSOverlayScrollerHideDelay -float 0
|
||||||
|
defaults write -g QLPanelAnimationDuration -float 0
|
||||||
|
defaults write -g NSWindowSupportsAutomaticFullScreen -bool false
|
||||||
|
defaults write -g NSFullScreenAnimationDuration -float 0
|
||||||
|
defaults write NSGlobalDomain com.apple.springing.enabled -bool false
|
||||||
|
|
||||||
|
# Disable Finder animations
|
||||||
|
defaults write com.apple.finder DisableAllAnimations -bool true
|
||||||
|
defaults write com.apple.finder AnimateInfoPanes -bool false
|
||||||
|
defaults write com.apple.finder AnimateSnapToGrid -bool false
|
||||||
|
|
||||||
|
# GPU / Rendering — Switch to software renderer
|
||||||
|
sudo defaults write /Library/Preferences/com.apple.windowserver UseMetal -bool false
|
||||||
|
sudo defaults write /Library/Preferences/com.apple.windowserver UseOpenGL -bool false
|
||||||
|
sudo defaults write /Library/Preferences/com.apple.windowserver HardwareAccelerated -bool false
|
||||||
|
sudo defaults write /Library/Preferences/com.apple.windowserver EnableShadows -bool false
|
||||||
|
sudo defaults write /Library/Preferences/com.apple.CoreDisplay useMetal -bool false
|
||||||
|
sudo defaults write /Library/Preferences/com.apple.CoreDisplay useIOP -bool false
|
||||||
|
defaults write com.apple.CoreAnimation useSoftwareRenderer -bool true
|
||||||
|
defaults write com.apple.opengl ForceSoftwareRenderer -bool true
|
||||||
|
defaults write com.apple.CoreImage CISoftwareRenderer -bool true
|
||||||
|
defaults write com.apple.screencapture disable-shadow -bool true
|
||||||
|
defaults write com.apple.GPU gpuSwitchingPolicy -int 0
|
||||||
|
|
||||||
|
# Disable Spotlight indexing
|
||||||
|
sudo mdutil -a -i off
|
||||||
|
|
||||||
|
# Disable crash reporter, auto update, Time Machine
|
||||||
|
defaults write com.apple.CrashReporter DialogType -string "none"
|
||||||
|
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool false
|
||||||
|
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
|
||||||
|
|
||||||
|
# Disable Siri
|
||||||
|
defaults write com.apple.assistant.support "Assistant Enabled" -bool false
|
||||||
|
|
||||||
|
# Other optimizations
|
||||||
|
defaults write com.apple.spotlight AnimationDuration -float 0
|
||||||
|
defaults write -g CGFontRenderingFontSmoothingDisabled -bool true
|
||||||
|
defaults write com.apple.frameworks.diskimages skip-verify -bool true
|
||||||
|
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
|
||||||
|
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
|
||||||
|
defaults write com.apple.mail DisableReplyAnimations -bool true
|
||||||
|
defaults write com.apple.mail DisableSendAnimations -bool true
|
||||||
|
defaults write -g NSDocumentSaveNewDocumentsToCloud -bool false
|
||||||
|
defaults write com.apple.finder WarnOnEmptyTrash -bool false
|
||||||
|
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||||
|
defaults write -g userMenuExtraStyle -int 1
|
||||||
|
|
||||||
|
# Apply changes
|
||||||
|
killall Dock && killall Finder && killall SystemUIServer
|
||||||
@@ -28,6 +28,10 @@ Easily install macOS on Proxmox VE with just a few steps! This guide provides th
|
|||||||
|
|
||||||
<img width="1358" height="761" alt="osx-terminal" src="https://github.com/user-attachments/assets/5220cf15-6b2a-454e-a2c9-f5499c50ed0d" />
|
<img width="1358" height="761" alt="osx-terminal" src="https://github.com/user-attachments/assets/5220cf15-6b2a-454e-a2c9-f5499c50ed0d" />
|
||||||
|
|
||||||
|
## ⚠️ This screen is NORMAL after install of osx-proxmox
|
||||||
|
|
||||||
|
<img width="715" height="195" alt="Screenshot 2026-09-02 at 00 16 45" src="https://github.com/user-attachments/assets/5237274f-c6fc-4d24-b1cb-ec61e1d06938" />
|
||||||
|
|
||||||
## 🔧 Additional Configuration
|
## 🔧 Additional Configuration
|
||||||
|
|
||||||
### Install EFI Package in macOS (Disable Gatekeeper First)
|
### Install EFI Package in macOS (Disable Gatekeeper First)
|
||||||
@@ -140,7 +144,14 @@ If you see an Apple logo and the bar doesn’t move on your external display, yo
|
|||||||
In some environments it is necessary to segment the IOMMU Groups to be able to pass the GPU to the VM.
|
In some environments it is necessary to segment the IOMMU Groups to be able to pass the GPU to the VM.
|
||||||
|
|
||||||
1. Add the content `pcie_acs_override=downstream,multifunction pci=nommconf` in the file `/etc/default/grub` at the end of the line `GRUB_CMDLINE_LINUX_DEFAULT`;
|
1. Add the content `pcie_acs_override=downstream,multifunction pci=nommconf` in the file `/etc/default/grub` at the end of the line `GRUB_CMDLINE_LINUX_DEFAULT`;
|
||||||
2. After changing the grub file, run the command `update-grub` and reboot your PVE.
|
2. Some environments, add de content `pcie_port_pm=off` in the file `/etc/default/grub` at the end of the line `GRUB_CMDLINE_LINUX_DEFAULT`;
|
||||||
|
3. After changing the grub file, run the command `update-grub` and reboot your PVE.
|
||||||
|
|
||||||
|
Some environments, you need create a `/etc/modprobe.d/vfio-pci.conf` with content:
|
||||||
|
`options vfio-pci ids=XXXX:XXXX,XXXX:XXXX disable_vga=on`
|
||||||
|
|
||||||
|
More Information of Passthrough
|
||||||
|
[Proxmox Docs](https://pve.proxmox.com/wiki/PCI(e)_Passthrough#_host_device_passthrough)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+27
-3
@@ -65,10 +65,34 @@ log_message "Installing git..."
|
|||||||
apt-get install -y git >> "$LOG_FILE" 2>&1
|
apt-get install -y git >> "$LOG_FILE" 2>&1
|
||||||
check_status "Failed to install git"
|
check_status "Failed to install git"
|
||||||
|
|
||||||
# Clone repository
|
# Download repository (latest version only, without full history)
|
||||||
log_message "Cloning OSX-PROXMOX repository..."
|
REPO_URL="https://github.com/luchina-gabriel/OSX-PROXMOX.git"
|
||||||
git clone --recurse-submodules https://github.com/luchina-gabriel/OSX-PROXMOX.git /root/OSX-PROXMOX >> "$LOG_FILE" 2>&1
|
REPO_DIR="/root/OSX-PROXMOX"
|
||||||
|
|
||||||
|
# Shallow + partial + sparse checkout: fetches only the files the setup needs.
|
||||||
|
# The OpenCore ISO is left out on purpose - the setup downloads it into the ISO
|
||||||
|
# storage on its own, so checking it out here would just duplicate ~96 MB.
|
||||||
|
clone_latest_only() {
|
||||||
|
git clone --depth 1 --filter=blob:none --sparse "$REPO_URL" "$REPO_DIR" &&
|
||||||
|
git -C "$REPO_DIR" sparse-checkout set tools Patches
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message "Downloading OSX-PROXMOX repository (latest version only)..."
|
||||||
|
if ! clone_latest_only >> "$LOG_FILE" 2>&1; then
|
||||||
|
log_message "Partial clone unavailable. Falling back to shallow clone..."
|
||||||
|
rm -rf "$REPO_DIR"
|
||||||
|
git clone --depth 1 "$REPO_URL" "$REPO_DIR" >> "$LOG_FILE" 2>&1
|
||||||
check_status "Failed to clone repository"
|
check_status "Failed to clone repository"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download submodules (GenSMBIOS) at their pinned revision only
|
||||||
|
log_message "Downloading submodules..."
|
||||||
|
if ! git -C "$REPO_DIR" submodule update --init --depth 1 >> "$LOG_FILE" 2>&1; then
|
||||||
|
log_message "Shallow submodule fetch failed. Retrying with full history..."
|
||||||
|
git -C "$REPO_DIR" submodule deinit -f --all >> "$LOG_FILE" 2>&1 || true
|
||||||
|
git -C "$REPO_DIR" submodule update --init --force >> "$LOG_FILE" 2>&1
|
||||||
|
check_status "Failed to download submodules"
|
||||||
|
fi
|
||||||
|
|
||||||
# Ensure directory exists and setup is executable
|
# Ensure directory exists and setup is executable
|
||||||
if [ -f "/root/OSX-PROXMOX/setup" ]; then
|
if [ -f "/root/OSX-PROXMOX/setup" ]; then
|
||||||
|
|||||||
@@ -37,14 +37,13 @@ SCRIPT_DIR="/root/OSX-PROXMOX"
|
|||||||
LOGDIR="${SCRIPT_DIR}/logs"
|
LOGDIR="${SCRIPT_DIR}/logs"
|
||||||
MAIN_LOG="${LOGDIR}/main.log"
|
MAIN_LOG="${LOGDIR}/main.log"
|
||||||
TMPDIR="${SCRIPT_DIR}/tmp"
|
TMPDIR="${SCRIPT_DIR}/tmp"
|
||||||
HACKPXVERSION="2026.08.27"
|
HACKPXVERSION="2026.09.01"
|
||||||
OCVERSION="1.0.7"
|
OCVERSION="1.0.7"
|
||||||
DEFAULT_VM_PREFIX="HACK-"
|
DEFAULT_VM_PREFIX="HACK-"
|
||||||
BASE_RAM_SIZE=4096
|
BASE_RAM_SIZE=4096
|
||||||
RAM_PER_CORE=512
|
RAM_PER_CORE=512
|
||||||
BASE_DISK_SIZE=64
|
BASE_DISK_SIZE=128
|
||||||
DISK_INCREMENT=8
|
MAX_CORES=32
|
||||||
MAX_CORES=16
|
|
||||||
DHCP_CONF_DIR="/etc/dhcp/dhcpd.d"
|
DHCP_CONF_DIR="/etc/dhcp/dhcpd.d"
|
||||||
NETWORK_INTERFACES_FILE="/etc/network/interfaces"
|
NETWORK_INTERFACES_FILE="/etc/network/interfaces"
|
||||||
DHCP_USER="dhcpd"
|
DHCP_USER="dhcpd"
|
||||||
@@ -221,6 +220,16 @@ ensure_base64_xxd_dependency() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to ensure wget is installed
|
||||||
|
ensure_wget_dependency() {
|
||||||
|
local logfile="${LOGDIR}/wget-dependency.log"
|
||||||
|
if ! command -v wget >/dev/null 2>&1; then
|
||||||
|
display_and_log "Installing wget..." "$logfile"
|
||||||
|
apt-get update >>"$logfile" 2>&1 || log_and_exit "Failed to update apt" "$logfile"
|
||||||
|
apt-get install -y wget >>"$logfile" 2>&1 || log_and_exit "Failed to install wget" "$logfile"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to set ISODIR based on selected ISO storage
|
# Function to set ISODIR based on selected ISO storage
|
||||||
set_isodir() {
|
set_isodir() {
|
||||||
local logfile="${LOGDIR}/iso-storage-detection.log"
|
local logfile="${LOGDIR}/iso-storage-detection.log"
|
||||||
@@ -326,10 +335,27 @@ detect_cpu_platform() {
|
|||||||
lscpu | grep -qi "Vendor ID.*AMD" && echo "AMD" || echo "INTEL"
|
lscpu | grep -qi "Vendor ID.*AMD" && echo "AMD" || echo "INTEL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to detect the Intel microarchitecture (CPUID family/model)
|
||||||
|
detect_intel_uarch() {
|
||||||
|
local family model
|
||||||
|
family=$(awk -F': ' '/^cpu family/ {print $2; exit}' /proc/cpuinfo)
|
||||||
|
model=$(awk -F': ' '/^model[[:space:]]*:/ {print $2; exit}' /proc/cpuinfo)
|
||||||
|
if [[ "$family" == "6" ]]; then
|
||||||
|
case "$model" in
|
||||||
|
60|69|70) echo "HASWELL" ;; # Core i5/i7 4xxx Desktop/Mobile (Haswell DT, ULT, GT3e)
|
||||||
|
63) echo "HASWELL_HEDT" ;; # Xeon E5 v3 / Core i7 HEDT (Haswell-E/EP)
|
||||||
|
79|86) echo "BROADWELL_HEDT" ;; # Xeon E5 v4 / Core i7 HEDT (Broadwell-E/EP), Xeon D (Broadwell-DE)
|
||||||
|
*) echo "GENERIC" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "GENERIC"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup prerequisites
|
# Function to setup prerequisites
|
||||||
setup_prerequisites() {
|
setup_prerequisites() {
|
||||||
local logfile="${LOGDIR}/prerequisites-setup.log"
|
local logfile="${LOGDIR}/prerequisites-setup.log"
|
||||||
cp "${SCRIPT_DIR}/EFI/"*.iso "$ISODIR" || log_and_exit "Failed to copy EFI files" "$logfile"
|
# The OpenCore ISO is already provisioned in ISODIR by update_opencore_iso at startup
|
||||||
printf "alias osx-setup='%s/setup'\n" "$SCRIPT_DIR" >> /root/.bashrc
|
printf "alias osx-setup='%s/setup'\n" "$SCRIPT_DIR" >> /root/.bashrc
|
||||||
printf "LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8\n" > /etc/environment
|
printf "LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8\n" > /etc/environment
|
||||||
printf "set mouse-=a\n" > ~/.vimrc
|
printf "set mouse-=a\n" > ~/.vimrc
|
||||||
@@ -407,29 +433,51 @@ create_vm() {
|
|||||||
fi
|
fi
|
||||||
if [[ "$OSX_PLATFORM" == "AMD" ]]; then
|
if [[ "$OSX_PLATFORM" == "AMD" ]]; then
|
||||||
if [[ "$version_name" =~ ^(Ventura|Sonoma|Sequoia|Tahoe)$ ]]; then
|
if [[ "$version_name" =~ ^(Ventura|Sonoma|Sequoia|Tahoe)$ ]]; then
|
||||||
cpu_args="-cpu Cascadelake-Server,vendor=GenuineIntel,+invtsc,-pcid,-hle,-rtm,-avx512f,-avx512dq,-avx512cd,-avx512bw,-avx512vl,-avx512vnni,kvm=on,vmware-cpuid-freq=on"
|
cpu_args="-cpu Skylake-Client-v4,vendor=GenuineIntel,+invtsc,+hypervisor,-pcid,-hle,-rtm,-avx512f,-avx512dq,-avx512cd,-avx512bw,-avx512vl,-avx512vnni,-spec-ctrl,kvm=on,vmware-cpuid-freq=on"
|
||||||
else
|
else
|
||||||
cpu_args="-cpu Penryn,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+fma,+bmi1,+bmi2,+xsave,+xsaveopt,check"
|
cpu_args="-cpu Penryn,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+fma,+bmi1,+bmi2,+xsave,+xsaveopt,check"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
cpu_args="-cpu host,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc"
|
case "$OSX_INTEL_UARCH" in
|
||||||
|
HASWELL)
|
||||||
|
cpu_args="-cpu Haswell-noTSX,stepping=3,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
HASWELL_HEDT)
|
||||||
|
cpu_args="-cpu Haswell-noTSX,model=158,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
BROADWELL_HEDT)
|
||||||
|
cpu_args="-cpu Broadwell-noTSX,model=158,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cpu_args="-cpu Skylake-Client-v4,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+vmx,vmware-cpuid-freq=on"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check QEMU version and append hotplug fix if 6.1 or newer
|
# Check QEMU version and append hotplug fix if 6.1 or newer
|
||||||
local qemu_version=$(qemu-system-x86_64 --version | awk '/version/ {print $4}' | cut -d'(' -f1)
|
local qemu_version=$(qemu-system-x86_64 --version | awk '/version/ {print $4}' | cut -d'(' -f1)
|
||||||
version_compare "$qemu_version" "6.1" && device_args="$device_args -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off"
|
version_compare "$qemu_version" "6.1" && device_args="$device_args -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off"
|
||||||
|
|
||||||
|
# CD-ROM bus: High Sierra (10.13) and Mojave (10.14) use sata0 as the system
|
||||||
|
# disk, so their CD-ROMs stay on IDE to avoid colliding with it.
|
||||||
|
local cdrom_boot cdrom_recovery
|
||||||
|
if [[ "$version_name" =~ ^(High\ Sierra|Mojave)$ ]]; then
|
||||||
|
cdrom_boot="ide0"; cdrom_recovery="ide2"
|
||||||
|
else
|
||||||
|
cdrom_boot="sata0"; cdrom_recovery="sata2"
|
||||||
|
fi
|
||||||
|
|
||||||
qm create "$vm_id" \
|
qm create "$vm_id" \
|
||||||
--agent 1 --args "$device_args $cpu_args" --autostart 0 \
|
--agent 1 --args "$device_args $cpu_args" --autostart 0 \
|
||||||
--balloon 0 --bios ovmf --boot "order=ide0;$disk_type" \
|
--balloon 0 --bios ovmf --boot "order=${cdrom_boot};$disk_type" \
|
||||||
--cores "$core_count" --description "Hackintosh VM - $version_name" \
|
--cores "$core_count" --description "Hackintosh VM - $version_name" \
|
||||||
--efidisk0 "${storage}:4" --machine q35 --memory "$ram_size" \
|
--efidisk0 "${storage}:4" --machine q35 --memory "$ram_size" \
|
||||||
--name "$vm_name" --net0 "vmxnet3,bridge=$bridge" --numa 0 \
|
--name "$vm_name" --net0 "vmxnet3,bridge=$bridge" --numa 0 \
|
||||||
--onboot 0 --ostype other --sockets 1 --start 0 --tablet 1 \
|
--onboot 0 --ostype other --sockets 1 --start 0 --tablet 1 \
|
||||||
--vga vmware --vmgenid 1 --scsihw virtio-scsi-pci \
|
--vga vmware --vmgenid 1 --scsihw virtio-scsi-pci \
|
||||||
--"$disk_type" "${storage}:${disk_size},cache=none,discard=on" \
|
--"$disk_type" "${storage}:${disk_size},cache=none,discard=on" \
|
||||||
--ide0 "${storage_iso}:iso/${iso_file},media=cdrom,cache=unsafe,size=96M" \
|
--"$cdrom_boot" "${storage_iso}:iso/${iso_file},media=cdrom,cache=unsafe,size=96M" \
|
||||||
--ide2 "${storage_iso}:iso/recovery-${version_name,,}.iso,media=cdrom,cache=unsafe,size=${iso_size}" >>"$logfile" 2>&1 || log_and_exit "Failed to create VM" "$logfile"
|
--"$cdrom_recovery" "${storage_iso}:iso/recovery-${version_name,,}.iso,media=cdrom,cache=unsafe,size=${iso_size}" >>"$logfile" 2>&1 || log_and_exit "Failed to create VM" "$logfile"
|
||||||
sed -i 's/media=cdrom/media=disk/' "/etc/pve/qemu-server/$vm_id.conf" >>"$logfile" 2>&1 || log_and_exit "Failed to update VM config" "$logfile"
|
sed -i 's/media=cdrom/media=disk/' "/etc/pve/qemu-server/$vm_id.conf" >>"$logfile" 2>&1 || log_and_exit "Failed to update VM config" "$logfile"
|
||||||
|
|
||||||
display_and_log "VM ($vm_name) created successfully" "$logfile"
|
display_and_log "VM ($vm_name) created successfully" "$logfile"
|
||||||
@@ -854,6 +902,7 @@ update_opencore_iso() {
|
|||||||
iso_path="${ISODIR}/${OPENCORE_ISO}"
|
iso_path="${ISODIR}/${OPENCORE_ISO}"
|
||||||
oc_json_path="${ISODIR}/.smbios.json"
|
oc_json_path="${ISODIR}/.smbios.json"
|
||||||
|
|
||||||
|
ensure_wget_dependency
|
||||||
rm -f "$iso_path" >>"$logfile" 2>&1
|
rm -f "$iso_path" >>"$logfile" 2>&1
|
||||||
if ! wget -q -O "$iso_path" "$iso_url" >>"$logfile" 2>&1; then
|
if ! wget -q -O "$iso_path" "$iso_url" >>"$logfile" 2>&1; then
|
||||||
log_and_exit "Failed to download OpenCore ISO" "$logfile"
|
log_and_exit "Failed to download OpenCore ISO" "$logfile"
|
||||||
@@ -881,6 +930,128 @@ remove_subscription_notice() {
|
|||||||
read -n 1 -sp "Press any key to return to menu..."
|
read -n 1 -sp "Press any key to return to menu..."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to append parameters to the end of the kernel command line, covering
|
||||||
|
# both bootloaders used by Proxmox VE: GRUB (/etc/default/grub) and systemd-boot
|
||||||
|
# (/etc/kernel/cmdline, used when the root filesystem is ZFS)
|
||||||
|
apply_kernel_cmdline_params() {
|
||||||
|
local logname="$1"; shift
|
||||||
|
local params=("$@")
|
||||||
|
local logfile="${LOGDIR}/${logname}.log"
|
||||||
|
local stamp=$(date '+%Y%m%d%H%M%S')
|
||||||
|
local handled=0 changed=0 failed=0 boot_mode="Legacy BIOS"
|
||||||
|
local p current append ok
|
||||||
|
[[ -d /sys/firmware/efi ]] && boot_mode="UEFI"
|
||||||
|
display_and_log "Applying '${params[*]}' to the kernel command line (firmware: ${boot_mode})" "$logfile"
|
||||||
|
|
||||||
|
# GRUB - the parameters are appended to the end of GRUB_CMDLINE_LINUX_DEFAULT
|
||||||
|
if [[ -f /etc/default/grub ]] && command -v update-grub >/dev/null 2>&1; then
|
||||||
|
handled=1
|
||||||
|
if ! grep -Eq '^[[:space:]]*GRUB_CMDLINE_LINUX_DEFAULT=' /etc/default/grub; then
|
||||||
|
display_and_log "GRUB: GRUB_CMDLINE_LINUX_DEFAULT not found in /etc/default/grub, skipping" "$logfile"
|
||||||
|
else
|
||||||
|
current=$(grep -E '^[[:space:]]*GRUB_CMDLINE_LINUX_DEFAULT=' /etc/default/grub | head -n 1)
|
||||||
|
append=""
|
||||||
|
for p in "${params[@]}"; do
|
||||||
|
if grep -Eq "(^|[[:space:]])${p}([[:space:]\"]|\$)" <<< "$current"; then
|
||||||
|
display_and_log "GRUB: ${p} is already set in /etc/default/grub, skipping it" "$logfile"
|
||||||
|
else
|
||||||
|
append="${append} ${p}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ -z "$append" ]]; then
|
||||||
|
display_and_log "GRUB: nothing to add to GRUB_CMDLINE_LINUX_DEFAULT" "$logfile"
|
||||||
|
else
|
||||||
|
cp /etc/default/grub "/etc/default/grub.bak-${stamp}" || log_and_exit "GRUB: failed to back up /etc/default/grub" "$logfile"
|
||||||
|
sed -i -E \
|
||||||
|
-e "s/^([[:space:]]*GRUB_CMDLINE_LINUX_DEFAULT=\")(.*)(\"[[:space:]]*)\$/\1\2${append}\3/" \
|
||||||
|
-e "s/^([[:space:]]*GRUB_CMDLINE_LINUX_DEFAULT=\")[[:space:]]+/\1/" \
|
||||||
|
/etc/default/grub
|
||||||
|
ok=1
|
||||||
|
for p in "${params[@]}"; do
|
||||||
|
grep -Eq "^[[:space:]]*GRUB_CMDLINE_LINUX_DEFAULT=.*${p}" /etc/default/grub || ok=0
|
||||||
|
done
|
||||||
|
if ((ok == 1)); then
|
||||||
|
display_and_log "GRUB: $(grep -E '^[[:space:]]*GRUB_CMDLINE_LINUX_DEFAULT=' /etc/default/grub | head -n 1)" "$logfile"
|
||||||
|
if update-grub >>"$logfile" 2>&1; then
|
||||||
|
changed=1
|
||||||
|
display_and_log "GRUB: /etc/default/grub updated and update-grub completed" "$logfile"
|
||||||
|
else
|
||||||
|
failed=1
|
||||||
|
cp "/etc/default/grub.bak-${stamp}" /etc/default/grub
|
||||||
|
display_and_log "GRUB: update-grub failed, /etc/default/grub restored from backup" "$logfile"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
failed=1
|
||||||
|
cp "/etc/default/grub.bak-${stamp}" /etc/default/grub
|
||||||
|
display_and_log "GRUB: unable to edit GRUB_CMDLINE_LINUX_DEFAULT (unexpected quoting), file restored from backup" "$logfile"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# systemd-boot - hosts booting with proxmox-boot-tool read the cmdline from /etc/kernel/cmdline
|
||||||
|
if [[ -f /etc/kernel/cmdline ]] && command -v proxmox-boot-tool >/dev/null 2>&1; then
|
||||||
|
handled=1
|
||||||
|
current=$(head -n 1 /etc/kernel/cmdline)
|
||||||
|
append=""
|
||||||
|
for p in "${params[@]}"; do
|
||||||
|
if grep -Eq "(^|[[:space:]])${p}([[:space:]]|\$)" <<< "$current"; then
|
||||||
|
display_and_log "systemd-boot: ${p} is already set in /etc/kernel/cmdline, skipping it" "$logfile"
|
||||||
|
else
|
||||||
|
append="${append} ${p}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ -z "$append" ]]; then
|
||||||
|
display_and_log "systemd-boot: nothing to add to /etc/kernel/cmdline" "$logfile"
|
||||||
|
else
|
||||||
|
cp /etc/kernel/cmdline "/etc/kernel/cmdline.bak-${stamp}" || log_and_exit "systemd-boot: failed to back up /etc/kernel/cmdline" "$logfile"
|
||||||
|
sed -i -E "1s/[[:space:]]*\$/${append}/" /etc/kernel/cmdline
|
||||||
|
ok=1
|
||||||
|
for p in "${params[@]}"; do
|
||||||
|
grep -Eq "${p}" /etc/kernel/cmdline || ok=0
|
||||||
|
done
|
||||||
|
if ((ok == 1)); then
|
||||||
|
display_and_log "systemd-boot: $(head -n 1 /etc/kernel/cmdline)" "$logfile"
|
||||||
|
if proxmox-boot-tool refresh >>"$logfile" 2>&1; then
|
||||||
|
changed=1
|
||||||
|
display_and_log "systemd-boot: /etc/kernel/cmdline updated and proxmox-boot-tool refresh completed" "$logfile"
|
||||||
|
else
|
||||||
|
failed=1
|
||||||
|
cp "/etc/kernel/cmdline.bak-${stamp}" /etc/kernel/cmdline
|
||||||
|
display_and_log "systemd-boot: proxmox-boot-tool refresh failed, /etc/kernel/cmdline restored from backup" "$logfile"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
failed=1
|
||||||
|
cp "/etc/kernel/cmdline.bak-${stamp}" /etc/kernel/cmdline
|
||||||
|
display_and_log "systemd-boot: unable to edit /etc/kernel/cmdline, file restored from backup" "$logfile"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ((handled == 0)); then
|
||||||
|
display_and_log "No supported bootloader configuration found (/etc/default/grub or /etc/kernel/cmdline). Nothing was changed." "$logfile"
|
||||||
|
fi
|
||||||
|
if ((changed == 1)); then
|
||||||
|
display_and_log "Parameters applied. A reboot is required for them to take effect." "$logfile"
|
||||||
|
fi
|
||||||
|
if ((failed == 1)); then
|
||||||
|
display_and_log "One or more steps failed, check ${logfile}" "$logfile"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to apply the pcie_port_pm=off fix to the kernel command line
|
||||||
|
apply_pcie_port_pm_off() {
|
||||||
|
apply_kernel_cmdline_params "apply-pcie-port-pm-off" "pcie_port_pm=off"
|
||||||
|
read -n 1 -sp "Press any key to return to menu..."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to apply the PCIe ACS override fix to the kernel command line
|
||||||
|
apply_pcie_acs_override() {
|
||||||
|
apply_kernel_cmdline_params "apply-pcie-acs-override" "pcie_acs_override=downstream,multifunction" "pci=nommconf"
|
||||||
|
read -n 1 -sp "Press any key to return to menu..."
|
||||||
|
}
|
||||||
|
|
||||||
# Function to configure network bridge
|
# Function to configure network bridge
|
||||||
configure_network_bridge() {
|
configure_network_bridge() {
|
||||||
local logfile="${LOGDIR}/configure-network-bridge.log"
|
local logfile="${LOGDIR}/configure-network-bridge.log"
|
||||||
@@ -1229,7 +1400,7 @@ configure_network_bridge() {
|
|||||||
configure_macos_vm() {
|
configure_macos_vm() {
|
||||||
local macopt=$1
|
local macopt=$1
|
||||||
local nextid=$2
|
local nextid=$2
|
||||||
local version_name version board_id model_id iso_size disk_type opt=$3
|
local version_name version board_id model_id iso_size disk_type
|
||||||
IFS='|' read -r version_name version board_id model_id iso_size disk_type <<< "$macopt"
|
IFS='|' read -r version_name version board_id model_id iso_size disk_type <<< "$macopt"
|
||||||
local default_vm_name="${DEFAULT_VM_PREFIX}$(echo "$version_name" | tr -s ' ' | sed 's/^[ ]*//;s/[ ]*$//;s/[ ]/-/g' | tr '[:lower:]' '[:upper:]' | sed 's/-*$//')"
|
local default_vm_name="${DEFAULT_VM_PREFIX}$(echo "$version_name" | tr -s ' ' | sed 's/^[ ]*//;s/[ ]*$//;s/[ ]/-/g' | tr '[:lower:]' '[:upper:]' | sed 's/-*$//')"
|
||||||
validate_vm_name "$default_vm_name" || log_and_exit "Invalid default VM name: $default_vm_name" "${LOGDIR}/main-menu.log"
|
validate_vm_name "$default_vm_name" || log_and_exit "Invalid default VM name: $default_vm_name" "${LOGDIR}/main-menu.log"
|
||||||
@@ -1259,7 +1430,7 @@ configure_macos_vm() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Disk Size
|
# Disk Size
|
||||||
default_disk_size=$((BASE_DISK_SIZE + (opt > 6 ? 2 : opt == 4 ? 1 : 0) * DISK_INCREMENT))
|
local default_disk_size=$BASE_DISK_SIZE
|
||||||
while true; do
|
while true; do
|
||||||
read -rp "Disk size (GB) [default: $default_disk_size]: " SIZEDISK
|
read -rp "Disk size (GB) [default: $default_disk_size]: " SIZEDISK
|
||||||
SIZEDISK=${SIZEDISK:-$default_disk_size}
|
SIZEDISK=${SIZEDISK:-$default_disk_size}
|
||||||
@@ -1430,6 +1601,8 @@ main_menu() {
|
|||||||
echo " 203 - Remove Proxmox subscription notice"
|
echo " 203 - Remove Proxmox subscription notice"
|
||||||
echo " 204 - Add new bridge (macOS in cloud)"
|
echo " 204 - Add new bridge (macOS in cloud)"
|
||||||
echo " 205 - Customize OpenCore config.plist"
|
echo " 205 - Customize OpenCore config.plist"
|
||||||
|
echo " 206 - Apply pcie_port_pm=off (kernel command line)"
|
||||||
|
echo " 207 - Apply pcie_acs_override + pci=nommconf (kernel command line)"
|
||||||
echo
|
echo
|
||||||
echo " 0 - Quit (or ENTER)"
|
echo " 0 - Quit (or ENTER)"
|
||||||
echo
|
echo
|
||||||
@@ -1437,7 +1610,7 @@ main_menu() {
|
|||||||
[[ -z "$OPT" || "$OPT" -eq 0 ]] && exit
|
[[ -z "$OPT" || "$OPT" -eq 0 ]] && exit
|
||||||
|
|
||||||
if [[ ${MACOS_CONFIG[$OPT]} ]]; then
|
if [[ ${MACOS_CONFIG[$OPT]} ]]; then
|
||||||
configure_macos_vm "${MACOS_CONFIG[$OPT]}" "$NEXTID" "$OPT"
|
configure_macos_vm "${MACOS_CONFIG[$OPT]}" "$NEXTID"
|
||||||
else
|
else
|
||||||
case $OPT in
|
case $OPT in
|
||||||
200) add_no_subscription_repo ;;
|
200) add_no_subscription_repo ;;
|
||||||
@@ -1446,6 +1619,8 @@ main_menu() {
|
|||||||
203) remove_subscription_notice ;;
|
203) remove_subscription_notice ;;
|
||||||
204) configure_network_bridge ;;
|
204) configure_network_bridge ;;
|
||||||
205) customize_opencore_config ;;
|
205) customize_opencore_config ;;
|
||||||
|
206) apply_pcie_port_pm_off ;;
|
||||||
|
207) apply_pcie_acs_override ;;
|
||||||
*) echo "Invalid option"; read -n 1 -s ;;
|
*) echo "Invalid option"; read -n 1 -s ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@@ -1461,7 +1636,7 @@ set_isodir
|
|||||||
if [ ! -f "${ISODIR}/${OPENCORE_ISO}" ]; then
|
if [ ! -f "${ISODIR}/${OPENCORE_ISO}" ]; then
|
||||||
update_opencore_iso "0"
|
update_opencore_iso "0"
|
||||||
fi
|
fi
|
||||||
sleep 2
|
|
||||||
OSX_PLATFORM=$(detect_cpu_platform)
|
OSX_PLATFORM=$(detect_cpu_platform)
|
||||||
|
OSX_INTEL_UARCH=$(detect_intel_uarch)
|
||||||
[[ ! -e /etc/pve/qemu-server/.osx-proxmox ]] && setup_prerequisites
|
[[ ! -e /etc/pve/qemu-server/.osx-proxmox ]] && setup_prerequisites
|
||||||
main_menu
|
main_menu
|
||||||
|
|||||||
Reference in New Issue
Block a user