]> git.zerfleddert.de Git - m1-debian/blame - bootstrap.sh
incoporate gpu kernel into live and installation system
[m1-debian] / bootstrap.sh
CommitLineData
aae6cdc3 1#!/usr/bin/env bash
2df410ee 2
605f3b2d
TG
3# SPDX-License-Identifier: MIT
4
aae6cdc3
TG
5set -o errexit
6set -o nounset
7set -o pipefail
8set -o xtrace
9
10cd "$(dirname "$0")"
2df410ee
TG
11
12unset LC_CTYPE
13unset LANG
14
0bffa1b0
TG
15export DEBOOTSTRAP=debootstrap
16
f325b48f 17build_rootfs()
ce8ebd75
TG
18{
19(
0bffa1b0 20 handle_crosscompile
350079f4 21 sudo rm -rf testing
ae43a6ec 22 mkdir -p cache
8b2a692f 23 sudo eatmydata ${DEBOOTSTRAP} --cache-dir=`pwd`/cache --arch=arm64 --include initramfs-tools,pciutils,wpasupplicant,tcpdump,vim,tmux,vlan,ntpdate,parted,curl,wget,grub-efi-arm64,mtr-tiny,dbus,ca-certificates,sudo,openssh-client,mtools,gdisk,cryptsetup testing testing http://deb.debian.org/debian
ce8ebd75
TG
24
25 cd testing
26
62ba1d23 27 sudo mkdir -p boot/efi/m1n1
60b2ebc1 28
16cad30f 29 sudo bash -c 'echo debian > etc/hostname'
f325b48f 30
350079f4 31 sudo bash -c 'echo > etc/motd'
ce8ebd75 32
08045305 33 sudo cp ../../files/sources.list etc/apt/sources.list
62ba1d23
TG
34 sudo cp ../../files/glanzmann.list etc/apt/sources.list.d/
35 sudo cp ../../files/thomas-glanzmann.gpg etc/apt/trusted.gpg.d/
08045305 36 sudo cp ../../files/hosts etc/hosts
8d82f6b0 37 sudo cp ../../files/resolv.conf etc/resolv.conf
08045305 38 sudo cp ../../files/quickstart.txt root/
da7dd4b8 39 sudo cp ../../files/interfaces etc/network/interfaces
7a54df2e 40 sudo cp ../../files/wpa.conf etc/wpa_supplicant/wpa_supplicant.conf
b96f460f 41 sudo cp ../../files/rc.local etc/rc.local
ce8ebd75 42
f325b48f 43 sudo bash -c 'chroot . apt update'
0bffa1b0 44 sudo bash -c 'chroot . apt install -y firmware-linux'
ce8ebd75
TG
45
46 sudo -- perl -p -i -e 's/root:x:/root::/' etc/passwd
47
f325b48f 48 sudo -- ln -s lib/systemd/systemd init
ce8ebd75 49
62ba1d23
TG
50 sudo chroot . apt update
51 sudo chroot . apt install -y m1n1 linux-image-asahi
ce8ebd75 52
60cb512a 53 sudo bash -c 'chroot . apt-get clean'
ce8ebd75
TG
54)
55}
5920ad39 56
bca3e283 57build_live_stick()
f325b48f
TG
58{
59(
bca3e283
TG
60 rm -rf live-stick
61 mkdir -p live-stick/efi/boot live-stick/efi/debian/
f493aec2
TG
62 sudo cp ../files/wifi.pl testing/etc/rc.local
63 sudo bash -c 'cd testing; find . | cpio --quiet -H newc -o | pigz -9 > ../live-stick/initrd.gz'
bca3e283
TG
64 cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi live-stick/efi/boot/bootaa64.efi
65 cp testing/boot/vmlinuz* live-stick/vmlinuz
66 cp ../files/grub.cfg live-stick/efi/debian/grub.cfg
7a54df2e 67 (cd live-stick; tar cf ../asahi-debian-live.tar .)
f325b48f
TG
68)
69}
5920ad39 70
0ffed154
TG
71build_efi()
72{
73(
7da211a3 74 rm -rf EFI
60b2ebc1 75 mkdir -p EFI/boot EFI/debian
0ffed154
TG
76 cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi EFI/boot/bootaa64.efi
77
78 export INITRD=`ls -1 testing/boot/ | grep initrd`
79 export VMLINUZ=`ls -1 testing/boot/ | grep vmlinuz`
eb57d280 80 export UUID=`blkid -s UUID -o value media`
60b2ebc1 81 cat > EFI/debian/grub.cfg <<EOF
0ffed154 82search.fs_uuid ${UUID} root
60b2ebc1
TG
83linux (\$root)/boot/${VMLINUZ} root=UUID=${UUID} rw
84initrd (\$root)/boot/${INITRD}
0ffed154
TG
85boot
86EOF
87 tar czf efi.tgz EFI
88)
89}
90
5d41b6d6
TG
91build_asahi_installer_image()
92{
304bd206
TG
93(
94 rm -rf aii
1cf0f22b 95 mkdir -p aii/esp/m1n1
304bd206 96 cp -a EFI aii/esp/
62ba1d23 97 cp testing/boot/esp/m1n1/boot.bin aii/esp/m1n1/boot.bin
304bd206
TG
98 ln media aii/media
99 cd aii
1cf0f22b 100 zip -r9 ../debian-base.zip esp media
304bd206 101)
5d41b6d6
TG
102}
103
3b4d866f 104publish_artefacts()
bb14d862 105{
59b40e06 106 sudo cp efi.tgz asahi-debian-live.tar debian-base.zip /u/
bb14d862
TG
107}
108
08045305
TG
109mkdir -p build
110cd build
111
56d14923 112sudo apt-get install -y build-essential bash git locales gcc-aarch64-linux-gnu libc6-dev device-tree-compiler imagemagick ccache eatmydata debootstrap pigz libncurses-dev qemu-user-static binfmt-support rsync git flex bison bc kmod cpio libncurses5-dev libelf-dev:native libssl-dev dwarves
0bffa1b0 113
bc45a4cc 114build_linux
6859a054
TG
115build_m1n1
116build_uboot
117build_rootfs
6859a054
TG
118build_efi
119build_asahi_installer_image
120build_live_stick
f77f8aca 121publish_artefacts
Impressum, Datenschutz