Aurora Silicon's fork of the Asahi kernel (DisplayPort alt-mode and USB4 for external displays, VRR, ISP and AOP drivers) as an aarch64-only split package, linux-aurora and linux-aurora-headers, pinned to an immutable commit that was cold-boot qualified on a MacBook Pro 14" M1 Pro and 16" M2 Max. It provides and conflicts with linux-asahi so Macs move over in one explicit transaction, and pkgrel 9 orders it after the last build the maralcbr fork published, so already-installed Macs upgrade on -Syu. Metadata: skip_build like the x86 kernels (built only by its own PR), release_ring fast with channels edge and rc, so one merge publishes the same artifact to edge/aarch64 and rc/aarch64 and stable keeps asahi-alarm's linux-asahi. No x86 job is emitted and no shared tooling changes.
226 lines
7.4 KiB
Bash
226 lines
7.4 KiB
Bash
# AArch64 Apple Silicon (Aurora Silicon)
|
|
# Based on the asahi-alarm linux-asahi package by Jos Dehaes and Matthias Kurz.
|
|
#
|
|
# Aurora Silicon maintain a fork of the Asahi kernel carrying DisplayPort
|
|
# alt-mode and USB4 support for external monitors, variable refresh rate, and
|
|
# the ISP and AOP drivers. Those changes touch device trees, the type-C stack
|
|
# and DRM, so they cannot ship as a module: this is a whole alternative kernel
|
|
# for Macs on the Omarchy edge and rc channels. The stable channel keeps
|
|
# asahi-alarm's linux-asahi.
|
|
|
|
_auroraver=7.1.12
|
|
_aurorarel=2
|
|
pkgrel=9
|
|
|
|
# Immutable pin on aurora-silicon/linux (branch aurora-wip). Every bump is a
|
|
# PR that moves _commit and the archive checksum; the pinned commit is cold-boot
|
|
# qualified on MacBook Pro 14" M1 Pro (j314s) and 16" M2 Max (j416c) first.
|
|
_commit=2439016d2e8d3a0d8aebcd243f29604a91f201c9
|
|
|
|
_m1n1_version=1.6.1
|
|
|
|
pkgbase=linux-aurora
|
|
_srcname=linux-${_commit}
|
|
_kernelname=${pkgbase#linux}
|
|
_desc="AArch64 Apple Silicon (Aurora kernel)"
|
|
pkgver="${_auroraver}.aurora${_aurorarel}"
|
|
arch=('aarch64')
|
|
url="https://github.com/aurora-silicon/linux"
|
|
license=('GPL2')
|
|
|
|
makedepends=(
|
|
base-devel bc dtc kmod libelf pahole cpio perl rustup rust-bindgen tar xz xmlto python
|
|
)
|
|
options=('!strip')
|
|
source=(
|
|
https://github.com/aurora-silicon/linux/archive/${_commit}.tar.gz
|
|
config # the main kernel config file
|
|
rust-toolchain.toml
|
|
)
|
|
sha256sums=('6347354537148120fc5448afcb8671a558ce336f731c70690cd88062a903f84d'
|
|
'4228006ad9c5fcc2237b91b3fd1f70934d23e6d8bdb012faf5a763e042a6edee'
|
|
'2a95563bb9f5b216cc3c170a17e9471448bc63a7084bdd67df23d074939b366c')
|
|
|
|
# Kbuild takes ARCH literally and knows arm64, not aarch64.
|
|
export ARCH=arm64
|
|
export KBUILD_BUILD_HOST=archlinux
|
|
export KBUILD_BUILD_USER=$pkgbase
|
|
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
|
|
|
|
prepare() {
|
|
cd $_srcname
|
|
|
|
echo "Setting version..."
|
|
echo "-$_aurorarel-$pkgrel" > localversion.10-pkgrel
|
|
|
|
local src
|
|
for src in "${source[@]}"; do
|
|
src="${src%%::*}"
|
|
src="${src##*/}"
|
|
[[ $src = *.patch ]] || continue
|
|
echo "Applying patch $src..."
|
|
patch -Np1 < "../$src"
|
|
done
|
|
|
|
echo "Pinning the Rust toolchain..."
|
|
cp ../rust-toolchain.toml .
|
|
|
|
echo "Creating build directories..."
|
|
mkdir -p build/base
|
|
|
|
echo "Setting config (base)..."
|
|
cp ../config build/base/.config
|
|
make olddefconfig prepare O=$PWD/build/base
|
|
diff -u ../config build/base/.config || :
|
|
make -s kernelrelease O=$PWD/build/base > build/base/version
|
|
|
|
echo "Prepared $pkgbase version $(<build/base/version)"
|
|
}
|
|
|
|
build() {
|
|
cd $_srcname
|
|
echo "Building base..."
|
|
make all O=$PWD/build/base -j $(nproc)
|
|
}
|
|
|
|
_package_kernel() {
|
|
pkgdesc="The $pkgdesc kernel and modules"
|
|
depends=(coreutils kmod initramfs $2 "m1n1>=$_m1n1_version")
|
|
optdepends=('crda: to set the correct wireless channels of your country'
|
|
'linux-firmware: firmware images needed for some devices')
|
|
provides=(WIREGUARD-MODULE linux=${pkgver} linux-asahi=${pkgver})
|
|
replaces=(wireguard-arch)
|
|
conflicts=(linux-asahi)
|
|
|
|
local kernver="$(<$O/version)"
|
|
local modulesdir="$pkgdir/usr/lib/modules/$kernver"
|
|
|
|
echo "Installing boot image..."
|
|
# systemd expects to find the kernel here to allow hibernation
|
|
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
|
|
install -Dm644 "$O"/arch/arm64/boot/Image "$modulesdir/vmlinuz"
|
|
|
|
# Used by mkinitcpio to name the kernel
|
|
echo "$1" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
|
|
|
|
echo "Installing modules..."
|
|
make O="$O" INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
|
|
|
|
echo "Installing device trees..."
|
|
install -Dt "$modulesdir/dtbs" "$O"/arch/arm64/boot/dts/apple/*.dtb
|
|
|
|
# remove build and source links
|
|
rm -f "$modulesdir"/{source,build}
|
|
}
|
|
|
|
_package() {
|
|
cd $_srcname
|
|
export O="$PWD/build/base"
|
|
_package_kernel "$pkgbase"
|
|
}
|
|
|
|
_package-headers() {
|
|
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
|
|
depends=(pahole)
|
|
provides=(linux-asahi-headers=${pkgver})
|
|
conflicts=(linux-asahi-headers)
|
|
|
|
KARCH=arm64
|
|
|
|
cd $_srcname
|
|
O=build/base
|
|
local builddir="$pkgdir/usr/lib/modules/$(<${O}/version)/build"
|
|
|
|
echo "Installing build files..."
|
|
install -Dt "$builddir" -m644 $O/.config Makefile $O/Module.symvers $O/System.map \
|
|
localversion.* $O/version $O/vmlinux
|
|
install -Dt "$builddir/kernel" -m644 kernel/Makefile
|
|
cp -t "$builddir" -a scripts $O/scripts
|
|
|
|
# required when STACK_VALIDATION is enabled
|
|
#install -Dt "$builddir/tools/objtool" tools/objtool/objtool
|
|
|
|
# required when DEBUG_INFO_BTF_MODULES is enabled
|
|
install -Dt "$builddir/tools/bpf/resolve_btfids" $O/tools/bpf/resolve_btfids/resolve_btfids
|
|
|
|
echo "Installing headers..."
|
|
cp -t "$builddir" -a include $O/include
|
|
|
|
install -Dt "${builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile
|
|
install -Dt "${builddir}/arch/${KARCH}/kernel" -m644 $O/arch/${KARCH}/kernel/asm-offsets.s
|
|
cp -t "${builddir}/arch/${KARCH}" -a arch/${KARCH}/include $O/arch/${KARCH}/include
|
|
|
|
install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
|
|
install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
|
|
|
|
# https://bugs.archlinux.org/task/13146
|
|
install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
|
|
|
|
# https://bugs.archlinux.org/task/20402
|
|
install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
|
|
install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
|
|
install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
|
|
|
|
# https://bugs.archlinux.org/task/71392
|
|
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
|
|
|
|
echo "Installing KConfig files..."
|
|
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
|
|
|
|
echo "Installing unstripped VDSO..."
|
|
make O="$O" INSTALL_MOD_PATH="$pkgdir/usr" vdso_install link=
|
|
|
|
echo "Removing unneeded architectures..."
|
|
local arch
|
|
for arch in "$builddir"/arch/*/; do
|
|
[[ $arch = */${KARCH}/ ]] && continue
|
|
echo "Removing $(basename "$arch")"
|
|
rm -r "$arch"
|
|
done
|
|
|
|
echo "Removing documentation..."
|
|
rm -r "$builddir/Documentation"
|
|
|
|
echo "Removing broken symlinks..."
|
|
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
|
|
|
|
echo "Removing loose objects..."
|
|
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
|
|
|
|
echo "Removing cmd files..."
|
|
find "$builddir" -type f -name '*.cmd' -printf 'Removing %P\n' -delete
|
|
|
|
echo "Stripping build tools..."
|
|
local file
|
|
while read -rd '' file; do
|
|
case "$(file --no-sandbox -bi "$file")" in
|
|
application/x-sharedlib\;*) # Libraries (.so)
|
|
strip -v $STRIP_SHARED "$file" ;;
|
|
application/x-archive\;*) # Libraries (.a)
|
|
strip -v $STRIP_STATIC "$file" ;;
|
|
application/x-executable\;*) # Binaries
|
|
strip -v $STRIP_BINARIES "$file" ;;
|
|
application/x-pie-executable\;*) # Relocatable binaries
|
|
strip -v $STRIP_SHARED "$file" ;;
|
|
esac
|
|
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
|
|
|
|
echo "Stripping vmlinux..."
|
|
strip -v $STRIP_STATIC "$builddir/vmlinux"
|
|
|
|
echo "Adding symlink..."
|
|
mkdir -p "$pkgdir/usr/src"
|
|
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
|
|
|
|
}
|
|
|
|
pkgname=("$pkgbase" "$pkgbase-headers")
|
|
for _p in "${pkgname[@]}"; do
|
|
eval "package_$_p() {
|
|
$(declare -f "_package${_p#$pkgbase}")
|
|
_package${_p#$pkgbase}
|
|
}"
|
|
done
|
|
|
|
# vim:set ts=8 sts=2 sw=2 et:
|