-# build_stick()
-# {
-# (
-# # find . | cpio --quiet -H newc -o | pigz > ../stick/initrd.gz
-# # cp /boot/efi/EFI/BOOT/BOOTAA64.EFI efi/boot/
-# # cp /boot/vmlinuz-5.16.0-asahi-next-20220118-14779-ga4d177b3ad21-dirty vmlinuz
-# )
-# }
-
-# build_m1n1
-# build_uboot
-# build_linux
-build_initrd
-# build_stick
+build_di_stick()
+{
+ rm -rf di-stick
+ mkdir -p di-stick/efi/boot di-stick/efi/debian/
+ test -f initrd.gz || wget https://d-i.debian.org/daily-images/arm64/daily/netboot/debian-installer/arm64/initrd.gz
+ sudo rm -rf initrd; mkdir initrd; (cd initrd; gzip -cd ../initrd.gz | sudo cpio -imd --quiet)
+ sudo rm -rf initrd/lib/modules/*
+ sudo cp -a testing/lib/modules/* initrd/lib/modules/
+ sudo cp ../files/wifi.sh initrd/
+ sudo cp ../files/boot.sh initrd/
+ (cd initrd; find . | cpio --quiet -H newc -o | pigz > ../di-stick/initrd.gz)
+ sudo rm -rf initrd
+ cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi di-stick/efi/boot/bootaa64.efi
+ cp testing/boot/vmlinuz* di-stick/vmlinuz
+ cp ../files/grub.cfg di-stick/efi/debian/grub.cfg
+ export KERNEL=`ls -1rt linux-image*.deb | grep -v dbg | tail -1`
+ cp ${KERNEL} di-stick/
+ (cd di-stick; tar cf ../m1-d-i.tar .)
+}
+
+publish_artefacts()
+{
+ export KERNEL=`ls -1rt linux-image*.deb | grep -v dbg | tail -1`
+ cp ${KERNEL} k.deb
+ sudo cp m1-d-i.tar m1.tgz asahi-debian-live.tar u-boot.bin u-boot.macho di-stick/vmlinuz k.deb m1n1/build/m1n1.bin m1n1/build/m1n1.macho /u/
+}
+
+mkdir -p build
+cd build
+
+sudo apt-get install -y build-essential bash git locales gcc-aarch64-linux-gnu libc6-dev-arm64-cross device-tree-compiler imagemagick ccache eatmydata debootstrap pigz libncurses-dev qemu-user-static binfmt-support rsync git
+
+build_linux
+build_m1n1
+build_uboot
+build_rootfs
+build_live_stick
+build_di_stick
+build_dd
+publish_artefacts