summaryrefslogtreecommitdiffstats
path: root/packages/sys-kernel/kernel-cachyos/kernel-cachyos-7.2.9-r1.exheres-0
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sys-kernel/kernel-cachyos/kernel-cachyos-7.2.9-r1.exheres-0')
-rw-r--r--packages/sys-kernel/kernel-cachyos/kernel-cachyos-7.2.9-r1.exheres-0110
1 files changed, 110 insertions, 0 deletions
diff --git a/packages/sys-kernel/kernel-cachyos/kernel-cachyos-7.2.9-r1.exheres-0 b/packages/sys-kernel/kernel-cachyos/kernel-cachyos-7.2.9-r1.exheres-0
new file mode 100644
index 0000000..0fb85d0
--- /dev/null
+++ b/packages/sys-kernel/kernel-cachyos/kernel-cachyos-7.2.9-r1.exheres-0
@@ -0,0 +1,110 @@
+# Copyright 2026 Gurov <thuggerthugger1@duck.com>
+# Distributed under the terms of the GNU General Public License v2
+
+SUMMARY="Prebuilt CachyOS Linux kernel with matching module headers"
+HOMEPAGE="https://github.com/CachyOS/linux-cachyos"
+
+MY_RELEASE="${PV}-2"
+MY_KERNEL="linux-cachyos-${MY_RELEASE}-x86_64_v3.pkg.tar.zst"
+MY_HEADERS="linux-cachyos-headers-${MY_RELEASE}-x86_64_v3.pkg.tar.zst"
+KERNEL_RELEASE="${MY_RELEASE}-cachyos"
+DOWNLOADS="
+ https://mirror.cachyos.org/repo/x86_64_v3/cachyos-v3/${MY_KERNEL}
+ https://mirror.cachyos.org/repo/x86_64_v3/cachyos-v3/${MY_HEADERS}
+"
+
+LICENCES="GPL-2"
+SLOT="0"
+PLATFORMS="~amd64"
+RESTRICT="mirror strip test"
+
+DEPENDENCIES="
+ build:
+ app-arch/zstd
+
+ build+run:
+ sys-apps/kmod[zstd]
+
+ run:
+ app-arch/zstd
+ dev-lang/clang
+ dev-lang/llvm
+ dev-libs/openssl
+ dev-libs/xxHash
+ dev-util/dwarves
+ dev-util/elfutils
+ sys-apps/systemd
+ sys-boot/dracut
+ sys-devel/binutils
+ sys-devel/lld
+ sys-libs/zlib
+"
+
+WORK="${WORKBASE}"
+
+pkg_pretend() {
+ if exhost --is-native -q && [[ ${ROOT} == / ]]; then
+ local flags flag
+ flags=$(grep -m1 '^flags[[:space:]]*:' /proc/cpuinfo) || die "Cannot check CPU features"
+ for flag in avx avx2 bmi1 bmi2 f16c fma movbe sse4_1 sse4_2 popcnt abm; do
+ [[ " ${flags} " == *" ${flag} "* ]] || die "CachyOS x86-64-v3 kernel requires CPU feature ${flag}"
+ done
+ fi
+}
+
+src_unpack() {
+ local archive checksum expected
+ for archive in "${MY_KERNEL}" "${MY_HEADERS}"; do
+ case ${archive} in
+ "${MY_KERNEL}") expected=1cb3b27ee69d0ef743d8c30e5811e128376ecf23bc62536405f4e86ffedf1086 ;;
+ "${MY_HEADERS}") expected=ba982020097ef03b43ae5644e3ce6ec0942c468032f62d15b47d6be475b7d2af ;;
+ esac
+ checksum=$(sha256sum "${FETCHEDDIR}/${archive}") || die "Cannot checksum ${archive}"
+ [[ ${checksum%% *} == ${expected} ]] || die "CachyOS archive changed: ${archive}"
+ done
+
+ edo mkdir -p "${WORK}/binary" "${WORK}/headers"
+ edo tar --zstd -xf "${FETCHEDDIR}/${MY_KERNEL}" -C "${WORK}/binary"
+ edo tar --zstd -xf "${FETCHEDDIR}/${MY_HEADERS}" -C "${WORK}/headers"
+}
+
+src_compile() {
+ :
+}
+
+src_install() {
+ local modules="/usr/$(exhost --target)/lib/modules/${KERNEL_RELEASE}"
+ local binary="${WORK}/binary/usr/lib/modules/${KERNEL_RELEASE}"
+ local headers="${WORK}/headers/usr/lib/modules/${KERNEL_RELEASE}"
+
+ [[ -f ${binary}/vmlinuz && -d ${binary}/kernel && -f ${headers}/build/.config &&
+ -f ${headers}/build/Module.symvers && -f ${headers}/build/System.map &&
+ -d ${headers}/vdso ]] || die "CachyOS kernel or matching headers are missing"
+
+ dodir "${modules}"
+ edo cp -a "${binary}/." "${IMAGE}${modules}/"
+ edo cp -a "${headers}/." "${IMAGE}${modules}/"
+ edo depmod -b "${IMAGE}" -m "/usr/$(exhost --target)/lib/modules" -a "${KERNEL_RELEASE}"
+}
+
+pkg_postinst() {
+ local image="/usr/lib/modules/${KERNEL_RELEASE}/vmlinuz"
+ local retry="kernel-install add ${KERNEL_RELEASE} ${image}"
+
+ if [[ ${ROOT} != / ]] || ! exhost --is-native -q; then
+ elog "Boot setup skipped for non-native or alternate-root installation."
+ elog "On the target system, run: ${retry}"
+ elif ! mountpoint -q /boot || ! command -v kernel-install >/dev/null ||
+ ! command -v dracut >/dev/null; then
+ ewarn "Boot setup skipped: /boot must be mounted and kernel-install and dracut available."
+ ewarn "After fixing boot setup, run: ${retry}"
+ elif ! kernel-install add "${KERNEL_RELEASE}" "${image}"; then
+ ewarn "Boot entry or initramfs creation failed; check output above."
+ ewarn "After fixing boot setup, run: ${retry}"
+ else
+ elog "CachyOS boot entry and initramfs installed via kernel-install."
+ fi
+
+ ewarn "With Secure Boot enabled, kernel-install does not guarantee a trusted kernel signature."
+ ewarn "Verify signing and boot entry before booting CachyOS; keep your working kernel as fallback."
+}