]>
Commit | Line | Data |
---|---|---|
aae6cdc3 | 1 | #!/usr/bin/env bash |
2df410ee | 2 | |
605f3b2d TG |
3 | # SPDX-License-Identifier: MIT |
4 | ||
aae6cdc3 TG |
5 | set -o errexit |
6 | set -o nounset | |
7 | set -o pipefail | |
8 | set -o xtrace | |
9 | ||
10 | cd "$(dirname "$0")" | |
2df410ee TG |
11 | |
12 | unset LC_CTYPE | |
13 | unset LANG | |
14 | ||
0bffa1b0 TG |
15 | export DEBOOTSTRAP=debootstrap |
16 | ||
f325b48f | 17 | build_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 | 24 | |
08045305 TG |
25 | export KERNEL=`ls -1rt linux-image*.deb | grep -v dbg | tail -1` |
26 | ||
ce8ebd75 TG |
27 | cd testing |
28 | ||
a6fc4794 | 29 | sudo mkdir -p boot/efi |
60b2ebc1 | 30 | |
16cad30f | 31 | sudo bash -c 'echo debian > etc/hostname' |
f325b48f | 32 | |
350079f4 | 33 | sudo bash -c 'echo > etc/motd' |
ce8ebd75 | 34 | |
08045305 TG |
35 | sudo cp ../../files/sources.list etc/apt/sources.list |
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 | |
08045305 TG |
50 | sudo cp ../${KERNEL} . |
51 | sudo chroot . dpkg -i ${KERNEL} | |
52 | sudo rm ${KERNEL} | |
ce8ebd75 | 53 | |
60cb512a | 54 | sudo bash -c 'chroot . apt-get clean' |
ce8ebd75 TG |
55 | ) |
56 | } | |
5920ad39 | 57 | |
bca3e283 | 58 | build_live_stick() |
f325b48f TG |
59 | { |
60 | ( | |
bca3e283 TG |
61 | rm -rf live-stick |
62 | mkdir -p live-stick/efi/boot live-stick/efi/debian/ | |
f493aec2 TG |
63 | sudo cp ../files/wifi.pl testing/etc/rc.local |
64 | sudo bash -c 'cd testing; find . | cpio --quiet -H newc -o | pigz -9 > ../live-stick/initrd.gz' | |
bca3e283 TG |
65 | cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi live-stick/efi/boot/bootaa64.efi |
66 | cp testing/boot/vmlinuz* live-stick/vmlinuz | |
67 | cp ../files/grub.cfg live-stick/efi/debian/grub.cfg | |
7a54df2e | 68 | (cd live-stick; tar cf ../asahi-debian-live.tar .) |
f325b48f TG |
69 | ) |
70 | } | |
5920ad39 | 71 | |
0ffed154 TG |
72 | build_efi() |
73 | { | |
74 | ( | |
7da211a3 | 75 | rm -rf EFI |
60b2ebc1 | 76 | mkdir -p EFI/boot EFI/debian |
0ffed154 TG |
77 | cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi EFI/boot/bootaa64.efi |
78 | ||
79 | export INITRD=`ls -1 testing/boot/ | grep initrd` | |
80 | export VMLINUZ=`ls -1 testing/boot/ | grep vmlinuz` | |
eb57d280 | 81 | export UUID=`blkid -s UUID -o value media` |
60b2ebc1 | 82 | cat > EFI/debian/grub.cfg <<EOF |
0ffed154 | 83 | search.fs_uuid ${UUID} root |
60b2ebc1 TG |
84 | linux (\$root)/boot/${VMLINUZ} root=UUID=${UUID} rw |
85 | initrd (\$root)/boot/${INITRD} | |
0ffed154 TG |
86 | boot |
87 | EOF | |
88 | tar czf efi.tgz EFI | |
89 | ) | |
90 | } | |
91 | ||
5d41b6d6 TG |
92 | build_asahi_installer_image() |
93 | { | |
304bd206 TG |
94 | ( |
95 | rm -rf aii | |
1cf0f22b | 96 | mkdir -p aii/esp/m1n1 |
304bd206 | 97 | cp -a EFI aii/esp/ |
1cf0f22b | 98 | cp u-boot.bin aii/esp/m1n1/boot.bin |
304bd206 TG |
99 | ln media aii/media |
100 | cd aii | |
1cf0f22b | 101 | zip -r9 ../debian-base.zip esp media |
304bd206 | 102 | ) |
5d41b6d6 TG |
103 | } |
104 | ||
3b4d866f | 105 | publish_artefacts() |
bb14d862 TG |
106 | { |
107 | export KERNEL=`ls -1rt linux-image*.deb | grep -v dbg | tail -1` | |
108 | cp ${KERNEL} k.deb | |
59b40e06 | 109 | sudo cp efi.tgz asahi-debian-live.tar debian-base.zip /u/ |
bb14d862 TG |
110 | } |
111 | ||
08045305 TG |
112 | mkdir -p build |
113 | cd build | |
114 | ||
56d14923 | 115 | sudo 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 | 116 | |
bc45a4cc | 117 | build_linux |
6859a054 TG |
118 | build_m1n1 |
119 | build_uboot | |
120 | build_rootfs | |
6859a054 TG |
121 | build_efi |
122 | build_asahi_installer_image | |
123 | build_live_stick | |
f77f8aca | 124 | publish_artefacts |