From 4180b33667ecd8dbdda8e6e751115240bfbdaf2c Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 23 Feb 2021 11:08:39 +0100 Subject: Dramatically simplified PKGBUILD, modelled from Archlinux one. --- 99-linux.hook | 11 -- PKGBUILD | 366 +++++++++++++++++++++---------------------------- config | 2 +- linux-pinebook.install | 27 ---- linux.preset | 14 -- 5 files changed, 161 insertions(+), 259 deletions(-) delete mode 100644 99-linux.hook delete mode 100644 linux-pinebook.install delete mode 100644 linux.preset diff --git a/99-linux.hook b/99-linux.hook deleted file mode 100644 index 219e2d5..0000000 --- a/99-linux.hook +++ /dev/null @@ -1,11 +0,0 @@ -[Trigger] -Type = File -Operation = Install -Operation = Upgrade -Target = boot/Image -Target = usr/lib/initcpio/* - -[Action] -Description = Updating %PKGBASE% initcpios -When = PostTransaction -Exec = /usr/bin/mkinitcpio -p %PKGBASE% diff --git a/PKGBUILD b/PKGBUILD index 49de4e0..c294deb 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,263 +1,217 @@ # AArch64 multi-platform with Pine64 support # Maintainer: Jaron Kent-Dobias # Contributor: Vasily Khoruzhick - -#buildarch=8 +# Contributor: Jan Alexander Steffens (heftig) pkgbase=linux-pinebook pkgver=5.10.17.pinebook1 -pkgrel=6 -_desc="AArch64 multi-platform with Pinebook support." +pkgrel=8 +pkgdesc='Pinebook Linx' _srctag=v${pkgver%.*}-${pkgver##*.} url="https://git.kent-dobias.com/system/linux/log/?h=$_srctag" -_kernelname=${pkgbase#linux} -arch=('aarch64') -license=('GPL2') -makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'dtc' 'clang' 'llvm' 'lld') +arch=(aarch64) +license=(GPL2) +makedepends=( + bc kmod libelf pahole + xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick + git + uboot-tools dtc + clang llvm lld +) options=('!strip') _srcname=pinebook-linux source=( - "$_srcname::git+https://git.kent-dobias.com/system/linux?signed#tag=$_srctag" - 'config' - 'linux.preset' - '99-linux.hook' - ) + "$_srcname::git+https://git.kent-dobias.com/system/linux?signed#tag=$_srctag" + config +) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman '8218F88849AAC522E94CF470A5E9288C4FA415FA' # Jan Alexander Steffens (heftig) 'D214744D04A2CC409C37D331534FC3B63E48F730' # Jaron Kent-Dobias - ) -md5sums=('SKIP' - '88b0fc5f5af4d3e633848659a66de9b1' - '1bcc6c5d103b31523c5077b7c89f2b79' - '1d4477026533efaa0358a40855d50a83') +) +sha256sums=('SKIP' + '65dec29913b046ec8ffd4d4a80cb03e17a7ac25d6cd36099e4235ef89648765c') 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}/${_srcname}" +export ARCH=arm64 +export CROSS_COMPILE=aarch64-linux-gnu- - cat "${srcdir}/config" > ./.config +_make='make LLVM=1' + +prepare() { + cd $_srcname + + echo "Setting version..." + scripts/setlocalversion --save-scmversion + echo "-$pkgrel" > localversion.10-pkgrel + echo "${pkgbase#linux}" > localversion.20-pkgname + + local src + for src in "${source[@]}"; do + src="${src%%::*}" + src="${src##*/}" + [[ $src = *.patch ]] || continue + echo "Applying patch $src..." + patch -Np1 < "../$src" + done - # add pkgrel to extraversion - sed -ri "s|^(EXTRAVERSION =)(.*)|\1 \2-${pkgrel}|" Makefile + echo "Setting config..." + cp ../config .config + $_make olddefconfig - # don't run depmod on 'make install'. We'll do this ourselves in packaging - sed -i '2iexit 0' scripts/depmod.sh + $_make -s kernelrelease > version + echo "Prepared $pkgbase version $(=0.7') - optdepends=('crda: to set the correct wireless channels of your country') - provides=('kernel26' "linux=${pkgver}") - replaces=('linux-armv8-rc') - conflicts=('linux') - backup=("etc/mkinitcpio.d/${pkgbase}.preset") - install=${pkgname}.install - - cd "${srcdir}/${_srcname}" - - KARCH=arm64 - - # get kernel version - _kernver="$(ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make LLVM=1 kernelrelease)" - _basekernel=${_kernver%%-*} - _basekernel=${_basekernel%.*} - - mkdir -p "${pkgdir}"/{lib/modules,lib/firmware} - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make LLVM=1 INSTALL_MOD_PATH="${pkgdir}" modules_install - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make LLVM=1 INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install - cp arch/$KARCH/boot/Image{,.gz} "${pkgdir}/boot" - - # set correct depmod command for install - sed \ - -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \ - -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \ - -i "${startdir}/${pkgname}.install" - - # install mkinitcpio preset file for kernel - install -D -m644 "${srcdir}/linux.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" - sed \ - -e "1s|'linux.*'|'${pkgbase}'|" \ - -e "s|ALL_kver=.*|ALL_kver=\"${_kernver}\"|" \ - -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" - - # install pacman hook for initramfs regeneration - sed "s|%PKGBASE%|${pkgbase}|g" "${srcdir}/99-linux.hook" | - install -D -m644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/99-${pkgbase}.hook" + pkgdesc="The $pkgdesc kernel and modules" + depends=(coreutils kmod initramfs) + optdepends=('crda: to set the correct wireless channels of your country' + 'linux-firmware: firmware images needed for some devices') + provides=(linux VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE) + replaces=(virtualbox-guest-modules-arch wireguard-arch) + conflicts=(linux) - # remove build and source links - rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build} - # remove the firmware - rm -rf "${pkgdir}/lib/firmware" - # make room for external modules - ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules" - # add real version for building modules and running depmod from post_install/upgrade - mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}" - echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version" - - # Now we call depmod... - depmod -b "$pkgdir" -F System.map "$_kernver" - - # move module tree /lib -> /usr/lib - mkdir -p "${pkgdir}/usr" - mv "$pkgdir/lib" "$pkgdir/usr" - - # add vmlinux - install -D -m644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" -} + cd $_srcname + local kernver="$(/dev/null | while read binary ; do - case "$(file -bi "${binary}")" in - *application/x-sharedlib*) # Libraries (.so) - /usr/bin/strip ${STRIP_SHARED} "${binary}";; - *application/x-archive*) # Libraries (.a) - /usr/bin/strip ${STRIP_STATIC} "${binary}";; - *application/x-executable*) # Binaries - /usr/bin/strip ${STRIP_BINARIES} "${binary}";; - esac - done + 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) - # remove unneeded architectures - rm -rf "${pkgdir}"/usr/lib/modules/${_kernver}/build/arch/{alpha,arc,arm,arm26,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,metag,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,x86,xtensa} + echo "Adding symlink..." + mkdir -p "$pkgdir/usr/share/doc" + ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase" } -pkgname=("${pkgbase}" "${pkgbase}-headers") -for _p in ${pkgname[@]}; do - eval "package_${_p}() { - _package${_p#${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: diff --git a/config b/config index 879855c..4d60ce7 100644 --- a/config +++ b/config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.10.17-5 Kernel Configuration +# Linux/arm64 5.10.17 Kernel Configuration # CONFIG_CC_VERSION_TEXT="clang version 11.1.0" CONFIG_GCC_VERSION=0 diff --git a/linux-pinebook.install b/linux-pinebook.install deleted file mode 100644 index 1e540ff..0000000 --- a/linux-pinebook.install +++ /dev/null @@ -1,27 +0,0 @@ -# arg 1: the new package version -# arg 2: the old package version - -KERNEL_NAME=-pinebook -KERNEL_VERSION=5.10.17-2-ARCH+ - -post_install () { - # updating module dependencies - echo ">>> Updating module dependencies. Please wait ..." - depmod ${KERNEL_VERSION} -} - -post_upgrade() { - if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then - echo "WARNING: /boot appears to be a separate partition but is not mounted." - fi - - # updating module dependencies - echo ">>> Updating module dependencies. Please wait ..." - depmod ${KERNEL_VERSION} -} - -post_remove() { - # also remove the compat symlinks - rm -f boot/initramfs-linux.img - rm -f boot/initramfs-linux-fallback.img -} diff --git a/linux.preset b/linux.preset deleted file mode 100644 index 8d8ed28..0000000 --- a/linux.preset +++ /dev/null @@ -1,14 +0,0 @@ -# mkinitcpio preset file for the 'linux-aarch64-rc' package - -ALL_config="/etc/mkinitcpio.conf" -ALL_kver="5.3.0-1-ARCH" - -PRESETS=('default' 'fallback') - -#default_config="/etc/mkinitcpio.conf" -default_image="/boot/initramfs-linux.img" -#default_options="" - -#fallback_config="/etc/mkinitcpio.conf" -fallback_image="/boot/initramfs-linux-fallback.img" -fallback_options="-S autodetect" -- cgit v1.2.3-70-g09d2