# $Id$ # Maintainer (Arch): Tobias Powalowski # Maintainer (Arch): Thomas Baechler # Maintainer: David P. # Contributor: Bruno Cichoń # Contributor: André Silva # Contributor: Márcio Silva # Contributor: fauno # Contributor: Sorin-Mihai Vârgolici # Contributor: Michał Masłowski # Contributor: Luke Shumaker # Contributor: Luke R. # Contributor: Andreas Grapentin # parabola changes and rationale (based on community/linux): # - changed upstream source to use linux-libre # - consolidated x86_64 and i686 - armv7h has linux-libre-armv7 # - rebranded to parabola pkgbase=linux-libre # Build stock -PARABOLA kernel #pkgbase=linux-libre-custom # Build kernel with a different name _srcname=linux-4.15 pkgver=4.15.2_gnu pkgrel=1 arch=('x86_64' 'i686') url="https://linux-libre.fsfla.org/" license=('GPL2') makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf') options=('!strip') source=( https://linux-libre.fsfla.org/pub/linux-libre/releases/${_srcname#*-}-gnu/linux-libre-${_srcname#*-}-gnu.tar.xz{,.sign} https://linux-libre.fsfla.org/pub/linux-libre/releases/${pkgver//_/-}/patch-${_srcname#*-}-gnu-${pkgver//_/-}.xz{,.sign} config.i686 config.x86_64 # the main kernel config files 60-linux.hook # pacman hook for depmod 90-linux.hook # pacman hook for initramfs regeneration linux.preset # standard config files for mkinitcpio ramdisk 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch 0002-drm-i915-edp-Only-use-the-alternate-fixed-mode-if-it.patch 0003-ssb-Do-not-disable-PCI-host-on-non-Mips.patch https://repo.parabola.nu/other/linux-libre/logos/logo_linux_clut224.ppm{,.sig} https://repo.parabola.nu/other/linux-libre/logos/logo_linux_mono.pbm{,.sig} https://repo.parabola.nu/other/linux-libre/logos/logo_linux_vga16.ppm{,.sig} ) validpgpkeys=( '474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva '6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78' # David P. ) sha512sums=('a55cc663c6fb1e1cfa7905282b368b5d5888bc2398f0acf37e5bb9a232ded04fd566b1980e654da26aaec005332e458581495184d6bd4cec669181085d4d78a5' 'SKIP' 'a6be4f8b1b8fb42f65a19e543746d6073d777f681d523b0d60e00e3d6f8e67e51a15709f2d79d66bd634a1184d53b1887e9c7c08af96876916111cd206f807e7' 'SKIP' '51f109f7fefe3fce27e4f3a9bd76c84477ad4d9c7cc11b803c05c9c42e4938612afcf204152b7c1cb2113857c065e59a726b63303f731e4f1d20f935186d2951' 'da8c74d7189fee1cbb974ba4b197295ec6bb8693a5c9b2b99cbf9b61c84a00681433cee00e3388100e2595492e44630318a37a2648b7c58cc527f8d8ea5d0fd9' '7ad5be75ee422dda3b80edd2eb614d8a9181e2c8228cd68b3881e2fb95953bf2dea6cbe7900ce1013c9de89b2802574b7b24869fc5d7a95d3cc3112c4d27063a' '4a8b324aee4cccf3a512ad04ce1a272d14e5b05c8de90feb82075f55ea3845948d817e1b0c6f298f5816834ddd3e5ce0a0e2619866289f3c1ab8fd2f35f04f44' '2dc6b0ba8f7dbf19d2446c5c5f1823587de89f4e28e9595937dd51a87755099656f2acec50e3e2546ea633ad1bfd1c722e0c2b91eef1d609103d8abdc0a7cbaf' 'b436cab8166c03a5988d63a921dcac490510707f936d91f1ee0456cac9d7b5ee90c5d24bdb404f9e8f56d3822af494d3b7598f012a72dc65c3e8371f7710bc28' '55a75798d9b4c649d39e13cf9e518d1b02bafe0a5021371f1825d2f18e2e2b4693f532532c40e2078f6b0a3dcb2455bc8a0578ee29f57c596d08b9a08e3cba73' 'e20a14eae49cb9f4a0f2abca056f954a6ce4a05a09f6dc5fa52ad5d7792b72e51aeec854d262a65652418f38610a5ccc73f59e2a46b7357a3c22bbf8ceb2aa9d' '13cb5bc42542e7b8bb104d5f68253f6609e463b6799800418af33eb0272cc269aaa36163c3e6f0aacbdaaa1d05e2827a4a7c4a08a029238439ed08b89c564bb3' 'SKIP' '267295aa0cea65684968420c68b32f1a66a22d018b9d2b2c1ef14267bcf4cb68aaf7099d073cbfefe6c25c8608bdcbbd45f7ac8893fdcecbf1e621abdfe9ecc1' 'SKIP' '7a3716bfe3b9f546da309c7492f3e08f8f506813afeb1c737a474c83313d5c313cf4582b65215c2cfce3b74d9d1021c96e8badafe8f6e5b01fe28d2b5c61ae78' 'SKIP') _kernelname=${pkgbase#linux-libre} prepare() { cd ${_srcname} # add freedo as boot logo install -m644 -t drivers/video/logo \ "${srcdir}/logo_linux_"{clut224.ppm,vga16.ppm,mono.pbm} # add upstream patch patch -p1 -i ../patch-${_srcname#*-}-gnu-${pkgver//_/-} # add latest fixes from stable queue, if needed # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git # disable USER_NS for non-root users by default patch -Np1 -i ../0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch # https://bugs.archlinux.org/task/56711 patch -Np1 -i ../0002-drm-i915-edp-Only-use-the-alternate-fixed-mode-if-it.patch # https://bugs.archlinux.org/task/57327 patch -Np1 -i ../0003-ssb-Do-not-disable-PCI-host-on-non-Mips.patch cat ../config.${CARCH} - >.config </dev/null } build() { cd ${_srcname} make ${MAKEFLAGS} LOCALVERSION= bzImage modules } _package() { pkgdesc="The ${pkgbase/linux/Linux} kernel and modules" [ "${pkgbase}" = "linux-libre" ] && groups=('base' 'base-openrc') depends=('coreutils' 'linux-libre-firmware' 'kmod' 'mkinitcpio>=0.7') optdepends=('crda: to set the correct wireless channels of your country') provides=("linux$_kernelname") conflicts=("linux$_kernelname") replaces=("linux$_kernelname") backup=("etc/mkinitcpio.d/${pkgbase}.preset") install=linux.install cd ${_srcname} # get kernel version _kernver="$(make LOCALVERSION= kernelrelease)" _basekernel=${_kernver%%-*} _basekernel=${_basekernel%.*} mkdir -p "${pkgdir}"/{boot,usr/lib/modules} make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" modules_install cp arch/x86/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" # make room for external modules local _extramodules="extramodules-${_basekernel}${_kernelname}" ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules" # add real version for building modules and running depmod from hook echo "${_kernver}" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version" # 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}" # add vmlinux install -Dt "${pkgdir}/usr/lib/modules/${_kernver}/build" -m644 vmlinux # sed expression for following substitutions local _subst=" s|%PKGBASE%|${pkgbase}|g s|%KERNVER%|${_kernver}|g s|%EXTRAMODULES%|${_extramodules}|g " # hack to allow specifying an initially nonexisting install file sed "${_subst}" "${startdir}/${install}" > "${startdir}/${install}.pkg" true && install=${install}.pkg # install mkinitcpio preset file sed "${_subst}" ../linux.preset | install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" # install pacman hooks sed "${_subst}" ../60-linux.hook | install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook" sed "${_subst}" ../90-linux.hook | install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook" } _package-headers() { pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel" provides=("linux-headers") conflicts=("linux-headers") replaces=("linux-headers") cd ${_srcname} local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build" install -Dt "${_builddir}" -m644 Makefile .config Module.symvers install -Dt "${_builddir}/kernel" -m644 kernel/Makefile mkdir "${_builddir}/.tmp_versions" cp -t "${_builddir}" -a include scripts install -Dt "${_builddir}/arch/x86" -m644 arch/x86/Makefile [[ "$CARCH" == i686 ]] && install -t "${_builddir}/arch/x86" -m644 arch/x86/Makefile_32.cpu 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 # http://bugs.archlinux.org/task/9912 install -Dt "${_builddir}/drivers/media/dvb-core" -m644 drivers/media/dvb-core/*.h # http://bugs.archlinux.org/task/13146 install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h # http://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 # 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 [[ "$CARCH" == x86_64 ]] && install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool # remove unneeded architectures local _arch for _arch in "${_builddir}"/arch/*/; do [[ ${_arch} == */x86/ ]] && continue rm -r "${_arch}" done # remove files already in linux-docs package rm -r "${_builddir}/Documentation" # remove now broken symlinks find -L "${_builddir}" -type l -printf 'Removing %P\n' -delete # Fix permissions chmod -R u=rwX,go=rX "${_builddir}" # strip scripts directory local _binary _strip while read -rd '' _binary; do case "$(file -bi "${_binary}")" in *application/x-sharedlib*) _strip="${STRIP_SHARED}" ;; # Libraries (.so) *application/x-archive*) _strip="${STRIP_STATIC}" ;; # Libraries (.a) *application/x-executable*) _strip="${STRIP_BINARIES}" ;; # Binaries *) continue ;; esac /usr/bin/strip ${_strip} "${_binary}" done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null) } _package-docs() { pkgdesc="Kernel hackers manual - HTML documentation that comes with the ${pkgbase/linux/Linux} kernel" provides=("linux-docs") conflcts=("linux-docs") replaces=("linux-docs") cd ${_srcname} local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build" mkdir -p "${_builddir}" cp -t "${_builddir}" -a Documentation # Fix permissions chmod -R u=rwX,go=rX "${_builddir}" } pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs") for _p in ${pkgname[@]}; do eval "package_${_p}() { $(declare -f "_package${_p#${pkgbase}}") _package${_p#${pkgbase}} }" done # vim:set ts=8 sts=2 sw=2 et: