123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- # Contributor: David P. <megver83@parabola.nu>
- # Contributor: André Silva <emulatorman@hyperbola.info>
- # Contributor: Márcio Silva <coadde@hyperbola.info>
- # Contributor: fauno <fauno@parabola.nu>
- # Contributor: Sorin-Mihai Vârgolici <smv@yobicore.org>
- # Contributor: Michał Masłowski <mtjm@mtjm.eu>
- # Contributor: Luke R. <g4jc@openmailbox.org>
- # Contributor: Andreas Grapentin <andreas@grapentin.org>
- # Maintainers: Parabola hackers <dev@lists.parabola.nu>
- # Based on linux package
- _replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix
- _replacesoldkernels=() # '%' gets replaced with kernel suffix
- _replacesoldmodules=() # '%' gets replaced with kernel suffix
- pkgbase=linux-next-tests
- pkgver=20220408
- pkgrel=1
- pkgdesc='Deblobbed linux-next for testing patches (for upstreaming work)'
- arch=(i686 x86_64 armv7h)
- license=(GPL2)
- makedepends=(
- bc libelf pahole cpio perl tar xz
- xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick texlive-latexextra
- )
- makedepends=( ${makedepends[*]/git/} )
- options=('!strip')
- _srcname=linux-next
- source=(
- "git+https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
- config.i686 config.x86_64 config.armv7h # the main kernel config files
- linux-armv7h.preset # armv7h preset file for mkinitcpio ramdisk
- )
- sha512sums=('SKIP'
- 'b1f013835dcf521dcadb58ed22f271f7f01b3b15403924bd0076eb9ef4e8aa31f98b1b99d47ae726f8e981b3da44f1c484ce14e2030e31a67ad7c8eea55848d9'
- '5a955a795f9f49d8617897300d3d03c431b1a6fa2bc9ed4106606617e4f16b28f94906498b13c24fd5c186c76a685e5f877013093184ae80435e7b86f52e8755'
- '47d16ffc94510d4a8773146a46cfb35aca8cfdae38d17283334cd62d92de36250fbec90e9892357033398ecc7d970127b1a41b703a8372972422ca4af7c90c70'
- '53103bf55b957b657039510527df0df01279dec59cda115a4d6454e4135025d4546167fa30bdc99107f232561c1e096d8328609ab5a876cf7017176f92ad3e0b')
- _replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}")
- _replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}")
- _replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}")
- case "$CARCH" in
- i686|x86_64) KARCH=x86;;
- armv7h) KARCH=arm;;
- esac
- export KBUILD_BUILD_HOST=parabola
- export KBUILD_BUILD_USER=$pkgbase
- export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
- pkgver() {
- cd $_srcname
- git describe --tags | sed 's/^next-//'
- }
- mksource() {
- cd $_srcname
- # Here we don't use linux-libre but we still remove the nonfree
- # software found in the Linux kernel. This avoids legal issues and
- # make sure we stay FSDG compliant.
- # We do it this way to stay as close as possible to the upstream
- # kernel.
- # The list of files to remove has been taken from debian/copyright in the
- # Debian kernel git repository[1].
- # [1] https://salsa.debian.org/kernel-team/linux.git
- rm -f \
- Documentation/netlabel/draft-ietf-cipso-ipsecurity-01.txt \
- arch/powerpc/platforms/8xx/micropatch.c \
- drivers/media/usb/dvb-usb/af9005-script.h \
- drivers/media/i2c/vs6624.c \
- drivers/net/appletalk/cops* \
- drivers/video/fbdev/nvidia \
- drivers/video/fbdev/riva
- }
- prepare() {
- cd $_srcname
- echo "Setting version..."
- scripts/setlocalversion --save-scmversion
- echo "-$pkgrel" > localversion.10-pkgrel
- echo "${pkgbase#linux-libre}" > localversion.20-pkgname
- echo "Setting config..."
- cp ../../config.$CARCH .config
- make olddefconfig
- make -s kernelrelease > version
- echo "Prepared $pkgbase version $(<version)"
- }
- build() {
- cd $_srcname
- make all
- make htmldocs
- }
- _package() {
- pkgdesc="The $pkgdesc kernel and modules"
- depends=(coreutils kmod initramfs)
- optdepends=('wireless-regdb: to set the correct wireless channels of your country'
- 'linux-libre-firmware: firmware images needed for some devices')
- provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
- replaces=(virtualbox-guest-modules-arch wireguard-arch)
- provides+=("${_replacesarchkernel[@]/%/=$pkgver}" "LINUX-ABI_VERSION=$pkgver")
- conflicts+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
- replaces+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
- cd $_srcname
- local kernver="$(<version)"
- local modulesdir="$pkgdir/usr/lib/modules/$kernver"
- echo "Installing boot image..."
- # systemd expects to find the kernel here to allow hibernation
- # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
- install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
- # Used by mkinitcpio to name the kernel
- echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
- echo "Installing modules..."
- make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
- DEPMOD=/doesnt/exist modules_install # Suppress depmod
- # remove build and source links
- rm "$modulesdir"/{source,build}
- if [ "$CARCH" = "armv7h" ]; then
- echo "Installing device tree binaries..."
- make INSTALL_DTBS_PATH="$pkgdir/boot/dtbs/$pkgbase" dtbs_install
- # armv7h presets only work with ALL_kver=$kernver
- backup=("etc/mkinitcpio.d/$pkgbase.preset")
- echo "Installing mkinitcpio preset..."
- sed "s|%PKGBASE%|$pkgbase|g;s|%KERNVER%|$kernver|g" ../../linux-armv7h.preset \
- | install -Dm644 /dev/stdin "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
- fi
- }
- _package-headers() {
- pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
- depends=(pahole)
- provides=("${_replacesarchkernel[@]/%/-headers=$pkgver}")
- conflicts=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
- replaces=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
- cd $_srcname
- local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
- echo "Installing build files..."
- install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
- localversion.* version vmlinux
- install -Dt "$builddir/kernel" -m644 kernel/Makefile
- install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile
- if [[ $CARCH = i686 ]]; then
- install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile_32.cpu
- fi
- cp -t "$builddir" -a scripts
- # required when STACK_VALIDATION is enabled
- if [[ -e tools/objtool/objtool ]]; then
- install -Dt "$builddir/tools/objtool" tools/objtool/objtool
- fi
- # required when DEBUG_INFO_BTF_MODULES is enabled
- if [[ -e tools/bpf/resolve_btfids/resolve_btfids ]]; then
- install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
- fi
- echo "Installing headers..."
- cp -t "$builddir" -a include
- cp -t "$builddir/arch/$KARCH" -a arch/$KARCH/include
- install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/kernel/asm-offsets.s
- # from linux-armv7
- if [ "$CARCH" = "armv7h" ]; then
- for i in dove omap2; do
- mkdir -p "$builddir/arch/$KARCH/mach-$i"
- cp -t "$builddir/arch/$KARCH/mach-$i/" -a arch/$KARCH/mach-$i/include
- done
- for i in omap orion versatile; do
- mkdir -p "$builddir/arch/$KARCH/plat-$i"
- cp -t "$builddir/arch/$KARCH/plat-$i/" -a arch/$KARCH/plat-$i/include
- done
- fi
- 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
- echo "Installing KConfig files..."
- find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
- echo "Removing unneeded architectures..."
- local arch
- for arch in "$builddir"/arch/*/; do
- [[ $arch = */$KARCH/ ]] && continue
- echo "Removing $(basename "$arch")"
- rm -r "$arch"
- done
- echo "Removing documentation..."
- rm -r "$builddir/Documentation"
- echo "Removing broken symlinks..."
- find -L "$builddir" -type l -printf 'Removing %P\n' -delete
- echo "Removing loose objects..."
- find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
- echo "Stripping build tools..."
- local file
- while read -rd '' file; do
- case "$(file -bi "$file")" in
- application/x-sharedlib\;*) # Libraries (.so)
- strip -v $STRIP_SHARED "$file" ;;
- application/x-archive\;*) # Libraries (.a)
- strip -v $STRIP_STATIC "$file" ;;
- application/x-executable\;*) # Binaries
- strip -v $STRIP_BINARIES "$file" ;;
- application/x-pie-executable\;*) # Relocatable binaries
- strip -v $STRIP_SHARED "$file" ;;
- esac
- done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
- echo "Stripping vmlinux..."
- strip -v $STRIP_STATIC "$builddir/vmlinux"
- echo "Adding symlink..."
- mkdir -p "$pkgdir/usr/src"
- ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
- }
- _package-docs() {
- pkgdesc="Documentation for the $pkgdesc kernel"
- provides=("${_replacesarchkernel[@]/%/-docs=$pkgver}")
- conflicts=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
- replaces=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
- cd $_srcname
- local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
- echo "Installing documentation..."
- local src dst
- while read -rd '' src; do
- dst="${src#Documentation/}"
- dst="$builddir/Documentation/${dst#output/}"
- install -Dm644 "$src" "$dst"
- done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
- echo "Adding symlink..."
- mkdir -p "$pkgdir/usr/share/doc"
- ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
- }
- 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:
|