Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Based on the file created for Arch Linux by:
- # Tobias Powalowski <[email protected]>
- # Thomas Baechler <[email protected]>
- # Maintainer: Bernhard Landauer <[email protected]
- # Maintainer: Philip Müller <[email protected]>
- pkgbase=linux50-rt
- pkgname=("$pkgbase" "$pkgbase-headers")
- _basekernel=5.0
- _sub=3
- _rtpatchver=rt1
- _basever=${pkgbase//linux}
- _kernelname=-MANJARO
- _pkgver=${_basekernel}.${_sub}
- pkgver=${_pkgver}_${_rtpatchver}
- pkgrel=2
- arch=('x86_64')
- url="https://www.kernel.org/"
- license=('GPL2')
- makedepends=('bc'
- 'docbook-xsl'
- 'elfutils'
- 'git'
- 'inetutils'
- 'kmod'
- 'xmlto')
- options=('!strip')
- source=("$url/pub/linux/kernel/v5.x/linux-${_basekernel}.tar.xz"
- # upstream patch
- "$url/pub/linux/kernel/v5.x/patch-${_pkgver}.xz"
- # rt-config
- 'config.rt'
- "${pkgbase}.preset" # standard config files for mkinitcpio ramdisk
- '60-linux.hook' # pacman hook for depmod
- '90-linux.hook' # pacman hook for initramfs regeneration
- # ARCH Patches
- '0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch'
- # MANJARO Patches
- # Bootsplash
- '0001-bootsplash.patch'
- '0002-bootsplash.patch'
- '0003-bootsplash.patch'
- '0004-bootsplash.patch'
- '0005-bootsplash.patch'
- '0006-bootsplash.patch'
- '0007-bootsplash.patch'
- '0008-bootsplash.patch'
- '0009-bootsplash.patch'
- '0010-bootsplash.patch'
- '0011-bootsplash.patch'
- '0012-bootsplash.patch'
- '0013-bootsplash.patch'
- # RT Patch
- $url/pub/linux/kernel/projects/rt/${_basekernel}/older/patch-${_pkgver}-${_rtpatchver}.patch.xz
- #{,sign}
- # 'fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT-160319.patch'
- )
- sha256sums=('437b141a6499159f5a7282d5eb4b2be055f8e862ccce44d7464e8759c31a2e43'
- '802edfe24f3557bd8eeabe56c70721b2bf1e9d5c9d853a4fa78b0c1b08af56de'
- '95447df23b31fab77b537555f05b53992b9a976e9e09e0716b8650fd6f958e60'
- '0fb6d51e5d8cd1dc737104c2d1487a38ff7cb50b1f8cce74e1776caa2d51490b'
- 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
- '057ef44a8f5a7ef10efbc7d96bf72f651e87a0c1d063b07d922c74232e5e7941'
- '37b86ca3de148a34258e3176dbf41488d9dbd19e93adbd22a062b3c41332ce85'
- 'a504f6cf84094e08eaa3cc5b28440261797bf4f06f04993ee46a20628ff2b53c'
- 'e096b127a5208f56d368d2cb938933454d7200d70c86b763aa22c38e0ddb8717'
- '8c1c880f2caa9c7ae43281a35410203887ea8eae750fe8d360d0c8bf80fcc6e0'
- '1144d51e5eb980fceeec16004f3645ed04a60fac9e0c7cf88a15c5c1e7a4b89e'
- 'dd4b69def2efacf4a6c442202ad5cb93d492c03886d7c61de87696e5a83e2846'
- '028b07f0c954f70ca37237b62e04103e81f7c658bb8bd65d7d3c2ace301297dc'
- 'c8b0cb231659d33c3cfaed4b1f8d7c8305ab170bdd4c77fce85270d7b6a68000'
- '8dbb5ab3cb99e48d97d4e2f2e3df5d0de66f3721b4f7fd94a708089f53245c77'
- 'a7aefeacf22c600fafd9e040a985a913643095db7272c296b77a0a651c6a140a'
- 'e9f22cbb542591087d2d66dc6dc912b1434330ba3cd13d2df741d869a2c31e89'
- '27471eee564ca3149dd271b0817719b5565a9594dc4d884fe3dc51a5f03832bc'
- '60e295601e4fb33d9bf65f198c54c7eb07c0d1e91e2ad1e0dd6cd6e142cb266d'
- '035ea4b2a7621054f4560471f45336b981538a40172d8f17285910d4e0e0b3ef'
- '5d374c5fb282d3689b680ba07f457dd5b1455c645cf6e1c17f8fbb7028cd2110')
- validpgpkeys=('64254695FFF0AA4466CC19E67B96E8162A8CF5D1' # Sebastian Andrzej Siewior
- '4FE5E3262872E4CC')
- prepare() {
- cd "linux-${_basekernel}"
- # add upstream patch
- patch -p1 -i "../patch-${_pkgver}"
- # Add RT patch
- msg "realtime patch..."
- patch -p1 -i "../patch-${_pkgver}-${_rtpatchver}.patch"
- # fix X hanging on certain NVIDIA cards
- # msg "NVIDIA race in PRT patch..."
- # patch -p1 -i '../fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT-160319.patch'
- # disable USER_NS for non-root users by default
- patch -Np1 -i '../0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch'
- # Add bootsplash - http://lkml.iu.edu/hypermail/linux/kernel/1710.3/01542.html
- patch -Np1 -i "${srcdir}/0001-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0002-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0003-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0004-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0005-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0006-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0007-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0008-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0009-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0010-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0011-bootsplash.patch"
- patch -Np1 -i "${srcdir}/0012-bootsplash.patch"
- # add binary files
- git apply -p1 < "${srcdir}/0013-bootsplash.patch"
- cat '../config.rt' > ./.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
- # set extraversion to pkgrel
- sed -ri "s|^(EXTRAVERSION =).*|\1 |" Makefile
- # don't run depmod on 'make install'. We'll do this ourselves in packaging
- sed -i '2iexit 0' scripts/depmod.sh
- # get kernel version
- make prepare
- # rewrite configuration
- yes "" | make config >/dev/null
- }
- build() {
- cd "${srcdir}/linux-${_basekernel}"
- # build!
- make ${MAKEFLAGS} LOCALVERSION= bzImage modules
- }
- package_linux50-rt() {
- pkgdesc="The ${pkgbase/linux/Linux} kernel and modules"
- depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
- optdepends=('crda: to set the correct wireless channels of your country')
- provides=("linux=${pkgver}")
- backup=("etc/mkinitcpio.d/${pkgbase}.preset")
- install=${pkgname}.install
- cd "${srcdir}/linux-${_basekernel}"
- # get kernel version
- _kernver="$(make LOCALVERSION= kernelrelease)"
- mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
- make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
- cp arch/x86/boot/bzImage "${pkgdir}/boot/vmlinuz-${_basekernel}-rt-x86_64"
- # add kernel version
- echo "${_pkgver}-${_rtpatchver}-${pkgrel}-MANJARO x64" > "${pkgdir}/boot/linux-${_basever}-x86_64.kver"
- # make room for external modules
- local _extramodules="extramodules-${_basekernel}-rt${_kernelname:--MANJARO}"
- 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|%BASEKERNEL%|${_basekernel}|g
- s|%ARCH%|x86_64|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}" ${srcdir}/${pkgbase}.preset |
- install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
- # install pacman hooks
- sed "${_subst}" ${srcdir}/60-linux.hook |
- install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
- sed "${_subst}" ${srcdir}/90-linux.hook |
- install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
- }
- package_linux50-rt-headers() {
- pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel"
- provides=("linux-headers=$pkgver")
- cd "${srcdir}/linux-${_basekernel}"
- 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"
- 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/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
- 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"
- # 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)
- }
Advertisement
Add Comment
Please, Sign In to add comment