#Maintainer: archdevlab #Credits: Jan Alexander Steffens (heftig) #Credits: Andreas Radke #Credits: Luca Stefani ################################# Arch ################################ ARCH=x86 ################################# Grep GCC version ################################ _gccversion=$(gcc -dumpversion) ################################# CC/CXX/HOSTCC/HOSTCXX ################################ #Set kernel to build with LLVM/CLANG BUILD_FLAGS=(CC=clang CXX=clang++ HOSTCC=clang HOSTCXX=clang++ LD=ld.lld LLVM=1 LLVM_IAS=1) ################################################################################### pkgbase=linux-llvm pkgver=6.8.1 _pkgver=6.8.1 pkgrel=1 major=6.8 commit=abef9db380deca88617f7014b683667ef6fc81e4 arch=(x86_64) url='https://www.kernel.org/' license=(GPL-2.0-only) makedepends=( bc cpio gettext libelf pahole perl python tar xz kmod xmlto # htmldocs graphviz imagemagick python-sphinx python-yaml texlive-latexextra ) makedepends+=( bison flex zstd make patch gcc gcc-libs glibc binutils git # LLVM/CLANG build clang llvm llvm-libs lld clang python ) options=( !debug !strip ) archlinuxpath=https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/$commit source=(https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$_pkgver.tar.xz ${archlinuxpath}/config # Arch patches 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch 0003-arch-Kconfig-Default-to-maximum-amount-of-ASLR-bits.patch) export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" prepare(){ cd ${srcdir}/linux-$_pkgver local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" [[ $src = *.patch ]] || continue msg "Applying patch $src..." patch -Np1 < "../$src" done plain "" # Copy the config file first msg "Copy the config file first..." cp "${srcdir}"/config .config sleep 2s plain "" # # Remove gcc-plugin if gcc version = 13.0.0 # if [[ "$_gccversion" = "13.0.0" ]]; then # # msg "Remove GCC_PLUGINS" # scripts/config --disable CONFIG_HAVE_GCC_PLUGINS # scripts/config --disable CONFIG_GCC_PLUGINS # # sleep 2s # plain "" # fi # Set LTO with CLANG/LLVM msg "Enable THIN LTO" scripts/config --enable CONFIG_LTO scripts/config --enable CONFIG_LTO_CLANG scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN scripts/config --disable CONFIG_LTO_NONE scripts/config --enable CONFIG_HAS_LTO_CLANG scripts/config --disable CONFIG_LTO_CLANG_FULL scripts/config --enable CONFIG_LTO_CLANG_THIN scripts/config --enable CONFIG_HAVE_GCC_PLUGINS #msg "Enable FULL LTO" #scripts/config --enable CONFIG_LTO #scripts/config --enable CONFIG_LTO_CLANG #scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG #scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN #scripts/config --disable CONFIG_LTO_NONE #scripts/config --enable CONFIG_HAS_LTO_CLANG #scripts/config --enable CONFIG_LTO_CLANG_FULL #scripts/config --disable CONFIG_LTO_CLANG_THIN #scripts/config --enable CONFIG_HAVE_GCC_PLUGINS #msg "Disable LTO" #scripts/config --enable CONFIG_LTO_NONE # Supress depmod msg "Supress depmod..." sed -i '2iexit 0' scripts/depmod.sh sleep 2s plain "" # Setting localversion msg "Setting localversion..." # --save-scmversion as been removed in upstream # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/scripts/setlocalversion?h=v6.3-rc1&id=f6e09b07cc12a4d104bb19fe7566b0636f60c413 # scripts/setlocalversion --save-scmversion echo "-${pkgbase}" > localversion plain "" # Config msg "make olddefconfig..." make ARCH=${ARCH} ${BUILD_FLAGS[*]} olddefconfig plain "" make -s kernelrelease > version msg "Prepared $pkgbase version $(