]> git.zerfleddert.de Git - m1-debian/blob - gpu.sh
use suggestion from ahdeb
[m1-debian] / gpu.sh
1 #!/usr/bin/env bash
2
3 # SPDX-License-Identifier: MIT
4
5 set -o errexit
6 set -o nounset
7 set -o pipefail
8 set -o xtrace
9
10 cd "$(dirname "$0")"
11
12 unset LC_CTYPE
13 unset LANG
14
15 handle_crosscompile()
16 {
17 if [ "`uname -m`" != 'aarch64' ]; then
18 export ARCH=arm64
19 export CROSS_COMPILE=aarch64-linux-gnu-
20 export DEBOOTSTRAP=qemu-debootstrap
21 sudo apt install -y libc6-dev-arm64-cross
22 fi
23 }
24
25 build_linux()
26 {
27 (
28 test -d linux || git clone https://github.com/AsahiLinux/linux
29 cd linux
30 git fetch -a -t
31 git reset --hard asahi-6.1-rc8-3;
32 source "$HOME/.cargo/env"
33 cat ../../config-gpu.txt > .config
34 make LLVM=-14 olddefconfig
35 make -j `nproc` LLVM=-14 V=0 bindeb-pkg > /dev/null
36 )
37 }
38
39 build_m1n1()
40 {
41 (
42 test -d m1n1 || git clone --recursive https://github.com/AsahiLinux/m1n1
43 cd m1n1
44 git fetch -a -t
45 git reset --hard v1.2.2;
46 make -j `nproc`
47 )
48 }
49
50 build_uboot()
51 {
52 (
53 test -d u-boot || git clone https://github.com/AsahiLinux/u-boot
54 cd u-boot
55 git fetch -a -t
56 git reset --hard asahi-v2022.10-1;
57
58 make apple_m1_defconfig
59 make -j `nproc`
60 )
61 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
62 }
63
64 mkdir -p build
65 cd build
66
67 handle_crosscompile
68 build_linux
69 build_m1n1
70 build_uboot
Impressum, Datenschutz