Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions srcpkgs/asahi-base/files/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright The Asahi Linux Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions srcpkgs/asahi-base/files/dracut-asahi.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This conf adds modules necessary for using Linux on Apple Silicon Macs,
# which are not otherwise included due to being soft dependencies.

# For NVMe & SMC
add_drivers+=" apple-mailbox "

# For NVMe
add_drivers+=" nvme_apple "

# For USB and HID
add_drivers+=" pinctrl-apple-gpio "

# For USB
add_drivers+=" i2c-apple tps6598x apple-dart dwc3 dwc3-of-simple xhci-pci pcie-apple "

# For HID
add_drivers+=" spi-apple spi-hid-apple spi-hid-apple-of "

# For RTC
add_drivers+=" rtc-macsmc simple-mfd-spmi spmi-apple-controller nvmem_spmi_mfd "

# SMC drivers that are builtins with the current config
#add_drivers+=" macsmc macsmc-rtkit gpio_macsmc "
48 changes: 48 additions & 0 deletions srcpkgs/asahi-base/files/update-grub-image
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
# SPDX-License-Identifier: MIT

set -e

BOOT_PART="/boot"
BOOT_ROOT="$(grub-mkrelpath $BOOT_PART)"
BOOT_ROOT="${BOOT_ROOT:-/}"
EFI_PART="/boot/efi"
GRUB_DIR="$BOOT_PART/grub"
CONFIG="$GRUB_DIR/grub.cfg"
TARGET="$EFI_PART/EFI/BOOT/BOOTAA64.EFI"
MODULES="ext2 fat part_gpt search"

[ -f /etc/default/update-grub-image ] && . /etc/default/update-grub-image

uuid="$(grub-probe "$BOOT_PART" -t fs_uuid)"
part="$(grub-probe "$BOOT_PART" -t drive | sed -e 's/(.*,/hd0,/' | tr -d ')')"

if [ -z "$uuid" ]; then
echo "Error: Unable to determine boot filesystem UUID"
exit 1
fi

echo "UUID: $uuid"
echo "Partition: $part"

cat > /tmp/grub-core.cfg <<EOF
search.fs_uuid $uuid root $part
set prefix=(\$root)"$BOOT_ROOT/grub"
EOF

echo "Generating GRUB image..."
mkdir -p "$GRUB_DIR/arm64-efi"
grub-mkimage \
--directory '/usr/lib/grub/arm64-efi' \
-c /tmp/grub-core.cfg \
--prefix "$part$BOOT_ROOT/grub" \
--output "$GRUB_DIR"/arm64-efi/core.efi \
--format arm64-efi \
--compression auto \
$MODULES

mkdir -p "$(dirname $TARGET)"
cp "$GRUB_DIR"/arm64-efi/core.efi "$TARGET"
rm /tmp/grub-core.cfg

grub-mkconfig -o "$CONFIG"
53 changes: 53 additions & 0 deletions srcpkgs/asahi-base/files/update-vendor-firmware
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh
# SPDX-License-Identifier: MIT

set -e

VENDORFW=/boot/efi/vendorfw
TARGET=/lib/firmware
TARGET_MANIFEST=".vendorfw.manifest"

[ -f /etc/default/update-vendor-firmware ] && . /etc/default/update-vendor-firmware

if [ ! -d "$VENDORFW" ]; then
echo "No vendor firmware available"
exit 0
fi

if [ ! -f "$VENDORFW/manifest.txt" ]; then
echo "$VENDORFW/manifest.txt not found"
exit 1
fi

if [ ! -f "$VENDORFW/firmware.tar" ]; then
echo "$VENDORFW/firmware.tar not found"
exit 1
fi

mkdir -p "$TARGET"
cd "$TARGET"

[ -f "$TARGET_MANIFEST" ] && \
cmp -s "$TARGET_MANIFEST" "$VENDORFW/manifest.txt" && exit 0

echo "Extracting updated vendor firmware..."
tar xf "$VENDORFW/firmware.tar"

if [ -f "$TARGET_MANIFEST" ]; then
echo "Cleaning up obsolete firmware..."
manifest_sorted=$(mktemp)
target_manifest_sorted=$(mktemp)
sort "$VENDORFW/manifest.txt" | "$manifest_sorted"
sort "$TARGET_MANIFEST" | "$target_manifest_sorted"
comm "$manifest_sorted" "$target_manifest_sorted" -13 \
| while read type name rest; do
rm -v "$name" || true
dir="$(dirname "$name")"
rmdir "$dir" 2>/dev/null || true
done
rm "$manifest_sorted" "$target_manifest_sorted"
fi

cp "$VENDORFW/manifest.txt" "$TARGET_MANIFEST"

echo "Done"
18 changes: 18 additions & 0 deletions srcpkgs/asahi-base/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Template file for 'asahi-base'
pkgname=asahi-base
version=20220327
revision=1
archs="aarch64*"
build_style=meta
depends="linux-asahi asahi-uboot m1n1 dracut"
short_desc="Void Linux Apple Silicon support package"
maintainer="Will Springer <skirmisher@protonmail.com>"
license="MIT"
homepage="http://asahilinux.org"

do_install() {
vbin "$FILESDIR/update-grub-image"
vbin "$FILESDIR/update-vendor-firmware"
vinstall "$FILESDIR/dracut-asahi.conf" 644 usr/lib/dracut/dracut.conf.d 10-asahi.conf
vlicense "$FILESDIR/LICENSE"
}
8 changes: 8 additions & 0 deletions srcpkgs/asahi-uboot/INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
case $ACTION in
post)
if [ -f "usr/lib/asahi-boot/m1n1.bin" ] && command -v update-m1n1 >/dev/null; then
update-m1n1
fi
;;
esac
48 changes: 48 additions & 0 deletions srcpkgs/asahi-uboot/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Template file for 'asahi-uboot'
pkgname=asahi-uboot
_commit=89dbe1bf776ac909319247bd66f73c5d2cdac838
version=2022.04.rc4.20220319
revision=1
archs="aarch64*"
wrksrc="u-boot-${_commit}"
hostmakedepends="flex bc dtc openssl-devel" # until uboot supports skipping tools build...
short_desc="U-Boot for Apple Silicon Macs"
maintainer="Will Springer <skirmisher@protonmail.com>"
license="GPL-2.0-or-later, MIT"
homepage="http://asahilinux.org"
distfiles="https://github.com/AsahiLinux/u-boot/archive/${_commit}.tar.gz"
checksum="d6b90132e7ededc6529f2516475218f76596900ace3082fcd027a0f01065553f"

do_configure() {
unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
make ${makejobs} apple_m1_defconfig
}

do_build() {
unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
if [ "$CROSS_BUILD" ]; then
export CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-
fi
make ${makejobs} EXTRAVERSION=-${revision}
}

do_install() {
vinstall u-boot-nodtb.bin 0644 usr/lib/asahi-boot
for dtb in arch/arm/dts/t[86]*.dtb ; do
vinstall ${dtb} 0644 usr/lib/asahi-boot/dtb
done

vlicense Licenses/Exceptions
vlicense Licenses/OFL.txt
vlicense Licenses/README
vlicense Licenses/bsd-2-clause.txt
vlicense Licenses/bsd-3-clause.txt
vlicense Licenses/eCos-2.0.txt
vlicense Licenses/gpl-2.0.txt
vlicense Licenses/ibm-pibs.txt
vlicense Licenses/isc.txt
vlicense Licenses/lgpl-2.0.txt
vlicense Licenses/lgpl-2.1.txt
vlicense Licenses/r8a779x_usb3.txt
vlicense Licenses/x11.txt
}
1 change: 1 addition & 0 deletions srcpkgs/linux-asahi-dbg
1 change: 1 addition & 0 deletions srcpkgs/linux-asahi-headers
Loading