From 41d0386c9a9ede51577445c833af094e15109389 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Mon, 1 Apr 2024 12:30:55 +0200 Subject: [PATCH 1/2] sys-kernel/asahi-kernel: provide *.dtbs in source dir Using gentoo's /usr/src/linux symlink seems to be the best solution to pick up *.dtbs for `update-m1n1`. Signed-off-by: Janne Grunau --- ...1.ebuild => asahi-kernel-6.6.0_p16-r2.ebuild} | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) rename sys-kernel/asahi-kernel/{asahi-kernel-6.6.0_p16-r1.ebuild => asahi-kernel-6.6.0_p16-r2.ebuild} (86%) diff --git a/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r1.ebuild b/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild similarity index 86% rename from sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r1.ebuild rename to sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild index d3deb071..5e7a2dde 100644 --- a/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r1.ebuild +++ b/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild @@ -98,6 +98,22 @@ src_prepare() { kernel-build_merge_configs "${merge_configs[@]}" } +src_install() { + # call kernel-build's scr_install + kernel-build_src_install + + # symlink installed *.dtbs back into kernel "source" directory + local dir_ver=${PV}${KV_LOCALVERSION} + local kernel_dir=/usr/src/linux-${dir_ver} + local relfile=${ED}${kernel_dir}/include/config/kernel.release + local module_ver + module_ver=$(<"${relfile}") || die + + for dtb in /boot/dtbs/${module_ver}/apple/*.dtb; do + dosym ${dtb} /${kernel_dir}/arch/arm64/boot/dts/apple/$(basename ${dtb}) + done +} + # Override kernel-install_pkg_preinst() to avoid ${PV}-as-release check pkg_preinst() { true From ea9e0441670955dd778d3a21eeb7646b2a23815d Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Mon, 1 Apr 2024 13:36:18 +0200 Subject: [PATCH 2/2] sys-kernel/asahi-kernel: adjust version to satisfy eclass checks Skipping kernel-install_pkg_preinst is not an option with merged-usr since that function fixes dangling symlink in /lib/modules/$(uname -r). Signed-off-by: Janne Grunau --- .../asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild b/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild index 5e7a2dde..eeb8d436 100644 --- a/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild +++ b/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r2.ebuild @@ -73,8 +73,13 @@ src_prepare() { # prepare the default config cp "${DISTDIR}/kernel-aarch64-16k-fedora.config-${CONFIG_VER}" ".config" || die - # localversion.05-asahi already appends "-asahi" - local myversion="-${MY_TAG}-dist" + # ensure a consistant version across kernel and gentoo + # this passes the ${PV}-as-release check in kernel-install_pkg_preinst() + # override "-asahi" in localversion.05-asahi with "_pX" to override the + # kernel's base varsion to gentoo's ${PV} + echo "-p${MY_TAG}" > localversion.05-asahi + # use CONFIG_LOCALVERSION to provide "asahi" and "dist" annotations. + local myversion="-asahi-dist" echo "CONFIG_LOCALVERSION=\"${myversion}\"" > "${T}"/version.config || die local dist_conf_path="${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}" @@ -114,11 +119,6 @@ src_install() { done } -# Override kernel-install_pkg_preinst() to avoid ${PV}-as-release check -pkg_preinst() { - true -} - pkg_postinst() { einfo "For more information about Asahi Linux please visit ${HOMEPAGE}," einfo "or consult the Wiki at https://github.com/AsahiLinux/docs/wiki."