From 96b06a2bb263ce29053ed81e5947c62007ea55e5 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Fri, 29 Mar 2024 22:33:50 +0100 Subject: [PATCH] sys-kernel/asahi-kernel: Use gentoo-kernel's base config Use gentoo-kernel as template for asahi-kernel. This sets expected flags like CONFIG_IKCONFIG_PROC (for /proc/config.gz) and allows disabling debug CONFIGs via the debug useflag. In addition deselect all non apple arm64 ARCHs for a faster build and select simpledrm as preferred boot framebuffer driver. Merge time on a M1 Max is reduced from 22 1/2 minutes to 16 1/2 minutes. Signed-off-by: Janne Grunau --- sys-kernel/asahi-kernel/Manifest | 3 +- ...build => asahi-kernel-6.6.0_p16-r1.ebuild} | 46 ++++++++++++++++--- .../linux-6.6_arch_apple_overrides.config | 10 ++++ ...x-6.6_arm64_deselect_non_apple_arch.config | 42 +++++++++++++++++ 4 files changed, 94 insertions(+), 7 deletions(-) rename sys-kernel/asahi-kernel/{asahi-kernel-6.6.0_p16.ebuild => asahi-kernel-6.6.0_p16-r1.ebuild} (56%) create mode 100644 sys-kernel/asahi-kernel/files/linux-6.6_arch_apple_overrides.config create mode 100644 sys-kernel/asahi-kernel/files/linux-6.6_arm64_deselect_non_apple_arch.config diff --git a/sys-kernel/asahi-kernel/Manifest b/sys-kernel/asahi-kernel/Manifest index 84d986d4..8aa0735d 100644 --- a/sys-kernel/asahi-kernel/Manifest +++ b/sys-kernel/asahi-kernel/Manifest @@ -1,2 +1,3 @@ DIST asahi-kernel-6.6.0_p16.tar.gz 229861406 BLAKE2B e8f90373fe3cfb0ee8824158c59d548af05d1e68626715a65dcf086b35cfe7f4d44b184f02bbfad33474040b86f488e4fa99c8886ae329cf138933161658f94c SHA512 fc62cf346b95229aa31bc1483c9fcffaeacf94d09d13801a3e8e50ed3ba7f3d1b1d4dd8083051879955e1f99bffa61bf411cd38fcc45e176d372fc1d205b9c76 -DIST kernel-aarch64-16k-fedora.config-6.6.0_p16 272164 BLAKE2B 27de91eb46c467015d18eac1fe3c96c71112caae73c9818ee4a5c476f57732e7a7b1fd18feaf008e61d1fc775e1b1cb32b32c0fdda3b3ebfeb8e6f7e79a34e6d SHA512 e4196f46f92e5c8d0e681d42fe6392ac2a150530a71e189d7abeff877c76a0a86c4619d794f181ea784f12ad0a1d1f6d639bbcd4209396436b03b5baa4d6998b +DIST gentoo-kernel-config-g11.tar.gz 5077 BLAKE2B dc17ded74f79baddd703a78084113b85e7130877b300b5fe60453cde515fe37c52ece7877049bb0ef384f74ecfc73d59d7d4a513f8fef7bf4f651599946383e8 SHA512 e91156765ef2a48396370f884fdecd7bb1d600e5167f6bad51130520f886e9198adae375adf3e40fa803abc5d5482057775fb0275ab2589bd8f94d8af4a03c4e +DIST kernel-aarch64-16k-fedora.config-6.6.3-414-gentoo 272164 BLAKE2B 27de91eb46c467015d18eac1fe3c96c71112caae73c9818ee4a5c476f57732e7a7b1fd18feaf008e61d1fc775e1b1cb32b32c0fdda3b3ebfeb8e6f7e79a34e6d SHA512 e4196f46f92e5c8d0e681d42fe6392ac2a150530a71e189d7abeff877c76a0a86c4619d794f181ea784f12ad0a1d1f6d639bbcd4209396436b03b5baa4d6998b diff --git a/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16.ebuild b/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r1.ebuild similarity index 56% rename from sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16.ebuild rename to sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r1.ebuild index 415246d0..de2863e7 100644 --- a/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16.ebuild +++ b/sys-kernel/asahi-kernel/asahi-kernel-6.6.0_p16-r1.ebuild @@ -19,12 +19,17 @@ else MY_TAG="$(ver_cut 5)" MY_P="asahi-$(ver_cut 1-2)-${MY_TAG}" fi +CONFIG_VER=6.6.3-414-gentoo +GENTOO_CONFIG_VER=g11 DESCRIPTION="Asahi Linux kernel sources" HOMEPAGE="https://asahilinux.org" KERNEL_URI="https://github.com/AsahiLinux/linux/archive/refs/tags/${MY_P}.tar.gz -> ${PN}-${PV}.tar.gz" SRC_URI="${KERNEL_URI} - https://copr-dist-git.fedorainfracloud.org/cgit/@asahi/kernel/kernel.git/plain/kernel-aarch64-16k-fedora.config?id=be420b20d9a73b16a6ee7b6cdb34194efd89bb91 -> kernel-aarch64-16k-fedora.config-${PV} + https://github.com/projg2/gentoo-kernel-config/archive/${GENTOO_CONFIG_VER}.tar.gz + -> gentoo-kernel-config-${GENTOO_CONFIG_VER}.tar.gz + https://copr-dist-git.fedorainfracloud.org/cgit/@asahi/kernel/kernel.git/plain/kernel-aarch64-16k-fedora.config?id=be420b20d9a73b16a6ee7b6cdb34194efd89bb91 + -> kernel-aarch64-16k-fedora.config-${CONFIG_VER} " S="${WORKDIR}/linux-${MY_P}" @@ -41,13 +46,19 @@ DEPEND=" >=dev-lang/rust-bin-1.72.0[rust-src,rustfmt] ) dev-util/bindgen - dev-util/pahole + debug? ( dev-util/pahole ) " PDEPEND=" =virtual/dist-kernel-${PV} " +QA_FLAGS_IGNORED=" + usr/src/linux-.*/scripts/gcc-plugins/.*.so + usr/src/linux-.*/vmlinux + usr/src/linux-.*/arch/powerpc/kernel/vdso.*/vdso.*.so.dbg +" + PATCHES=( "${FILESDIR}/${P}-enable-speakers-stage1.patch" "${FILESDIR}/${P}-enable-speakers-stage2.patch" @@ -56,10 +67,33 @@ PATCHES=( src_prepare() { default - echo "-${MY_TAG}-dist" > localversion.10-pkgrel || die - cp "${DISTDIR}/kernel-aarch64-16k-fedora.config-${PV}" ".config" || die - echo 'CONFIG_LOCALVERSION=""' > "${T}/fakeversion.config" - kernel-build_merge_configs "${T}/fakeversion.config" + + # 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" + echo "CONFIG_LOCALVERSION=\"${myversion}\"" > "${T}"/version.config || die + local dist_conf_path="${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}" + + local merge_configs=( + "${T}"/version.config + "${dist_conf_path}"/base.config + ) + use debug || merge_configs+=( + "${dist_conf_path}"/no-debug.config + ) + + # deselect all non APPLE arm64 ARCHs + merge_configs+=( + "${FILESDIR}"/linux-$(ver_cut 1-2)_arm64_deselect_non_apple_arch.config + ) + # adjust base config for Apple silicon systems + merge_configs+=( + "${FILESDIR}"/linux-$(ver_cut 1-2)_arch_apple_overrides.config + ) + + kernel-build_merge_configs "${merge_configs[@]}" } # Override kernel-install_pkg_preinst() to avoid ${PV}-as-release check diff --git a/sys-kernel/asahi-kernel/files/linux-6.6_arch_apple_overrides.config b/sys-kernel/asahi-kernel/files/linux-6.6_arch_apple_overrides.config new file mode 100644 index 00000000..b16c25de --- /dev/null +++ b/sys-kernel/asahi-kernel/files/linux-6.6_arch_apple_overrides.config @@ -0,0 +1,10 @@ +## prefer simpledrm over frame buffer drivers +CONFIG_DRM_SIMPLEDRM=y +# CONFIG_FB_EFI is not set +# CONFIG_FB_VESA is not set + +## enable EFI_ZBOOT for systemd-boot support +CONFIG_EFI_ZBOOT=y + +## no ACPI on Apple silicon systems +# CONFIG_ACPI_EXTLOG is not set diff --git a/sys-kernel/asahi-kernel/files/linux-6.6_arm64_deselect_non_apple_arch.config b/sys-kernel/asahi-kernel/files/linux-6.6_arm64_deselect_non_apple_arch.config new file mode 100644 index 00000000..a291452d --- /dev/null +++ b/sys-kernel/asahi-kernel/files/linux-6.6_arm64_deselect_non_apple_arch.config @@ -0,0 +1,42 @@ +# CONFIG_ARCH_ACTIONS is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_ALPINE is not set +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BCM2835 is not set +# CONFIG_ARCH_BCM_IPROC is not set +# CONFIG_ARCH_BCMBCA is not set +# CONFIG_ARCH_BRCMSTB is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_BITMAIN is not set +# CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SPARX5 is not set +# CONFIG_ARCH_K3 is not set +# CONFIG_ARCH_LG1K is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEEMBAY is not set +# CONFIG_ARCH_MEDIATEK is not set +# CONFIG_ARCH_MESON is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_NXP is not set +# CONFIG_ARCH_LAYERSCAPE is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_S32 is not set +# CONFIG_ARCH_MA35 is not set +# CONFIG_ARCH_NPCM is not set +# CONFIG_ARCH_QCOM is not set +# CONFIG_ARCH_REALTEK is not set +# CONFIG_ARCH_RENESAS is not set +# CONFIG_ARCH_ROCKCHIP is not set +# CONFIG_ARCH_SEATTLE is not set +# CONFIG_ARCH_INTEL_SOCFPGA is not set +# CONFIG_ARCH_STM32 is not set +# CONFIG_ARCH_SYNQUACER is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_SPRD is not set +# CONFIG_ARCH_THUNDER is not set +# CONFIG_ARCH_THUNDER2 is not set +# CONFIG_ARCH_UNIPHIER is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_VISCONTI is not set +# CONFIG_ARCH_XGENE is not set +# CONFIG_ARCH_ZYNQMP is not set