diff options
-rw-r--r-- | 99-linux.hook | 11 | ||||
-rw-r--r-- | PKGBUILD | 366 | ||||
-rw-r--r-- | config | 2 | ||||
-rw-r--r-- | linux-pinebook.install | 27 | ||||
-rw-r--r-- | linux.preset | 14 |
5 files changed, 161 insertions, 259 deletions
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% @@ -1,263 +1,217 @@ # AArch64 multi-platform with Pine64 support # Maintainer: Jaron Kent-Dobias <jaron@kent-dobias.com> # Contributor: Vasily Khoruzhick <anarsoul@gmail.com> - -#buildarch=8 +# Contributor: Jan Alexander Steffens (heftig) <heftig@archlinux.org> 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 $(<version)" } build() { - cd "${srcdir}/${_srcname}" - - # get kernel version - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make LLVM=1 prepare - - # load configuration - # Configure the kernel. Replace the line below with one of your choice. - #make menuconfig # CLI menu for configuration - #make nconfig # new CLI menu for configuration - #make xconfig # X-based configuration - #make oldconfig # using old config from previous kernel version - # ... or manually edit .config - - # Copy back our configuration (use with new kernel version) - #cp ./.config ../${pkgbase}.config - - #################### - # stop here - # this is useful to configure the kernel - #msg "Stopping build" - #return 1 - #################### - - #yes "" | make config - - # build! - unset LDFLAGS - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j9 LLVM=1 ${MAKEFLAGS} Image Image.gz modules dtbs + cd $_srcname + $_make Image Image.gz modules dtbs + $_make htmldocs } _package() { - pkgdesc="The Linux Kernel and modules - ${_desc}" - depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=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="$(<version)" + local modulesdir="$pkgdir/usr/lib/modules/$kernver" -_package-headers() { - pkgdesc="Header files and scripts for building modules for linux kernel - ${_desc}" - provides=("linux-headers=${pkgver}") - replaces=('linux-armv8-rc-headers') - conflicts=('linux-headers') + echo "Installing boot image..." + install -Dm644 arch/arm64/boot/Image "${pkgdir}/boot/Image" + install -Dm644 arch/arm64/boot/Image.gz "${pkgdir}/boot/Image.gz" - install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}" + # 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" - cd "${srcdir}/${_srcname}" - install -D -m644 Makefile \ - "${pkgdir}/usr/lib/modules/${_kernver}/build/Makefile" - install -D -m644 kernel/Makefile \ - "${pkgdir}/usr/lib/modules/${_kernver}/build/kernel/Makefile" - install -D -m644 .config \ - "${pkgdir}/usr/lib/modules/${_kernver}/build/.config" + # Used by mkinitcpio to name the kernel + echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase" - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include" + echo "Installing modules..." + $_make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install - for i in acpi asm-generic clocksource config crypto drm generated keys linux \ - math-emu media net pcmcia scsi soc sound trace uapi video xen; do - cp -a include/${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/include/" - done + echo "Installing dtbs..." + $_make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install - # copy arch includes for external modules - mkdir -p ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH - cp -a arch/$KARCH/include ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH/ + # remove build and source links + rm "$modulesdir"/{source,build} +} - # copy files necessary for later builds, like nvidia and vmware - cp Module.symvers "${pkgdir}/usr/lib/modules/${_kernver}/build" - cp -a scripts "${pkgdir}/usr/lib/modules/${_kernver}/build" +_package-headers() { + pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel" + provides=("linux-headers=${pkgver}") + conflicts=('linux-headers') - # fix permissions on scripts dir - chmod og-w -R "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts" - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/.tmp_versions" + cd $_srcname + local builddir="$pkgdir/usr/lib/modules/$(<version)/build" - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel" + 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/arm64" -m644 arch/arm64/Makefile + cp -t "$builddir" -a scripts - cp arch/${KARCH}/Makefile "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/" + # add objtool for external module building and enabled VALIDATION_STACK option + install -Dt "$builddir/tools/objtool" tools/objtool/objtool - cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel/" + # add xfs and shmem for aufs building + mkdir -p "$builddir"/{fs/xfs,mm} - # copy module linker script - cp arch/$KARCH/kernel/module.lds "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel/" + echo "Installing headers..." + cp -t "$builddir" -a include + cp -t "$builddir/arch/arm64" -a arch/arm64/include + install -Dt "$builddir/arch/arm64/kernel" -m644 arch/arm64/kernel/asm-offsets.s - # add dm headers - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md" - cp drivers/md/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md" + install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h + install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h - # add inotify.h - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux" - cp include/linux/inotify.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux/" + # http://bugs.archlinux.org/task/13146 + install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h - # add wireless headers - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/" - cp net/mac80211/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/" + # 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 + + echo "Installing KConfig files..." + find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \; + + echo "Removing unneeded architectures..." + local arch + for arch in "$builddir"/arch/*/; do + [[ $arch = */arm64/ ]] && continue + echo "Removing $(basename "$arch")" + rm -r "$arch" + done - # add dvb headers for external modules - # in reference to: - # http://bugs.archlinux.org/task/9912 - # mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-core" - # cp drivers/media/dvb-core/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-core/" - # and... - # http://bugs.archlinux.org/task/11194 - # mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/" - # cp include/config/dvb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/" + 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) - # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new - # in reference to: - # http://bugs.archlinux.org/task/13146 - # mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/" - # cp drivers/media/dvb-frontends/lgdt330x.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/" - # mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/" - # cp drivers/media/i2c/msp3400-driver.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/" + echo "Stripping vmlinux..." + strip -v $STRIP_STATIC "$builddir/vmlinux" - # add dvb headers - # in reference to: - # http://bugs.archlinux.org/task/20402 - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb" - cp drivers/media/usb/dvb-usb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb/" - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends" - cp drivers/media/dvb-frontends/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/" - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners" - cp drivers/media/tuners/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners/" + echo "Adding symlink..." + mkdir -p "$pkgdir/usr/src" + ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase" +} - # add xfs and shmem for aufs building - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/fs/xfs" - mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/mm" +_package-docs() { + pkgdesc="Documentation for the $pkgdesc kernel" - # copy in Kconfig files - for i in $(find . -name "Kconfig*"); do - mkdir -p "${pkgdir}"/usr/lib/modules/${_kernver}/build/`echo ${i} | sed 's|/Kconfig.*||'` - cp ${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/${i}" - done + cd $_srcname + local builddir="$pkgdir/usr/lib/modules/$(<version)/build" - chown -R root.root "${pkgdir}/usr/lib/modules/${_kernver}/build" - find "${pkgdir}/usr/lib/modules/${_kernver}/build" -type d -exec chmod 755 {} \; - - # strip scripts directory - find "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts" -type f -perm -u+w 2>/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: @@ -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" |