3 # SPDX-License-Identifier: MIT
12 export CARGO_HOME
="$(pwd)/build/cargo"
13 export RUSTUP_HOME
="$(pwd)/build/rust"
14 source "$(pwd)/build/cargo/env"
19 export M1N1_VERSION
=1.4.6
20 export KERNEL_VERSION
=asahi-6.5
-26
25 test -d linux || git clone https
://github.com
/AsahiLinux
/linux
28 git
reset --hard $KERNEL_VERSION
29 git clean
-f -x -d > /dev
/null
30 cat ..
/..
/config.txt
> .config
31 make LLVM
=-15 rustavailable
32 make LLVM
=-15 olddefconfig
33 make -j `nproc` LLVM
=-15 V
=0 bindeb-pkg
> /dev
/null
40 test -d m1n1 || git clone
--recursive https
://github.com
/AsahiLinux
/m1n1
43 git
reset --hard v
${M1N1_VERSION};
44 git clean
-f -x -d > /dev
/null
52 test -d u-boot || git clone https
://github.com
/AsahiLinux
/u-boot
55 git
reset --hard asahi-v2023.07
.02-3
56 git clean
-f -x -d > /dev
/null
58 make apple_m1_defconfig
61 cat m1n
1/build
/m1n1.bin
`find linux/arch/arm64/boot/dts/apple/ -name \*.dtb` <(gzip -c u-boot
/u-boot-nodtb.bin
) > u-boot.bin
67 rm -rf m1n1_
${M1N1_VERSION}_arm64
68 mkdir
-p m1n1_
${M1N1_VERSION}_arm64
/DEBIAN m1n1_
${M1N1_VERSION}_arm64
/usr
/lib
/m1n
1/
69 cp u-boot.bin m1n1_
${M1N1_VERSION}_arm64
/usr
/lib
/m1n
1/boot.bin
70 cat <<EOF > m1n1_${M1N1_VERSION}_arm64/DEBIAN/control
72 Version: $M1N1_VERSION
76 Maintainer: Thomas Glanzmann <thomas@glanzmann.de>
77 Description: Apple silicon boot loader
78 Next to m1n1 this also contains the device trees and u-boot.
81 cat > m1n1_
${M1N1_VERSION}_arm64
/DEBIAN
/postinst
<<'EOF'
85 if [ -f /boot/efi/m1n1/boot.bin ]; then
86 cp /boot/efi/m1n1/boot.bin /boot/efi/m1n1/`date +%Y%m%d%H%M`.bin
88 mkdir -p /boot/efi/m1n1/
89 cp /usr/lib/m1n1/boot.bin /boot/efi/m1n1/
92 chmod 755 m1n1_
${M1N1_VERSION}_arm64
/DEBIAN
/postinst
93 dpkg-deb
--build m1n1_
${M1N1_VERSION}_arm64