From c97238864e52d243139f173ed3e3e15778809b79 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 08:53:07 +0100 Subject: [PATCH 01/16] more todo --- TODO | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..8f8e419 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +Put net.ifnames=0 as default +Check if /boot/esp is mounted otherwise bail on error, for bootstrap check for the file '/debootstrap' -- 2.39.5 From cae69632ed89f09bea8319fa2afcc7d28dcfb4d1 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 08:53:22 +0100 Subject: [PATCH 02/16] rename gpu script --- gpu.sh => m1n1_uboot_kernel.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gpu.sh => m1n1_uboot_kernel.sh (100%) diff --git a/gpu.sh b/m1n1_uboot_kernel.sh similarity index 100% rename from gpu.sh rename to m1n1_uboot_kernel.sh -- 2.39.5 From e82b43b26cdf08c2e221c0f6a6196174211f0311 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 08:55:00 +0100 Subject: [PATCH 03/16] more todo --- TODO | 6 ++++-- config-gpu.txt => config.txt | 0 m1n1_uboot_kernel.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) rename config-gpu.txt => config.txt (100%) diff --git a/TODO b/TODO index 8f8e419..22240e7 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,4 @@ -Put net.ifnames=0 as default -Check if /boot/esp is mounted otherwise bail on error, for bootstrap check for the file '/debootstrap' +[ ] Put net.ifnames=0 as default +[ ] Check if /boot/esp is mounted otherwise bail on error, for bootstrap check for the file '/debootstrap' +[ ] Re-enable crosscompilation for m1n1_uboot_kernel.sh +[ ] Script the bootstrapping of rust necessary for the kernel diff --git a/config-gpu.txt b/config.txt similarity index 100% rename from config-gpu.txt rename to config.txt diff --git a/m1n1_uboot_kernel.sh b/m1n1_uboot_kernel.sh index 65ad628..c26d613 100644 --- a/m1n1_uboot_kernel.sh +++ b/m1n1_uboot_kernel.sh @@ -20,7 +20,7 @@ build_linux() git fetch -a -t git reset --hard asahi-6.1-rc8-3; source "$HOME/.cargo/env" - cat ../../config-gpu.txt > .config + cat ../../config.txt > .config make LLVM=-15 olddefconfig make -j `nproc` LLVM=-15 V=0 bindeb-pkg > /dev/null ) -- 2.39.5 From 8895ecacda91c69b91929eb047c2db3ee470e90e Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 11:37:17 +0100 Subject: [PATCH 04/16] use classic interface names --- TODO | 1 - bootstrap.sh | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 22240e7..268ef2b 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -[ ] Put net.ifnames=0 as default [ ] Check if /boot/esp is mounted otherwise bail on error, for bootstrap check for the file '/debootstrap' [ ] Re-enable crosscompilation for m1n1_uboot_kernel.sh [ ] Script the bootstrapping of rust necessary for the kernel diff --git a/bootstrap.sh b/bootstrap.sh index f3511a8..fc8c366 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -41,6 +41,8 @@ build_rootfs() sudo cp ../../files/30-modeset.conf etc/X11/xorg.conf.d/30-modeset.conf sudo cp ../../files/blacklist.conf etc/modprobe.d/ + sudo perl -p -i -e 's/"quiet"/"net.ifnames=0"/ if /^GRUB_CMDLINE_LINUX_DEFAULT=/' etc/default/grub + sudo bash -c 'chroot . apt update' sudo bash -c 'chroot . apt install -y firmware-linux' -- 2.39.5 From 3b47cec1388bc6b00e1be4d466bb25194723e6ef Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 13:18:43 +0100 Subject: [PATCH 05/16] reenable hfsplus as requested by Nich Chan --- config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.txt b/config.txt index 2df0657..56816d7 100644 --- a/config.txt +++ b/config.txt @@ -5623,7 +5623,7 @@ CONFIG_MISC_FILESYSTEMS=y # CONFIG_AFFS_FS is not set # CONFIG_ECRYPT_FS is not set # CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set +CONFIG_HFSPLUS_FS=m # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set -- 2.39.5 From 9eed8ca6a00effd07552e7db600a9ce656674534 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 14:40:34 +0100 Subject: [PATCH 06/16] add script to prepare rust --- m1n1_uboot_kernel.sh | 6 +++++- prepare_rust.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 prepare_rust.sh diff --git a/m1n1_uboot_kernel.sh b/m1n1_uboot_kernel.sh index c26d613..2346db3 100644 --- a/m1n1_uboot_kernel.sh +++ b/m1n1_uboot_kernel.sh @@ -9,6 +9,10 @@ set -o xtrace cd "$(dirname "$0")" +export CARGO_HOME="$(pwd)/build/cargo" +export RUSTUP_HOME="$(pwd)/build/rust" +source "$(pwd)/build/cargo/env" + unset LC_CTYPE unset LANG @@ -19,8 +23,8 @@ build_linux() cd linux git fetch -a -t git reset --hard asahi-6.1-rc8-3; - source "$HOME/.cargo/env" cat ../../config.txt > .config + make LLVM=-15 rustavailable make LLVM=-15 olddefconfig make -j `nproc` LLVM=-15 V=0 bindeb-pkg > /dev/null ) diff --git a/prepare_rust.sh b/prepare_rust.sh new file mode 100644 index 0000000..0cd2be0 --- /dev/null +++ b/prepare_rust.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +cd "$(dirname "$0")" + +unset LC_CTYPE +unset LANG + +main() { + mkdir -p "$(pwd)/build" + export CARGO_HOME="$(pwd)/build/cargo" + export RUSTUP_HOME="$(pwd)/build/rust" + rm -rf ${CARGO_HOME} ${RUSTUP_HOME} + curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain none + source "$(pwd)/build/cargo/env" + rustup override set 1.62.0 + rustup component add rust-src + cargo install --locked --version 0.56.0 bindgen + rustup component add rustfmt + rustup component add clippy +} + +main "$@" + -- 2.39.5 From 7bcf66982275fe4b0820afd3ba9dec05d23ee3c7 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 14:40:47 +0100 Subject: [PATCH 07/16] more done --- TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/TODO b/TODO index 268ef2b..acba863 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,2 @@ [ ] Check if /boot/esp is mounted otherwise bail on error, for bootstrap check for the file '/debootstrap' [ ] Re-enable crosscompilation for m1n1_uboot_kernel.sh -[ ] Script the bootstrapping of rust necessary for the kernel -- 2.39.5 From 02881133eb2d1536ca7a8ade8eccebd79a5056c9 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 15:04:19 +0100 Subject: [PATCH 08/16] build binary packages only --- mesa.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesa.sh b/mesa.sh index 94df419..96b97fb 100644 --- a/mesa.sh +++ b/mesa.sh @@ -25,7 +25,7 @@ main() { cp -a ../../mesa-debian debian EMAIL=thomas@glanzmann.de dch -v 23.0.0-`date +%Y%m%d%H%M` 'asahi wip' sudo apt-get build-dep . - dpkg-buildpackage -uc -us -a arm64 + dpkg-buildpackage -uc -us -a arm64 --build=binary } main "$@" -- 2.39.5 From 8fca5a78d5ac869a5c3bd6531f744edc1fe0751d Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 18:07:59 +0100 Subject: [PATCH 09/16] update instructions --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 13ee08b..d871a1f 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,15 @@ problematic if you're using multiple ESP partitions for example when having multiple Linux and BSD installations. # Artefacts -If you don't want to use the prebuild artefacts, you can build them yourself using the [bootstrap.sh](https://git.zerfleddert.de/cgi-bin/gitweb.cgi/m1-debian/blob_plain/refs/heads/master:/bootstrap.sh) script. - -# Kernel header files -The kernel header files can be found here: +If you don't want to use the prebuild artefacts, you can build them yourself +using the following scripts: + + - prepare_rust.sh - Prepares a rust installation suitable for kernel compilation + - m1n1_uboot_kernel.sh - Builds m1n1, u-boot and the kernel including gpu support. + - mesa.sh - Creates mesa packages + - bootstrap.sh - Creates Debian root and live filesystem + - libunwind.sh - Builds libunwind that does not crash on 16kb pages + - meta.sh - Meta packages which makes sure that we always get latest and gratest kernel. # Asahi installer -- 2.39.5 From 2028fd4e73ee504f54c557ca2cfa86ce3355e274 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 18:09:09 +0100 Subject: [PATCH 10/16] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d871a1f..3fd6719 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ using the following scripts: - mesa.sh - Creates mesa packages - bootstrap.sh - Creates Debian root and live filesystem - libunwind.sh - Builds libunwind that does not crash on 16kb pages - - meta.sh - Meta packages which makes sure that we always get latest and gratest kernel. + - meta.sh - Meta package which makes sure that we always get latest and gratest kernel. # Asahi installer -- 2.39.5 From e6f0833d90f5d6f11c8af184432210fe5c2efa93 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 18:11:10 +0100 Subject: [PATCH 11/16] here we go --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3fd6719..1f69224 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ using the following scripts: * Configure wifi by editing the wpa_supplicant.conf, enabling the interface and remove the # before allow-hotplug to enable it during boot. vi /etc/wpa_supplicant/wpa_supplicant.conf - ifup wlp1s0f0 + ifup wlan0 vi /etc/network/interfaces * Reboot to see if grub was correctly installed @@ -121,7 +121,7 @@ Than open a terminal, and run the following commands: # FAQ -* If I install Debian, will it still be relatively easy to update the Asahi work as it develops? +* If I install Debian, will it be easy to update the Asahi work as it develops? Yes, long answer below. -- 2.39.5 From 4af35f19c2a4b2866fc37990126ee07522f87d62 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Mon, 12 Dec 2022 20:54:33 +0100 Subject: [PATCH 12/16] remove another obsulute function --- bootstrap.sh | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index fc8c366..bbaf4bf 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -87,26 +87,6 @@ build_dd() ) } -build_efi() -{ -( - rm -rf EFI - mkdir -p EFI/boot EFI/debian - cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi EFI/boot/bootaa64.efi - - export INITRD=`ls -1 testing/boot/ | grep initrd` - export VMLINUZ=`ls -1 testing/boot/ | grep vmlinuz` - export UUID=`blkid -s UUID -o value media` - cat > EFI/debian/grub.cfg < Date: Mon, 12 Dec 2022 21:00:43 +0100 Subject: [PATCH 13/16] use zstd instead of gz for live stick --- bootstrap.sh | 4 ++-- files/grub.cfg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index bbaf4bf..0aa75cb 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -63,7 +63,7 @@ build_live_stick() rm -rf live-stick mkdir -p live-stick/efi/boot live-stick/efi/debian/ sudo cp ../files/wifi.pl testing/etc/rc.local - sudo bash -c 'cd testing; find . | cpio --quiet -H newc -o | pigz -9 > ../live-stick/initrd.gz' + sudo bash -c 'cd testing; find . | cpio --quiet -H newc -o | zstd -T0 -16 > ../live-stick/initrd.zstd' cp testing/usr/lib/grub/arm64-efi/monolithic/grubaa64.efi live-stick/efi/boot/bootaa64.efi cp testing/boot/vmlinuz* live-stick/vmlinuz cp ../files/grub.cfg live-stick/efi/debian/grub.cfg @@ -108,7 +108,7 @@ publish_artefacts() mkdir -p build cd build -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 +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 zstd build_rootfs build_dd diff --git a/files/grub.cfg b/files/grub.cfg index 23b29fe..1a5b6db 100644 --- a/files/grub.cfg +++ b/files/grub.cfg @@ -1,5 +1,5 @@ echo Loading Kernel... linux (hd0,msdos1)/vmlinuz net.ifnames=0 echo Loading initrd... Please wait -initrd (hd0,msdos1)/initrd.gz +initrd (hd0,msdos1)/initrd.zstd boot -- 2.39.5 From adbfa071c62840f2caeabef92ebd09291b3db8d0 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Tue, 13 Dec 2022 13:35:49 +0100 Subject: [PATCH 14/16] +CONFIG_SQUASHFS_XZ=y as requested by Leo Soares --- config.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.txt b/config.txt index 56816d7..12fdf03 100644 --- a/config.txt +++ b/config.txt @@ -5638,8 +5638,8 @@ CONFIG_SQUASHFS_DECOMP_SINGLE=y CONFIG_SQUASHFS_ZLIB=y # CONFIG_SQUASHFS_LZ4 is not set # CONFIG_SQUASHFS_LZO is not set -# CONFIG_SQUASHFS_XZ is not set -# CONFIG_SQUASHFS_ZSTD is not set +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y # CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set # CONFIG_SQUASHFS_EMBEDDED is not set CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -- 2.39.5 From a4466acebce43c368d762fcb0ed029309a260300 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Tue, 13 Dec 2022 16:10:45 +0100 Subject: [PATCH 15/16] work on make patch kernel config work on config-6.0.0-5-arm64 --- config.txt | 2 +- m1n1_uboot_kernel.sh | 8 ++++---- patch_kernel_config.pl | 35 ++++++++++++++++++++--------------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/config.txt b/config.txt index 12fdf03..5aaf616 100644 --- a/config.txt +++ b/config.txt @@ -182,7 +182,7 @@ CONFIG_PROC_PID_CPUSET=y CONFIG_CGROUP_DEVICE=y CONFIG_CGROUP_CPUACCT=y CONFIG_CGROUP_PERF=y -# CONFIG_CGROUP_BPF is not set +CONFIG_CGROUP_BPF=y CONFIG_CGROUP_MISC=y CONFIG_SOCK_CGROUP_DATA=y CONFIG_NAMESPACES=y diff --git a/m1n1_uboot_kernel.sh b/m1n1_uboot_kernel.sh index 2346db3..ce99944 100644 --- a/m1n1_uboot_kernel.sh +++ b/m1n1_uboot_kernel.sh @@ -23,7 +23,7 @@ build_linux() cd linux git fetch -a -t git reset --hard asahi-6.1-rc8-3; - cat ../../config.txt > .config + cat ../../newconfig.txt > .config make LLVM=-15 rustavailable make LLVM=-15 olddefconfig make -j `nproc` LLVM=-15 V=0 bindeb-pkg > /dev/null @@ -93,6 +93,6 @@ mkdir -p build cd build build_linux -build_m1n1 -build_uboot -package_boot_bin +# build_m1n1 +# build_uboot +# package_boot_bin diff --git a/patch_kernel_config.pl b/patch_kernel_config.pl index 617cfc3..97c9cb8 100644 --- a/patch_kernel_config.pl +++ b/patch_kernel_config.pl @@ -3,10 +3,10 @@ use strict; use warnings FATAL => 'all'; -# This was taken from the linux-image-5.16.0-3-arm64-unsigned -# Than it was copied as .config in the asahi tree -# Than make olddefconfig was executed twice -my @lines = `cat .config`; +my $inputfile = $ARGV[0]; +my $outputfile = $ARGV[1]; + +my @lines = `cat $inputfile`; chomp @lines; my %asahi_options = ( @@ -37,7 +37,7 @@ my %asahi_options = ( 'CONFIG_HID_MAGICMOUSE' => 'y', 'CONFIG_I2C_APPLE' => 'y', 'CONFIG_MFD_APPLE_SPMI_PMU' => 'y', - 'CONFIG_MMC_SDHCI_PCI' => 'y', + 'CONFIG_MMC_SDHCI_PCI' => 'm', 'CONFIG_NLMON' => 'm', 'CONFIG_NVMEM_SPMI_MFD' => 'y', 'CONFIG_NVME_APPLE' => 'y', @@ -45,21 +45,20 @@ my %asahi_options = ( 'CONFIG_PINCTRL_APPLE_GPIO' => 'y', 'CONFIG_POWER_RESET_MACSMC' => 'y', 'CONFIG_RTC_DRV_MACSMC' => 'y', - 'CONFIG_SND_SIMPLE_CARD' => 'y', - 'CONFIG_SND_SOC_APPLE_MCA' => 'y', - 'CONFIG_SND_SOC_APPLE_SILICON' => 'y', - 'CONFIG_SND_SOC_CS42L42' => 'y', + 'CONFIG_SND_SIMPLE_CARD' => 'm', + 'CONFIG_SND_SOC_APPLE_MCA' => 'm', + 'CONFIG_SND_SOC_CS42L42' => 'm', 'CONFIG_SND_SOC_TAS2770' => 'm', 'CONFIG_SPI_APPLE' => 'y', 'CONFIG_SPI_HID_APPLE_CORE' => 'y', 'CONFIG_SPI_HID_APPLE_OF' => 'y', 'CONFIG_SPMI_APPLE' => 'y', - 'CONFIG_USB_DWC3' => 'y', - 'CONFIG_USB_DWC3_PCI' => 'y', + 'CONFIG_USB_DWC3' => 'm', + 'CONFIG_USB_DWC3_PCI' => 'm', 'CONFIG_FB_EFI' => 'y', 'CONFIG_BACKLIGHT_CLASS_DEVICE' => 'y', 'CONFIG_BACKLIGHT_GPIO' => 'm', - 'CONFIG_TYPEC_TPS6598X' => 'y', + 'CONFIG_TYPEC_TPS6598X' => 'm', 'CONFIG_BT_HCIBCM4377' => 'm', 'CONFIG_HID_DOCKCHANNEL' => 'm', 'CONFIG_APPLE_DOCKCHANNEL' => 'm', @@ -75,7 +74,12 @@ my %asahi_options = ( 'CONFIG_CONSTRUCTORS' => 'y', 'CONFIG_RUST' => 'y', 'CONFIG_PWM_APPLE' => 'm', - 'CONFIG_DRM_SIMPLEDRM_BACKLIGHT' => 'y', + 'CONFIG_DRM_SIMPLEDRM_BACKLIGHT' => 'n', + 'CONFIG_ARM64_4K_PAGES' => 'n', + 'CONFIG_ARM64_16K_PAGES' => 'y', + 'CONFIG_ANDROID_BINDER_IPC' => 'y', + 'CONFIG_MODVERSIONS' => 'n', + 'CONFIG_DEBUG_INFO_BTF' => 'n', ); my %debian_options; @@ -94,11 +98,12 @@ for my $o (keys %asahi_options) { print "$o present, removing\n"; delete $debian_options{$o}; } elsif ((exists $asahi_options{$o} && exists $debian_options{$o}) && ($debian_options{$o} ne $asahi_options{$o})) { - print "$o different\n"; + print "$o different, changing\n"; + $debian_options{$o} = $asahi_options{$o}; } } -open(CONFIG, '>', '.config') || die; +open(CONFIG, '>', $outputfile) || die; for (keys %debian_options) { print CONFIG $_ . '=' . $debian_options{$_} . "\n"; } -- 2.39.5 From 179b9ffd938957ef59c1bf07410cf4239bb8e80c Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Tue, 13 Dec 2022 16:21:37 +0100 Subject: [PATCH 16/16] add two missing rust options --- patch_kernel_config.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/patch_kernel_config.pl b/patch_kernel_config.pl index 97c9cb8..772b2b3 100644 --- a/patch_kernel_config.pl +++ b/patch_kernel_config.pl @@ -80,6 +80,8 @@ my %asahi_options = ( 'CONFIG_ANDROID_BINDER_IPC' => 'y', 'CONFIG_MODVERSIONS' => 'n', 'CONFIG_DEBUG_INFO_BTF' => 'n', + 'CONFIG_OF_DYNAMIC' => 'y', + 'CONFIG_OF_OVERLAY' => 'y', ); my %debian_options; -- 2.39.5