+export DEBOOTSTRAP=debootstrap
+
+handle_crosscompile()
+{
+ if [ "`uname -m`" != 'aarch64' ]; then
+ export ARCH=arm64
+ export CROSS_COMPILE=aarch64-linux-gnu-
+ export DEBOOTSTRAP=qemu-debootstrap
+ fi
+}
+
+build_linux()
+{
+(
+ handle_crosscompile
+ test -d linux || git clone --depth 1 https://github.com/AsahiLinux/linux -b asahi
+ cd linux
+ git fetch
+ git reset --hard origin/asahi; git clean -f -x -d &> /dev/null
+ curl -s https://tg.st/u/0001-4k-iommu-patch.patch | git am -
+ curl -s https://tg.st/u/DXyl.patch | git am -
+ curl -s https://tg.st/u/0001-apple-mca-correct-prinkts.patch | git am -
+ curl -s https://tg.st/u/XKVZ.patch | git am -
+ curl -s https://tg.st/u/config-2022-02-19 > .config
+ make olddefconfig
+ make -j $(( 2* `nproc`)) V=0 bindeb-pkg
+)
+}
+