+build_efi()
+{
+(
+ rm -rf EFI
+ mkdir -p EFI/boot EFI/debian
+ cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi EFI/boot/bootaa64.efi
+
+ export INITRD=`ls -1 testing/boot/ | grep initrd`
+ export VMLINUZ=`ls -1 testing/boot/ | grep vmlinuz`
+ export UUID=`blkid -s UUID -o value media`
+ cat > EFI/debian/grub.cfg <<EOF
+search.fs_uuid ${UUID} root
+linux (\$root)/boot/${VMLINUZ} root=UUID=${UUID} rw
+initrd (\$root)/boot/${INITRD}
+boot
+EOF
+ tar czf efi.tgz EFI
+)
+}
+
+build_asahi_installer_image()
+{
+(
+ rm -rf aii
+ mkdir -p aii/esp/m1n1
+ cp -a EFI aii/esp/
+ cp u-boot.bin aii/esp/m1n1/boot.bin
+ ln media aii/media
+ cd aii
+ zip -r9 ../debian-base.zip esp media
+)
+}
+
+build_di_stick()
+{
+ rm -rf di-stick
+ mkdir -p di-stick/efi/boot di-stick/efi/debian/
+ rm -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 -9 > ../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 efi.tgz asahi-debian-live.tar u-boot.bin u-boot.macho 2k.bin 4k.bin k.deb m1n1/build/m1n1.bin m1n1/build/m1n1.macho testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi debian-base.zip /u/
+}
+