]> git.zerfleddert.de Git - m1-debian/blame - bootstrap.sh
make m1n1 package compatible with new way to package things
[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
a6fc4794 27 sudo mkdir -p boot/efi
60b2ebc1 28
16cad30f 29 sudo bash -c 'echo debian > etc/hostname'
f325b48f 30
350079f4 31 sudo bash -c 'echo > etc/motd'
ce8ebd75 32
08045305
TG
33 sudo cp ../../files/sources.list etc/apt/sources.list
34 sudo cp ../../files/hosts etc/hosts
8d82f6b0 35 sudo cp ../../files/resolv.conf etc/resolv.conf
08045305 36 sudo cp ../../files/quickstart.txt root/
da7dd4b8 37 sudo cp ../../files/interfaces etc/network/interfaces
7a54df2e 38 sudo cp ../../files/wpa.conf etc/wpa_supplicant/wpa_supplicant.conf
b96f460f 39 sudo cp ../../files/rc.local etc/rc.local
ce8ebd75 40
f325b48f 41 sudo bash -c 'chroot . apt update'
0bffa1b0 42 sudo bash -c 'chroot . apt install -y firmware-linux'
ce8ebd75
TG
43
44 sudo -- perl -p -i -e 's/root:x:/root::/' etc/passwd
45
f325b48f 46 sudo -- ln -s lib/systemd/systemd init
ce8ebd75 47
08045305
TG
48 sudo cp ../${KERNEL} .
49 sudo chroot . dpkg -i ${KERNEL}
50 sudo rm ${KERNEL}
ce8ebd75 51
60cb512a 52 sudo bash -c 'chroot . apt-get clean'
ce8ebd75
TG
53)
54}
5920ad39 55
bca3e283 56build_live_stick()
f325b48f
TG
57{
58(
bca3e283
TG
59 rm -rf live-stick
60 mkdir -p live-stick/efi/boot live-stick/efi/debian/
f493aec2
TG
61 sudo cp ../files/wifi.pl testing/etc/rc.local
62 sudo bash -c 'cd testing; find . | cpio --quiet -H newc -o | pigz -9 > ../live-stick/initrd.gz'
bca3e283
TG
63 cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi live-stick/efi/boot/bootaa64.efi
64 cp testing/boot/vmlinuz* live-stick/vmlinuz
65 cp ../files/grub.cfg live-stick/efi/debian/grub.cfg
7a54df2e 66 (cd live-stick; tar cf ../asahi-debian-live.tar .)
f325b48f
TG
67)
68}
5920ad39 69
0ffed154
TG
70build_efi()
71{
72(
7da211a3 73 rm -rf EFI
60b2ebc1 74 mkdir -p EFI/boot EFI/debian
0ffed154
TG
75 cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi EFI/boot/bootaa64.efi
76
77 export INITRD=`ls -1 testing/boot/ | grep initrd`
78 export VMLINUZ=`ls -1 testing/boot/ | grep vmlinuz`
eb57d280 79 export UUID=`blkid -s UUID -o value media`
60b2ebc1 80 cat > EFI/debian/grub.cfg <<EOF
0ffed154 81search.fs_uuid ${UUID} root
60b2ebc1
TG
82linux (\$root)/boot/${VMLINUZ} root=UUID=${UUID} rw
83initrd (\$root)/boot/${INITRD}
0ffed154
TG
84boot
85EOF
86 tar czf efi.tgz EFI
87)
88}
89
5d41b6d6
TG
90build_asahi_installer_image()
91{
304bd206
TG
92(
93 rm -rf aii
1cf0f22b 94 mkdir -p aii/esp/m1n1
304bd206 95 cp -a EFI aii/esp/
1cf0f22b 96 cp u-boot.bin aii/esp/m1n1/boot.bin
304bd206
TG
97 ln media aii/media
98 cd aii
1cf0f22b 99 zip -r9 ../debian-base.zip esp media
304bd206 100)
5d41b6d6
TG
101}
102
3b4d866f 103publish_artefacts()
bb14d862 104{
59b40e06 105 sudo cp efi.tgz asahi-debian-live.tar debian-base.zip /u/
bb14d862
TG
106}
107
08045305
TG
108mkdir -p build
109cd build
110
56d14923 111sudo 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 112
bc45a4cc 113build_linux
6859a054
TG
114build_m1n1
115build_uboot
116build_rootfs
6859a054
TG
117build_efi
118build_asahi_installer_image
119build_live_stick
f77f8aca 120publish_artefacts
Impressum, Datenschutz