]> git.zerfleddert.de Git - m1-debian/blame - m1n1_uboot_kernel.sh
bump versions
[m1-debian] / m1n1_uboot_kernel.sh
CommitLineData
9ac5deac
TG
1#!/usr/bin/env bash
2
3# SPDX-License-Identifier: MIT
4
5set -o errexit
6set -o nounset
7set -o pipefail
8set -o xtrace
9
10cd "$(dirname "$0")"
11
9eed8ca6
TG
12export CARGO_HOME="$(pwd)/build/cargo"
13export RUSTUP_HOME="$(pwd)/build/rust"
14source "$(pwd)/build/cargo/env"
15
9ac5deac
TG
16unset LC_CTYPE
17unset LANG
18
a3103144
TG
19export M1N1_VERSION=1.4.6
20export KERNEL_VERSION=asahi-6.5-26
c63db8ae 21
9ac5deac
TG
22build_linux()
23{
24(
25 test -d linux || git clone https://github.com/AsahiLinux/linux
26 cd linux
27 git fetch -a -t
a3103144 28 git reset --hard $KERNEL_VERSION
e5a3ffbe 29 git clean -f -x -d > /dev/null
7dcd418b 30 cat ../../config.txt > .config
b33d2b4a
TG
31 make LLVM=-15 rustavailable
32 make LLVM=-15 olddefconfig
33 make -j `nproc` LLVM=-15 V=0 bindeb-pkg > /dev/null
9ac5deac
TG
34)
35}
36
37build_m1n1()
38{
39(
40 test -d m1n1 || git clone --recursive https://github.com/AsahiLinux/m1n1
41 cd m1n1
42 git fetch -a -t
65ef55f7 43 git reset --hard v${M1N1_VERSION};
c8c18241 44 git clean -f -x -d > /dev/null
9ac5deac
TG
45 make -j `nproc`
46)
47}
48
49build_uboot()
50{
51(
52 test -d u-boot || git clone https://github.com/AsahiLinux/u-boot
53 cd u-boot
54 git fetch -a -t
e5a3ffbe 55 git reset --hard asahi-v2023.07.02-3
c8c18241 56 git clean -f -x -d > /dev/null
9ac5deac
TG
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
9ac5deac
TG
62}
63
ce492006
TG
64package_boot_bin()
65{
66(
59b40e06
TG
67 rm -rf m1n1_${M1N1_VERSION}_arm64
68 mkdir -p m1n1_${M1N1_VERSION}_arm64/DEBIAN m1n1_${M1N1_VERSION}_arm64/usr/lib/m1n1/
69 cp u-boot.bin m1n1_${M1N1_VERSION}_arm64/usr/lib/m1n1/boot.bin
70 cat <<EOF > m1n1_${M1N1_VERSION}_arm64/DEBIAN/control
ce492006
TG
71Package: m1n1
72Version: $M1N1_VERSION
73Section: base
74Priority: optional
75Architecture: arm64
76Maintainer: Thomas Glanzmann <thomas@glanzmann.de>
77Description: Apple silicon boot loader
78 Next to m1n1 this also contains the device trees and u-boot.
79EOF
80
d201f029 81 cat > m1n1_${M1N1_VERSION}_arm64/DEBIAN/postinst <<'EOF'
ce492006
TG
82#!/bin/bash
83
84export PATH=/bin
b5a41dd1
TG
85if [ -f /boot/efi/m1n1/boot.bin ]; then
86 cp /boot/efi/m1n1/boot.bin /boot/efi/m1n1/`date +%Y%m%d%H%M`.bin
87fi
88mkdir -p /boot/efi/m1n1/
ce492006
TG
89cp /usr/lib/m1n1/boot.bin /boot/efi/m1n1/
90EOF
91
59b40e06
TG
92 chmod 755 m1n1_${M1N1_VERSION}_arm64/DEBIAN/postinst
93 dpkg-deb --build m1n1_${M1N1_VERSION}_arm64
cd6d1106 94)
ce492006
TG
95}
96
9ac5deac
TG
97mkdir -p build
98cd build
99
5a6d8c66 100build_linux
029bb7dc
TG
101build_m1n1
102build_uboot
103package_boot_bin
Impressum, Datenschutz