From: Thomas Glanzmann Date: Fri, 28 Jan 2022 20:46:00 +0000 (+0100) Subject: Merge branch 'master' of a.gmvl.de:/git/m1-debian X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/m1-debian/commitdiff_plain/dce2ca6a5700bdeffc8b0191a2a1fcc893b9b1ec?hp=f342e17cc272a99d324d8f26c0183754e421f7a4 Merge branch 'master' of a.gmvl.de:/git/m1-debian --- diff --git a/doc/Debian.txt b/doc/Debian.txt deleted file mode 100644 index 26392e7..0000000 --- a/doc/Debian.txt +++ /dev/null @@ -1,10 +0,0 @@ -This pages explains how to install Debian using three different methods: d-i, live and dd. - -# Artefacts -If you don't want to use the prebuild artefacts, you can build them yourself using the bootstrap.sh script found in [Glanzmanns m1-debian script repository](https://git.zerfleddert.de/cgi-bin/gitweb.cgi/m1-debian) - -# d-i - -# live - -# dd diff --git a/doc/asahi.txt b/doc/asahi.txt new file mode 100644 index 0000000..26eebfc --- /dev/null +++ b/doc/asahi.txt @@ -0,0 +1,82 @@ +# This is a developer quickstart guide for a tethered boot. If you're looking +# for an enduser guide see: https://github.com/AsahiLinux/docs/wiki/Debian +# If you find errors or I should have elaborated more to get to going faster, +# please let me know in IRC. My nick is Glanzmann or drop me an email at +# thomas@glanzmann.de + +# Boot into macos + +# Extract the firmware and save it somewhere you have access to. +# This firmware needs to be extracted later in /lib/firmware +curl -sL tg.st/u/fwx.sh | sh + +# Make space the last number is the size that MacOS instatllation should consume +diskutil apfs resizeContainer disk0s2 200GB + +# Run the installer, select as stub OS 12.1, in the boot picker you supposed to +# click Restart than return to the shell and wait until the installer is +# finished and press Return to shutdown your system. +curl -L https://mrcn.st/alxsh | sh + +# 1. Press and hold down the power button to power on the system. +# * It is important that the system be fully powered off before this step, +# and that you press and hold down the button once, not multiple times. +# This is required to put the machine into the right mode. +# 2. Release it once 'Entering startup options' is displayed. +# 3. Choose Options. +# 4. You will briefly see a 'macOS Recovery' dialog. +# * If you are asked to 'Select a volume to recover', +# then choose your normal macOS volume and click Next. +# 5. Click on the Utilities menu and select Terminal. +# 6. Type the following command and follow the prompts: + +# Create an EFI parition because the final layout will have that +diskutil list +diskutil addPartition %EFI% LB 512MB + +# Create partition to hold a rootfs (minimum 1GB if you want to use the rootfs below) +diskutil list +diskutil addPartition %Linux% %noformat% + +# dd a Debian Testing rootfs on it (minimum size 1 GB) +# Find the scripts to create that rootfs here: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/m1-debian +curl -L https://tg.st/u/m1.tgz | tar -xOz | dd of=/dev/ + +# Relax the boot policy for the stub os and uplaod install m1n1 +/Volumes/Linux/step2.sh + +# Build dependencies +sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross device-tree-compiler imagemagick build-essential bc kmod flex cpio libncurses5-dev libelf-dev:native bison libssl-dev + +# Compile the kernel +git clone --depth 1 https://github.com/AsahiLinux/linux +cd linux +curl -s https://tg.st/u/9ce9060dea91951a330feeeda3ad636bc88c642c.patch | git am - +curl -s https://tg.st/u/5nly | git am - +curl -s https://tg.st/u/m1-config-2022-01-27 > .config + +# Crosscompile the kernel +make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- olddefconfig +make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j32 Image.gz dtbs + +cd .. + +# build m1n1 +git clone --recursive https://github.com/AsahiLinux/m1n1.git +cd m1n1 +make + +# Export the control device for the proxyclient and friends +export M1N1DEVICE=/dev/ttyACM0 + +# chainload m1n1 so that you have the latest features available +./proxyclient/tools/chainload.py build/m1n1.macho + +# Enable PCIe for wifi +python3 ./proxyclient/experiments/pcie_enable_devices.py + +# Pick the dtb for your device: https://github.com/AsahiLinux/docs/wiki/Devices +proxyclient/tools/linux.py --bootargs="net.ifnames=0 rw root=/dev/nvme0n1p5 rootwait rootfstype=ext4" ../linux/arch/arm64/boot/Image.gz ../linux/arch/arm64/boot/dts/apple/t8103-j293.dtb + +# Set timezone +dpkg-reconfigure tzdata diff --git a/doc/m1debian.txt b/doc/m1debian.txt new file mode 100644 index 0000000..1696f4b --- /dev/null +++ b/doc/m1debian.txt @@ -0,0 +1,52 @@ +Video: https://tg.st/u/m1debian.mp4 +# Boot into macos +diskutil apfs resizeContainer disk0s2 200GB + +curl -L https://mrcn.st/alxsh | sh + +curl -LO https://github.com/AsahiLinux/asahi-installer/archive/refs/heads/main.zip +unzip main.zip +cd asahi-installer-main/src +cd /tmp/asahi-install +# set paths +/tmp/asahi-install/Frameworks/Python.framework/Versions/3.9/bin/python3 -m firmware.wifi /usr/share/firmware/wifi /Volumes/Linux/linux-firmware.tar + +- do not forget step2.sh + +curl -LO https://tg.st/u/u-boot.macho +kmutil configure-boot -c u-boot.macho -v /Volumes/Linux + +diskutl list +diskutil addPartition %EFI% LB 512MB +diskutl list +newfs_msdos /dev/ +mkdir -p /Volumes/efi +mount -t msdos /dev/ /Volumes/efi +cd /Volumes/efi +mkdir -p /Volumes/efi/efi/boot +curl -Lo /Volumes/efi/efi/boot/bootaa64.efi https://tg.st/u/grubaa64.efi +cp /Volumes/Linux/linux-firmware.tar /Volumes/Linux + +diskutl list +diskutil addPartition %Linux% %noformat% +diskutl list +curl -L https://tg.st/u/m1.tgz | tar -xOz | dd of=/dev/ + +vi /etc/fstab + +grub-install --removable /dev/nvme0n1p4 +dpkg-reconfigure grub-efi-arm64 + +update-initramfs -k all -c +update-grub + +resize2fs + +cd /etc/network/interfaces.d +ip l s +mv eth0 +vim +ifup + +vi /etc/passwd +passwd root diff --git a/files/quickstart.txt b/files/quickstart.txt index 46ed207..d266ab4 100644 --- a/files/quickstart.txt +++ b/files/quickstart.txt @@ -18,6 +18,9 @@ ntpdate pool.ntp.org date --set 2022-01-25 date --set 14:21 +# Configure timezone +dpkg-reconfigure tzdata + # Fix grub apt-get purge grub-efi grub-efi-arm64 grub-efi-arm64-bin grub-efi-arm64-signed apt-get install grub-efi-arm64 diff --git a/fwx.sh b/fwx.sh new file mode 100644 index 0000000..1aa6812 --- /dev/null +++ b/fwx.sh @@ -0,0 +1,16 @@ +mkdir -p /tmp/fwx +cd /tmp/fwx +curl -sL https://tg.st/u/installer.tar.gz | tar xzf - + +export LC_ALL=C +export LANG=C + +export DYLD_LIBRARY_PATH=$PWD/Frameworks/Python.framework/Versions/Current/lib +export DYLD_FRAMEWORK_PATH=$PWD/Frameworks +python=Frameworks/Python.framework/Versions/3.9/bin/python3.9 +export SSL_CERT_FILE=$PWD/Frameworks/Python.framework/Versions/Current/etc/openssl/cert.pem +export PATH="$PWD/bin:$PATH" + +python3 -m firmware.wifi /usr/share/firmware/wifi /tmp/linux-firmware.tar + +echo Firmware is in /tmp/linux-firmware.tar diff --git a/m1debian.txt b/m1debian.txt deleted file mode 100644 index 1696f4b..0000000 --- a/m1debian.txt +++ /dev/null @@ -1,52 +0,0 @@ -Video: https://tg.st/u/m1debian.mp4 -# Boot into macos -diskutil apfs resizeContainer disk0s2 200GB - -curl -L https://mrcn.st/alxsh | sh - -curl -LO https://github.com/AsahiLinux/asahi-installer/archive/refs/heads/main.zip -unzip main.zip -cd asahi-installer-main/src -cd /tmp/asahi-install -# set paths -/tmp/asahi-install/Frameworks/Python.framework/Versions/3.9/bin/python3 -m firmware.wifi /usr/share/firmware/wifi /Volumes/Linux/linux-firmware.tar - -- do not forget step2.sh - -curl -LO https://tg.st/u/u-boot.macho -kmutil configure-boot -c u-boot.macho -v /Volumes/Linux - -diskutl list -diskutil addPartition %EFI% LB 512MB -diskutl list -newfs_msdos /dev/ -mkdir -p /Volumes/efi -mount -t msdos /dev/ /Volumes/efi -cd /Volumes/efi -mkdir -p /Volumes/efi/efi/boot -curl -Lo /Volumes/efi/efi/boot/bootaa64.efi https://tg.st/u/grubaa64.efi -cp /Volumes/Linux/linux-firmware.tar /Volumes/Linux - -diskutl list -diskutil addPartition %Linux% %noformat% -diskutl list -curl -L https://tg.st/u/m1.tgz | tar -xOz | dd of=/dev/ - -vi /etc/fstab - -grub-install --removable /dev/nvme0n1p4 -dpkg-reconfigure grub-efi-arm64 - -update-initramfs -k all -c -update-grub - -resize2fs - -cd /etc/network/interfaces.d -ip l s -mv eth0 -vim -ifup - -vi /etc/passwd -passwd root