# Maintainer: Jeka # Manjaro credits: # Bernhard Landauer # Philip Müller # Arch credits: # Tobias Powalowski # Thomas Baechler # # Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include) pkgbase=linux-jcore pkgname=('linux-jcore' 'linux-jcore-headers') _kernelname=-jcore _hostname=jcore pkgver=6.4.2 pkgrel=1 pkgdesc="Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include)" arch=('x86_64') url="https://www.kernel.org/" license=('GPL2') makedepends=(bc docbook-xsl libelf pahole python-sphinx git inetutils kmod xmlto cpio perl tar xz) replaces=('linux-acs-manjaro' 'linux-acs-manjaro-headers') options=('!strip') source=("https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$pkgver.tar.xz" 'config' # Upstream Patches # ARCH Patches '0101-ZEN_Add_sysctl_and_CONFIG_to_disallow_unprivileged_CLONE_NEWUSER.patch' '0102-netfilter-nf_tables-unbind_non-anonymous.patch' '0103-mm-disable_CONFIG_PER_VMA_LOCK.patch' # MANJARO Patches '0201-ACPI-resource-Remove-Zen-specific-match-and-quirks.patch' '0202-amd-drm-fixes-6.4-2023-06-23.patch' '0203-asus-ally-asus-hid-6.3-v2.patch' '0203-Revert-drm-amd-display-edp-do-not-add-non-edid-timings.patch' '0204-mt7921e_Perform_FLR_to_recovery_the_device.patch' '0205-ALSA-hda-realtek-add-quirks-asus-ally-cs35l41.patch' '0206-asus-ally-bluetooth.patch' # HDR patches might create issues for now #'0207-AMD-HDR.patch' # ACS override patch '0999-acs.gitpatch') sha256sums=('a326ab224176c5b17c73c9ccad85f32e49b6e4e764861d57595727b7ef10062c' 'ec421d71481ff9b0db343c4a3992be50fc6439b2f5042bbb1069dd3c1e46a48c' '05f04019d4a2ee072238c32860fa80d673687d84d78ef436ae9332b6fb788467' '10dc7300ee9e0918bab033a50f48264fe1f90d92f621412bd3de32b714f447e8' '7e79a1cc688189c66837611aa42ecf65a4f2fb071920830e9f4db923a13e9105' '4273ddbb98140783d47107b521bd18545416df4730c088677ea0b8f8927399af' '256d27c7c317421e74fa0f20623bf96f4c9ced2e3d1e4079e06520f726359b77' 'a38b50b8c73332d3d16950bf8adcae7ead34391a60f74d05a58935cd3dc8a12d' 'd17937d69876020c91a43a743cf6de550cffbf1978d40e4fb40bf54a96706719' 'd673d034fbcd80426fd8d9c6af56537c5fe5b55fe49d74e313474d7fc285ecc1' 'dafc7378178ff8f61386b922e705062569723cc72bb2fdd825d3ecaebf68a605' 'd5f95fe43882fb68c0a7e1ce8d831788e222f841de3e636e85a89ea655fed40e' '458d7e024d33d4965b14b9b987f01a2884ff28761cff5da7c6a54132a95e9f36') prepare() { cd "linux-${pkgver}" local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" [[ $src = *.patch ]] || continue msg2 "Applying patch: $src..." patch -Np1 < "../$src" done msg2 "apply 0999 acs override patch" patch --ignore-whitespace --fuzz 3 -p1 < "../0999-acs.gitpatch" cat "../config" > ./.config if [ "${_kernelname}" != "" ]; then sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config fi if [ "${_hostname}" != "" ]; then sed -i "s|CONFIG_DEFAULT_HOSTNAME=.*|CONFIG_DEFAULT_HOSTNAME=\"${_hostname}\"|g" ./.config fi msg "set extraversion to pkgrel" sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile msg "don't run depmod on 'make install'" # We'll do this ourselves in packaging sed -i '2iexit 0' scripts/depmod.sh msg "get kernel version" make prepare msg "rewrite configuration" yes "" | make config >/dev/null } build() { cd "linux-${pkgver}" msg "build" make ${MAKEFLAGS} LOCALVERSION= bzImage modules } package_linux-jcore() { pkgdesc="Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include)" depends=('coreutils' 'linux-firmware' 'kmod' 'initramfs') optdepends=('dkms: Dynamic Kernel Module System' 'wireless-regdb: to set the correct wireless channels of your country') provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE) cd "linux-${pkgver}" # get kernel version _kernver="$(make LOCALVERSION= kernelrelease)" mkdir -p "${pkgdir}"/{boot,usr/lib/modules} make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" INSTALL_MOD_STRIP=1 modules_install # systemd expects to find the kernel here to allow hibernation # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344 cp arch/x86/boot/bzImage "${pkgdir}/usr/lib/modules/${_kernver}/vmlinuz" # Used by mkinitcpio to name the kernel echo "${pkgbase}" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_kernver}/pkgbase" # add kernel version echo "${pkgver}-${pkgrel}${_kernelname} x64" > "${pkgdir}/boot/${pkgbase}-${CARCH}.kver" # remove build and source links rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build} # now we call depmod... depmod -b "${pkgdir}/usr" -F System.map "${_kernver}" } package_linux-jcore-headers() { pkgdesc="Headers and scripts for building modules for the Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include)" depends=('gawk' 'python' 'libelf' 'pahole') cd "linux-${pkgver}" local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build" install -Dt "${_builddir}" -m644 Makefile .config Module.symvers install -Dt "${_builddir}/kernel" -m644 kernel/Makefile install -Dt "${_builddir}" -m644 vmlinux mkdir "${_builddir}/.tmp_versions" cp -t "${_builddir}" -a include scripts install -Dt "${_builddir}/arch/x86" -m644 "arch/x86/Makefile" install -Dt "${_builddir}/arch/x86/kernel" -m644 "arch/x86/kernel/asm-offsets.s" cp -t "${_builddir}/arch/x86" -a "arch/x86/include" install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h # https://bugs.archlinux.org/task/13146 install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h # https://bugs.archlinux.org/task/20402 install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h # https://bugs.archlinux.org/task/71392 install -Dt "${_builddir}/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h # add xfs and shmem for aufs building mkdir -p "${_builddir}"/{fs/xfs,mm} # copy in Kconfig files find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \; # add objtool for external module building and enabled VALIDATION_STACK option install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool # required when DEBUG_INFO_BTF_MODULES is enabled install -Dt "${_builddir}/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids # remove unneeded architectures local _arch for _arch in "${_builddir}"/arch/*/; do [[ ${_arch} == */x86/ ]] && continue rm -r "${_arch}" done # remove documentation files rm -r "${_builddir}/Documentation" # strip scripts directory local file while read -rd '' file; do case "$(file -bi "$file")" in application/x-sharedlib\;*) # Libraries (.so) strip $STRIP_SHARED "$file" ;; application/x-archive\;*) # Libraries (.a) strip $STRIP_STATIC "$file" ;; application/x-executable\;*) # Binaries strip $STRIP_BINARIES "$file" ;; application/x-pie-executable\;*) # Relocatable binaries strip $STRIP_SHARED "$file" ;; esac done < <(find "${_builddir}" -type f -perm -u+x ! -name vmlinux -print0 2>/dev/null) strip $STRIP_STATIC "${_builddir}/vmlinux" # remove unwanted files find ${_builddir} -name '*.orig' -delete }