Skip to content

Instantly share code, notes, and snippets.

@jannau
Created April 26, 2023 19:41
Show Gist options
  • Save jannau/24089ca9dd93cdcbb712a95d5ef83803 to your computer and use it in GitHub Desktop.
Save jannau/24089ca9dd93cdcbb712a95d5ef83803 to your computer and use it in GitHub Desktop.
asahi dev kernel + modules + tethered boot
merge https://github.com/AsahiLinux/m1n1/pull/268 into m1n1
build kernel with `make dir-pkg` and create an initramfs containing the modules, for example
# make -j20 dir-pkg && \
# usr/gen_initramfs.sh -o initramfs_mod.cpio -u squash -g squash tar-install/lib/modules && \
# gzip -f --fast initramfs_mod.cpio
prepare initramfs for inintramfs module handling, for asahi linux initramfs
misses extract initramfs `lsinitcpio -x`, remove existing modules,
patch the asahi hook with hooks_asahi.diff and repackage the initramfs ()
copy the firmware.cpio from the ESP and compress it with gzip
boot kernel with modules and firmware with
cat ~/asahi/initramfs-modules.img.gz ~/asahi/firmware.cpio.gz ~/src/linux/initramfs_mod.cpio.gz > initramfs && \
.tools/run_guest_kernel.sh ~/src/linux/ "root=/dev/nvme0n1p10 rootflags=rw hostname=mbp14 loglevel=7" initramfs
--- a/hooks/asahi 2023-04-26 21:19:04.895639732 +0200
+++ b/hooks/asahi 2022-11-20 23:28:28.369632900 +0100
@@ -2,6 +2,8 @@
# SPDX-License-Identifier: MIT
run_earlyhook() {
+ ln -s /$(uname -r) /lib/modules/
+
if [ -e /vendorfw ]; then
msg ":: Asahi: Vendor firmware was loaded by the bootloader"
return 0
@@ -54,4 +56,11 @@
mkdir -p /new_root/lib/firmware/vendor
mount -t tmpfs vendorfw /new_root/lib/firmware/vendor
cp -r /vendorfw/* /vendorfw/.vendorfw.manifest /new_root/lib/firmware/vendor
+
+ if [ -d /$(uname -r) ]; then
+ if [ -e /new_root/lib/modules/$(uname -r) ]; then
+ rm -r /new_root/lib/modules/$(uname -r)
+ fi
+ cp -r /$(uname -r) /new_root/lib/modules/
+ fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment