diff options
author | yjun | 2022-04-30 23:08:21 +0800 |
---|---|---|
committer | yjun | 2022-04-30 23:08:21 +0800 |
commit | d50e729b948e30fc5f4cadb2a2a90f7e41612768 (patch) | |
tree | 6da720ee5753133742b76b9f5b6535a03cb4732c /PKGBUILD | |
parent | c125b79690b319c3348cb88c768ad0bb718643e8 (diff) | |
download | aur-d50e729b948e30fc5f4cadb2a2a90f7e41612768.tar.gz |
updpkg: linux-phicomm-n1 5.17.5
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 209 |
1 files changed, 88 insertions, 121 deletions
@@ -18,7 +18,7 @@ pkgbase=linux-phicomm-n1 _srcname=linux-5.17 _kernelname=${pkgbase#linux} _desc="AArch64 kernel for Phicomm N1" -pkgver=5.17.4 +pkgver=5.17.5 pkgrel=1 arch=('aarch64') url="https://www.kernel.org/" @@ -60,7 +60,7 @@ source+=("https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz") md5sums=('07321a70a48d062cebd0358132f11771' '14b9c040a7a9320ea91a779cd8f14f02' - 'f9877f4fee835a3b5880d59855c356e0' + '10c1eda8b8518668006a77350693ff31' '30130b4dcd8ad4364ddbfd56c3058d5e' 'ce6c81ad1ad1f8b333fd6077d47abdaf' '0d0435888ecad675870ecda4045a9d45' @@ -82,17 +82,20 @@ md5sums=('07321a70a48d062cebd0358132f11771' '425ec378dc6973e6185895d7a13a8d66' '38e3b2c9490ac3b8201db37e73ff2534' 'dfcd0e763405a425b3f277394ed65a5d' - 'b76bfbb5308a55f951ec17365fe3560d') + 'cdcffeee90d436b93ecb621d3ce940d8') prepare() { cd ${_srcname} + echo "Setting version..." + scripts/setlocalversion --save-scmversion + echo "-$pkgrel" > localversion.10-pkgrel + echo "${pkgbase#linux}" > localversion.20-pkgname + # add upstream patch [[ ${pkgver##*.} != 0 ]] && \ patch -p1 < "../patch-${pkgver}" - cat "${srcdir}/config" > ./.config - # Amlogic meson SoC TEXT_OFFSET # Attention: since kernel 5.10, TEXT_OFFSET support is removed entriely, but it is required for the old BSP uboot to boot the kernel, so just revert it. # [arm64: get rid of TEXT_OFFSET](https://github.com/torvalds/linux/commit/120dc60d0bdbadcad7460222f74c9ed15cdeb73e) @@ -130,54 +133,25 @@ prepare() { target_dts="meson-gxl-s905d-phicomm-n1.dts" cat "${srcdir}/${target_dts}" > "./arch/arm64/boot/dts/amlogic/${target_dts}" - # add pkgrel to extraversion - sed -ri "s|^(EXTRAVERSION =)(.*)|\1 \2-${pkgrel}|" Makefile - - # don't run depmod on 'make install'. We'll do this ourselves in packaging - sed -i '2iexit 0' scripts/depmod.sh + cat "${srcdir}/config" > ./.config } build() { cd ${_srcname} - - # use default settings for new options - make olddefconfig - # add back newly generated .config for new builds, disabled by default - #cp ./.config ../../config - # get kernel version make 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 + make -s kernelrelease > version # build! unset LDFLAGS - make ${MAKEFLAGS} Image modules + make ${MAKEFLAGS} Image Image.gz modules # Generate device tree blobs with symbols to support applying device tree overlays in U-Boot make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs } _package() { - pkgdesc="The Linux kernel and modules - ${_desc}" + 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=("linux=${pkgver}" "WIREGUARD-MODULE") @@ -186,42 +160,24 @@ _package() { backup=("etc/mkinitcpio.d/${pkgbase}.preset") install=${pkgname}.install - cd ${_srcname} - - KARCH=arm64 + cd $_srcname + local kernver="$(<version)" + local modulesdir="$pkgdir/usr/lib/modules/$kernver" - # get kernel version - _kernver="$(make kernelrelease)" - _basekernel=${_kernver%%-*} - _basekernel=${_basekernel%.*} - - mkdir -p "${pkgdir}"/{boot,usr/lib/modules} - make INSTALL_MOD_PATH="${pkgdir}/usr" modules_install + echo "Installing boot image and dtbs..." + install -Dm644 arch/arm64/boot/Image{,.gz} -t "${pkgdir}/boot" make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install - cp arch/$KARCH/boot/Image "${pkgdir}/boot/" - # make room for external modules - local _extramodules="extramodules-${_basekernel}${_kernelname}" - 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" + echo "Installing modules..." + make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install # 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 + rm "$modulesdir"/{source,build} # sed expression for following substitutions local _subst=" s|%PKGBASE%|${pkgbase}|g - s|%KERNVER%|${_kernver}|g - s|%EXTRAMODULES%|${_extramodules}|g + s|%KERNVER%|${kernver}|g " # install mkinitcpio preset file @@ -239,68 +195,79 @@ _package-headers() { pkgdesc="Header files and scripts for building modules for linux kernel - ${_desc}" provides=("linux-headers=${pkgver}") conflicts=('linux-headers') + + cd $_srcname + local builddir="$pkgdir/usr/lib/modules/$(<version)/build" - cd ${_srcname} - 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/${KARCH}" -m644 arch/${KARCH}/Makefile - install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 arch/${KARCH}/kernel/asm-offsets.s - - cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include - mkdir -p "${_builddir}/arch/arm" - cp -t "${_builddir}/arch/arm" -a arch/arm/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 + 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 # add xfs and shmem for aufs building - mkdir -p "${_builddir}"/{fs/xfs,mm} - - # copy in Kconfig files - find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \; - - # remove unneeded architectures - local _arch - for _arch in "${_builddir}"/arch/*/; do - [[ ${_arch} == */${KARCH}/ || ${_arch} == */arm/ ]] && continue - rm -r "${_arch}" + mkdir -p "$builddir"/{fs/xfs,mm} + + 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 + mkdir -p "$builddir/arch/arm" + cp -t "$builddir/arch/arm" -a arch/arm/include + + 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 = */arm64/ || $arch == */arm/ ]] && continue + echo "Removing $(basename "$arch")" + rm -r "$arch" done - # remove files already in linux-docs package - rm -r "${_builddir}/Documentation" - - # remove now broken symlinks - find -L "${_builddir}" -type l -printf 'Removing %P\n' -delete - - # 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 ;; + 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 - /usr/bin/strip ${_strip} "${_binary}" - done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null) + done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0) + + echo "Adding symlink..." + mkdir -p "$pkgdir/usr/src" + ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase" } pkgname=("${pkgbase}" "${pkgbase}-headers") |