summaryrefslogtreecommitdiff
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD319
1 files changed, 319 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 0000000..3393172
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,319 @@
+# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
+# Maintainer (Manjaro): Dan Johansen <strit@manjaro.org>
+# Contributor (ArchArm): Kevin Mihelich <kevin@archlinuxarm.org>
+
+# # I maintain this because:
+# Manjaro version patch script does not apply consistently
+# Arch version lacks ath9k regdom and raid6 algo patches
+# Manjaro version uses git
+# Manjaro version lacks cake modules
+
+pkgbase=linux-pinebookpro
+_pkgname=linux-pinebook-pro
+_exname=pinebookpro
+_supver=5
+_majver=4
+_minver=0
+ if [ "$_minver" == "0" ]; then
+ pkgver=${_supver}.${_majver}
+ else
+ pkgver=${_supver}.${_majver}.${_minver}
+ fi
+pkgrel=11
+pkgdesc='Linux-PineBookPro'
+url='https://gitlab.manjaro.org/tsys/linux-pinebook-pro'
+arch=(aarch64)
+#arch=(x86_64)
+license=(GPL2)
+makedepends=(
+ bc kmod libelf
+ dtc uboot-tools vboot-utils
+)
+provides=('linux')
+conflicts=('linux')
+options=('!strip')
+_srcname=linux-${pkgver}
+_commit=a48441783fc6f15bd076dc0d01ecc2913d79260a
+source=(
+ https://www.kernel.org/pub/linux/kernel/v${_supver}.x/${_srcname}.tar.{xz,sign}
+ pinebookpro-$_commit.patch
+ 0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
+ 0001-arm64-dts-rockchip-remove-capacity-dmips-rk3399.patch
+ 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-CLONE_NEWUSER.patch
+ ath9k-regdom-hack.patch
+ raid6-default-algo.patch
+ config # the main kernel config file
+ kernel.its
+ kernel.keyblock
+ kernel_data_key.vbprivk
+ linux.preset
+ 60-linux.hook
+ 90-linux.hook
+)
+validpgpkeys=(
+ 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
+ '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
+)
+# https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
+sha256sums=('bf338980b1670bca287f9994b7441c2361907635879169c64ae78364efc5f491'
+ 'SKIP'
+ '4b42263a879a282dd449897d9531dc007696e3a13cda3295aa49106007ecf94d'
+ '5ed674a3a420c1a93b77cb9e243c202996d3783138182816fc37a17367a84474'
+ '5e83715ae4d1ffe179091f88f2443cb068007c20b77b833eb2908e4d64217564'
+ 'e862ecd2cb0b20e1859ec3e47616457a9a3acb111cd5a86094f9ed1dbd7f42ac'
+ 'e7ebf050c22bcec0028c0b3c79fd6d3913b0370ecc6a23dfe78ce475630cf503'
+ '0f81d6e4158b7beeb0eb514f1b9401f7e23699cb0f7b0d513e25dae1815daaeb'
+ '8f9c5b6b6d9d84e24dcb63f3aad62cd86e0e04064cacc8da42ecfda20a08eaca'
+ 'd074a28bd31972fbca42f9e91624a2f873350428a89d9a9af6d0ace32686475f'
+ '4e708c9ec43ac4a5d718474c9431ba6b6da3e64a9dda6afd2853a9e9e3079ffb'
+ 'bc9e707a86e55a93f423e7bcdae4a25fd470b868e53829b91bbe2ccfbc6da27b'
+ '66644820faa950a5fc59181f5aefcbed6d7ed652b29aee69979a2be2a032025d'
+ 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
+ '71df1b18a3885b151a3b9d926a91936da2acc90d5e27f1ad326745779cd3759d')
+
+export KBUILD_BUILD_HOST=$_exname
+export KBUILD_BUILD_USER=$pkgbase
+export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
+
+prepare() {
+ cd $_srcname
+
+ # add upstream patch
+# if [ "$_minver" != "0" ]; then
+# msg2 "Applying upstream patch"
+# patch -Np1 < ../patch-${_supver}.${_majver}-${pkgver}
+# fi
+
+ # Out of tree changes for pinebookpro to function
+ msg2 "Applying pinebookpro patch"
+ patch -p1 -i ../pinebookpro-$_commit.patch
+
+ # ALARM patches
+ patch -Np1 -i ..//0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
+
+ # Manjaro ARM Patches
+ patch -Np1 -i ../0001-arm64-dts-rockchip-remove-capacity-dmips-rk3399.patch
+
+
+ # Hotfixes
+ msg2 "Applying hotfixes"
+ patch -p1 -i ../0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-CLONE_NEWUSER.patch
+
+
+ # Ignore ath9k eeprom patch
+ msg2 "Applying ath9k patch"
+ patch -p1 -i ../ath9k-regdom-hack.patch
+
+ # Set default raid6 algo patch
+ msg2 " Applying raid6 patch"
+ patch -p1 -i ../raid6-default-algo.patch
+
+
+ msg2 "Setting version..."
+ scripts/setlocalversion --save-scmversion
+ echo "-$pkgrel" > localversion.10-pkgrel
+ echo "${pkgbase#linux}" > localversion.20-pkgname
+
+
+ msg2 "Setting config..."
+ # we are in src/linux-x.yy.zz, looking for a config next to the pkgbuild
+# if [ -f ${SRCDEST}/config.previous ]; then
+# cp ${SRCDEST}/config.previous .config
+# else
+ cp ../config .config
+# fi
+
+ make olddefconfig
+
+# make menuconfig
+
+ # Remove sublevel when no sublevel exists
+ if [ "$_minver" == "0" ]; then
+ sed -i '/SUBLEVEL = 0/d' Makefile
+ fi
+
+ make -s kernelrelease > version
+
+ # workaround for make -s kernelrelease not applying
+ # localversion to version when changed using menuconfig
+ grep -Po '(?<=CONFIG_LOCALVERSION=").*(?=")' .config > ../localversion
+ echo "$pkgver" > ../version.temp
+ cat "localversion.10-pkgrel" >> ../version.temp
+ cat "localversion.20-pkgname" >> ../version.temp
+ cat ../localversion >> ../version.temp
+ cat ../version.temp | tr -d "\n" > version
+
+ # back up the config
+# msg2 "Backing up config..."
+# cp .config ${SRCDEST}/config.previous
+
+ msg2 "Prepared %s version %s" "$pkgbase" "$(<version)"
+
+ # don't run depmod on 'make install'. We'll do this ourselves in packaging
+ sed -i '2iexit 0' scripts/depmod.sh
+
+}
+
+build() {
+ cd $_srcname
+ make Image Image.gz modules
+ # Generate device tree blobs with symbols to support applying device tree overlays in U-Boot
+ make DTC_FLAGS="-@" dtbs
+}
+
+_package() {
+ 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')
+
+ cd $_srcname
+ local kernver="$(<version)"
+ local modulesdir="$pkgdir/usr/lib/modules/$kernver"
+
+ msg2 "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/vmlinux"
+
+ # Used by mkinitcpio to name the kernel
+ echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
+
+ mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
+
+ msg2 "Installing modules..."
+ make INSTALL_MOD_PATH="$pkgdir/usr" modules_install
+
+ msg2 "Installing dtbs..."
+ make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
+
+ cp arch/arm64/boot/Image{,.gz} "${pkgdir}/boot"
+
+ # make room for external modules
+ local _extramodules="extramodules-${kernver}"
+ 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 "$modulesdir"/{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
+ "
+
+ # 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"
+
+
+ msg2 "Fixing permissions..."
+ chmod -Rc u=rwX,go=rX "$pkgdir"
+}
+
+_package-headers() {
+ pkgdesc="Header files and scripts for building modules for $pkgdesc kernel"
+
+ cd $_srcname
+ local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
+
+ msg2 "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
+
+ # add objtool for external module building and enabled VALIDATION_STACK option
+ if [[ -e tools/objtool/objtool ]]; then
+ install -Dt "$builddir/tools/objtool" tools/objtool/objtool
+ fi
+
+ # add xfs and shmem for aufs building
+ mkdir -p "$builddir"/{fs/xfs,mm}
+
+ msg2 "Installing headers..."
+ cp -t "$builddir" -a include
+ cp -t "$builddir/arch/arm64" -a arch/arm64/include
+ mkdir -p "$builddir/arch/arm"
+ cp -t "$builddir/arch/arm" -a arch/arm/include
+ install -Dt "$builddir/arch/arm64/kernel" -m644 arch/arm64/kernel/asm-offsets.s arch/arm64/kernel/module.lds
+
+ 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
+
+ msg2 "Installing KConfig files..."
+ find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
+
+ msg2 "Removing unneeded architectures..."
+ local arch
+ for arch in "$builddir"/arch/*/; do
+ [[ $arch = */arm64/ || ${_arch} == */arm/ ]] && continue
+ echo "Removing $(basename "$arch")"
+ rm -r "$arch"
+ done
+
+ msg2 "Removing documentation..."
+ rm -r "$builddir/Documentation"
+
+ msg2 "Removing broken symlinks..."
+ find -L "$builddir" -type l -printf 'Removing %P\n' -delete
+
+ msg2 "Removing loose objects..."
+ find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
+
+ msg2 "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)
+
+ msg2 "Adding symlink..."
+ mkdir -p "$pkgdir/usr/src"
+ ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
+
+ msg2 "Fixing permissions..."
+ chmod -Rc u=rwX,go=rX "$pkgdir"
+}
+
+pkgname=("$pkgbase" "$pkgbase-headers")
+for _p in "${pkgname[@]}"; do
+ eval "package_$_p() {
+ $(declare -f "_package${_p#$pkgbase}")
+ _package${_p#$pkgbase}
+ }"
+done