]>
cvs.zerfleddert.de Git - m1-debian/blob - bootstrap.sh
1ff99c876389e16b4468022d0e781795e18c1976
3 # SPDX-License-Identifier: MIT
15 export DEBOOTSTRAP
=debootstrap
21 if [ "`uname -m`" != 'aarch64' ]; then
23 export CROSS_COMPILE=aarch64-linux-gnu-
24 export DEBOOTSTRAP=qemu-debootstrap
25 sudo apt install -y libc6-dev-arm64-cross
33 test -d linux || git clone https://github.com/AsahiLinux/linux
36 git reset --hard asahi-6.1-rc8-3; git clean -f -x -d &> /dev/null
37 cat ../../config-16k.txt > .config
39 make -j `nproc` V=0 bindeb-pkg > /dev/null
46 test -d m1n1 || git clone --recursive https://github.com/AsahiLinux/m1n1
49 # https://github.com/AsahiLinux/PKGBUILDs/blob/main/m1n1/PKGBUILD
50 git reset --hard v1.2.3; git clean -f -x -d &> /dev/null
59 test -d u-boot || git clone https://github.com/AsahiLinux/u-boot
62 # For tag, see https://github.com/AsahiLinux/PKGBUILDs/blob/main/uboot-asahi/PKGBUILD
63 git reset --hard asahi-v2022.10-1; git clean -f -x -d &> /dev/null
64 git revert --no-edit 4d2b02faf69eaddd0f73758ab26c456071bd2017
66 make apple_m1_defconfig
70 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
71 cat m1n1/build/m1n1.macho `find linux/arch/arm64/boot/dts/apple/ -name \*.dtb` <(gzip -c u-boot/u-boot-nodtb.bin) > u-boot.macho
74 echo 'display=2560x1440' >> 2k.bin
75 echo 'display=wait,3840x2160' >> 4k.bin
79 >>>>>>> 0469ea3ee783f57bd1b368502d3286d96064e6e1
86 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
88 export KERNEL=`ls -1rt linux-image*.deb | grep -v dbg | tail -1`
92 sudo mkdir -p boot/efi
94 sudo bash -c 'echo debian > etc/hostname'
96 sudo bash -c 'echo > etc/motd'
98 sudo cp ../../files/sources.list etc/apt/sources.list
99 sudo cp ../../files/hosts etc/hosts
100 sudo cp ../../files/resolv.conf etc/resolv.conf
101 sudo cp ../../files/quickstart.txt root/
102 sudo cp ../../files/interfaces etc/network/interfaces
103 sudo cp ../../files/wpa.conf etc/wpa_supplicant/wpa_supplicant.conf
104 sudo cp ../../files/rc.local etc/rc.local
106 sudo bash -c 'chroot . apt update'
107 sudo bash -c 'chroot . apt install -y firmware-linux'
109 sudo -- perl -p -i -e 's/root:x:/root::/' etc/passwd
111 sudo -- ln -s lib/systemd/systemd init
113 sudo cp ../${KERNEL} .
114 sudo chroot . dpkg -i ${KERNEL}
117 sudo bash -c 'chroot . apt-get clean'
125 mkdir -p live-stick/efi/boot live-stick/efi/debian/
126 sudo cp ../files/wifi.pl testing/etc/rc.local
127 sudo bash -c 'cd testing; find . | cpio --quiet -H newc -o | pigz -9 > ../live-stick/initrd.gz'
128 cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi live-stick/efi/boot/bootaa64.efi
129 cp testing/boot/vmlinuz* live-stick/vmlinuz
130 cp ../files/grub.cfg live-stick/efi/debian/grub.cfg
131 (cd live-stick; tar cf ../asahi-debian-live.tar .)
139 mkdir -p EFI/boot EFI/debian
140 cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi EFI/boot/bootaa64.efi
142 export INITRD=`ls -1 testing/boot/ | grep initrd`
143 export VMLINUZ=`ls -1 testing/boot/ | grep vmlinuz`
144 export UUID=`blkid -s UUID -o value media`
145 cat > EFI/debian/grub.cfg <<EOF
146 search.fs_uuid ${UUID} root
147 linux (\$root)/boot/${VMLINUZ} root=UUID=${UUID} rw
148 initrd (\$root)/boot/${INITRD}
155 build_asahi_installer_image()
159 mkdir -p aii/esp/m1n1
161 cp u-boot.bin aii/esp/m1n1/boot.bin
164 zip -r9 ../debian-base.zip esp media
170 export KERNEL=`ls -1rt linux-image*.deb | grep -v dbg | tail -1`
172 sudo cp efi.tgz asahi-debian-live.tar debian-base.zip /u/
178 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
185 build_asahi_installer_image