cat m1n1/build/m1n1.bin `find linux/arch/arm64/boot/dts/apple/ -name \*.dtb` <(gzip -c u-boot/u-boot-nodtb.bin) > u-boot.bin
}
+package_boot_bin()
+{
+(
+ export M1N1_VERSION=1.2.2-1
+ rm -rf m1n1_${M1N1_VERSION}
+ mkdir -p m1n1_${M1N1_VERSION}/DEBIAN m1n1_${M1N1_VERSION}/usr/lib/m1n1/
+ cp u-boot.bin m1n1_${M1N1_VERSION}/usr/lib/m1n1/boot.bin
+cat > m1n1_${M1N1_VERSION}/DEBIAN/control <<EOF
+Package: m1n1
+Version: $M1N1_VERSION
+Section: base
+Priority: optional
+Architecture: arm64
+Maintainer: Thomas Glanzmann <thomas@glanzmann.de>
+Description: Apple silicon boot loader
+ Next to m1n1 this also contains the device trees and u-boot.
+EOF
+
+cat > m1n1_${M1N1_VERSION}/DEBIAN/postinst <<EOF
+#!/bin/bash
+
+export PATH=/bin
+cp /boot/efi/m1n1/boot.bin /boot/efi/m1n1/`date +%Y%m%d%H%M`.bin
+cp /usr/lib/m1n1/boot.bin /boot/efi/m1n1/
+EOF
+
+chmod 755 m1n1_${M1N1_VERSION}/DEBIAN/postinst
+)
+ dpkg-deb --build m1n1_${M1N1_VERSION}
+}
+
mkdir -p build
cd build
build_linux
build_m1n1
build_uboot
+package_boot_bin
--- /dev/null
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+set -o xtrace
+
+cd "$(dirname "$0")"
+
+unset LC_CTYPE
+unset LANG
+
+main() {
+ mkdir -p build
+ cd build
+ dpkg -s devscripts >/dev/null 2>&1 || sudo apt-get install devscripts
+ rm -rf libunwind-1.6.2/
+ apt-get source libunwind
+ cd libunwind-1.6.2/
+ EMAIL=thomas@glanzmann.de dch 'Variable page size patch applied'
+ curl -sL https://tg.st/u/0001-libunwind-1.6.2-dynamic-page-size.patch > debian/patches/0001-libunwind-1.6.2-dynamic-page-size.patch
+ echo '0001-libunwind-1.6.2-dynamic-page-size.patch' >> debian/patches/series
+ sudo apt-get build-dep .
+ dpkg-buildpackage -uc -us -a arm64
+}
+
+main "$@"
main() {
mkdir -p build
cd build
+
+ # devscripts needed for dch and dcmd
+ dpkg -s devscripts >/dev/null 2>&1 || sudo apt-get install devscripts
+
command -v git >/dev/null || sudo apt-get install git
test -d mesa || git clone https://gitlab.freedesktop.org/asahi/mesa.git
cd mesa
--- /dev/null
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+set -o xtrace
+
+cd "$(dirname "$0")"
+
+unset LC_CTYPE
+unset LANG
+
+main() {
+ mkdir -p build
+ cd build
+ export META_VERSION=6.1.0-1
+ rm -rf linux-image-asahi_${META_VERSION}
+ mkdir -p linux-image-asahi_${META_VERSION}/DEBIAN
+cat > linux-image-asahi_${META_VERSION}/DEBIAN/control <<EOF
+Package: linux-image-asahi
+Version: $META_VERSION
+Section: base
+Depends: linux-image-6.1.0-rc8-asahi (>= 6.1.0-rc8-asahi-36)
+Priority: optional
+Architecture: arm64
+Maintainer: Thomas Glanzmann <thomas@glanzmann.de>
+Description: Linux for 64-bit apple silicon machines (meta-package)
+EOF
+ dpkg-deb --build linux-image-asahi_${META_VERSION}
+}
+
+main "$@"
+