9f6794ea97
Build / BIOS / i386 (push) Has been cancelled
Build / BIOS / x86_64 (push) Has been cancelled
Build / SBI / riscv32 (push) Has been cancelled
Build / SBI / riscv64 (push) Has been cancelled
Build / UEFI / arm32 (push) Has been cancelled
Build / UEFI / arm64 (push) Has been cancelled
Build / UEFI / i386 (push) Has been cancelled
Build / UEFI / loong64 (push) Has been cancelled
Build / UEFI / riscv32 (push) Has been cancelled
Build / UEFI / riscv64 (push) Has been cancelled
Build / UEFI / x86_64 (push) Has been cancelled
Build / UEFI SB / arm64 (push) Has been cancelled
Build / UEFI SB / x86_64 (push) Has been cancelled
Build / SB Sign / arm64 (push) Has been cancelled
Build / SB Sign / x86_64 (push) Has been cancelled
Build / Linux / arm32 (push) Has been cancelled
Build / Linux / arm64 (push) Has been cancelled
Build / Linux / i386 (push) Has been cancelled
Build / Linux / loong64 (push) Has been cancelled
Build / Linux / riscv32 (push) Has been cancelled
Build / Linux / riscv64 (push) Has been cancelled
Build / Linux / x86_64 (push) Has been cancelled
Build / UEFI shim (push) Has been cancelled
Build / Combine (push) Has been cancelled
Build / Version (push) Has been cancelled
Build / Publish (push) Has been cancelled
Build / Release (push) Has been cancelled
80 lines
3.0 KiB
Bash
80 lines
3.0 KiB
Bash
#!/usr/bin/env bash
|
|
# =============================================================================
|
|
# Mac-specific iPXE build shortcut
|
|
#
|
|
# Builds both the native tg3 EFI binary and an SNP fallback, with the
|
|
# boot.ipxe script embedded in each. Outputs to ./build/.
|
|
#
|
|
# Usage:
|
|
# ./build-mac.sh [--embed <script>]
|
|
#
|
|
# Options:
|
|
# -e, --embed <file> Boot script to embed (default: boot.ipxe if it exists)
|
|
# -j, --jobs <n> Parallel jobs (default: nproc)
|
|
# -h, --help
|
|
# =============================================================================
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(dirname "$0")"
|
|
JOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)"
|
|
EMBED=""
|
|
|
|
# ── Colour helpers ────────────────────────────────────────────────────────────
|
|
if [ -t 1 ]; then
|
|
C_BOLD='\033[1m'; C_GREEN='\033[0;32m'; C_CYAN='\033[0;36m'
|
|
C_YELLOW='\033[0;33m'; C_RED='\033[0;31m'; C_RESET='\033[0m'
|
|
else
|
|
C_BOLD=''; C_GREEN=''; C_CYAN=''; C_YELLOW=''; C_RED=''; C_RESET=''
|
|
fi
|
|
info() { echo -e "${C_CYAN}▶${C_RESET} $*"; }
|
|
ok() { echo -e "${C_GREEN}✔${C_RESET} $*"; }
|
|
die() { echo -e "${C_RED}✘${C_RESET} $*" >&2; exit 1; }
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-e|--embed) EMBED="$2"; shift 2 ;;
|
|
-j|--jobs) JOBS="$2"; shift 2 ;;
|
|
-h|--help) sed -n '3,12p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
*) die "Unknown option: $1" ;;
|
|
esac
|
|
done
|
|
|
|
# Default embed: boot.ipxe in repo root if present
|
|
if [[ -z "$EMBED" && -f "$SCRIPT_DIR/boot.ipxe" ]]; then
|
|
EMBED="$SCRIPT_DIR/boot.ipxe"
|
|
info "Auto-detected embed script: $EMBED"
|
|
fi
|
|
|
|
EMBED_OPT=""
|
|
[[ -n "$EMBED" ]] && EMBED_OPT="--embed $EMBED"
|
|
|
|
# ── Build matrix ──────────────────────────────────────────────────────────────
|
|
#
|
|
# ipxe-x64.efi — full iPXE with native tg3 driver (preferred for Intel Macs)
|
|
# snponly-x64.efi — SNP-only fallback (for Macs where tg3 probe fails)
|
|
#
|
|
echo -e "${C_BOLD}Mac iPXE build${C_RESET}"
|
|
echo ""
|
|
|
|
info "1/2 Native tg3 EFI binary (efi-x64)…"
|
|
bash "$SCRIPT_DIR/build.sh" -p efi-x64 -j "$JOBS" $EMBED_OPT
|
|
echo ""
|
|
|
|
info "2/2 SNP fallback binary (snp-x64)…"
|
|
bash "$SCRIPT_DIR/build.sh" -p snp-x64 -j "$JOBS" $EMBED_OPT
|
|
echo ""
|
|
|
|
# ── Summary ───────────────────────────────────────────────────────────────────
|
|
BUILD_DIR="$SCRIPT_DIR/build"
|
|
echo -e "${C_BOLD}Output files:${C_RESET}"
|
|
for f in "$BUILD_DIR"/*.efi; do
|
|
size=$(du -h "$f" | cut -f1)
|
|
ok " $size $(basename "$f")"
|
|
done
|
|
|
|
echo ""
|
|
echo -e "${C_BOLD}Usage on Mac:${C_RESET}"
|
|
echo " 1. Copy ipxe-x64.efi to USB as /EFI/BOOT/BOOTX64.EFI"
|
|
echo " 2. Boot Mac, hold Option key, select USB"
|
|
echo " 3. If NIC not found, repeat with snponly-x64.efi"
|