summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD428
1 files changed, 221 insertions, 207 deletions
diff --git a/PKGBUILD b/PKGBUILD
index e8afe3d3b569..6c5dcb9a5e0f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,268 +1,282 @@
-# AArch64 kernel for Phicomm N1
-# Original Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
-# Maintainer: Peter Cai <peter at typeblog dot net>
+# Maintainer: yjun <jerrysteve1101 at gmail dot com>
+# Contributor: Peter Cai <peter at typeblog dot net>
+# Origin Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
-buildarch=8
+# dts for phicomm-n1 :
+# https://github.com/cattyhouse/pkgbuild-linux-phicomm-n1/
+
+# PKGBUILD:
+# https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/linux-aarch64/PKGBUILD
+
+# 02-revert-TEXT_OFFSET-deletion.patch:
+# https://github.com/SuzukiHonoka/s905d-kernel-precompiled/tree/master/patch
+
+# Armbina patches
+# https://github.com/armbian/build/tree/master/patch/kernel/archive/meson64-5.17
pkgbase=linux-phicomm-n1
-_srcname=linux-4.18
+_srcname=linux-5.17
_kernelname=${pkgbase#linux}
_desc="AArch64 kernel for Phicomm N1"
-pkgver=4.18.14
+pkgver=5.17.7
pkgrel=1
arch=('aarch64')
-url="http://www.kernel.org/"
+url="https://www.kernel.org/"
license=('GPL2')
+depends=('uboot-tools')
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'vboot-utils' 'dtc')
options=('!strip')
-source=("http://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
- "http://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.xz"
- '0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch'
- '0002-arm64-dts-rockchip-disable-pwm0-on-rk3399-firefly.patch'
- '0003-arm64-dts-rockchip-add-usb3-controller-node-for-RK33.patch'
- '0004-arm64-dts-rockchip-enable-usb3-nodes-on-rk3328-rock6.patch'
+source=(
+ "https://mirror.bjtu.edu.cn/kernel/linux/kernel/v5.x/${_srcname}.tar.xz"
+ # "https://cdn.kernel.org/pub/linux/kernel/v5.x/${_srcname}.tar.xz"
+ 'meson-gxl-s905d-phicomm-n1.dts'
'config'
'linux.preset'
- '99-linux.hook')
-md5sums=('bee5fe53ee1c3142b8f0c12c0d3348f9'
- '5e8695bf4dc16213963ba04768a23539'
- 'be4199c685434f12190bb627bb714ff2'
- 'b4d613a58a28445ce8363d734be3b971'
- 'b9bec2a58df6dff282df758edf8f526e'
- '9915046e15f82e917bc98c7721e63ac4'
- '96969a438a2a4e39df5ed44e8ba68c03'
- 'f6ee374f560e1b9df6a7de2399027d1b'
- 'd1c40c7367a7081f3b4c03264780f9d4')
+ '60-linux.hook'
+ '90-linux.hook'
+ '02-revert-TEXT_OFFSET-deletion.patch'
+ '03-make-proc-cpuinfo-consistent-on-arm64-and-arm.patch'
+ # patches from armbian
+ "general-meson-gx-mmc-fix-deferred-probing.patch"
+ "general-meson-gx-mmc-set-core-clock-phase-to-270-degres.patch"
+ "general-meson-aiu-Fix-HDMI-codec-control-selection.patch"
+ "general-gpu-drm-add-new-display-resolution-2560x1440.patch"
+ "general-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock.patch"
+ "general-hdmi-codec-reorder-channel-allocation-list.patch"
+ "general-revert-meson_drv_shutdown.patch"
+ "general-meson-vdec-remove-redundant-if-statement.patch"
+ "general-meson-vdec-add-HEVC-decode-codec.patch"
+ "general-meson-vdec-check-if-parser-has-really-parser.patch"
+ "general-meson-vdec-add-handling-to-HEVC-decoder-.patch"
+ "general-meson-vdec-improve-mmu-and-fbc-handling-.patch"
+ "general-memory-marked-nomap.patch"
+ "general-usb-core-improve-handling-of-hubs-with-no-ports.patch"
+ "general-increase-cma-pool-896MB.patch"
+ "general-sound-soc-remove-mono-channel-as-it-curren.patch"
+)
+
+[[ ${pkgver##*.} != 0 ]] && \
+# source+=("https://cdn.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz")
+source+=("https://mirror.bjtu.edu.cn/kernel/linux/kernel/v5.x/patch-${pkgver}.xz")
+
+md5sums=('07321a70a48d062cebd0358132f11771'
+ '14b9c040a7a9320ea91a779cd8f14f02'
+ 'cf6bfafe79c9dc3e5fb9e9979b85855d'
+ '30130b4dcd8ad4364ddbfd56c3058d5e'
+ 'ce6c81ad1ad1f8b333fd6077d47abdaf'
+ '0d0435888ecad675870ecda4045a9d45'
+ '614a77d2f4c92817ab4e5f989f9a76c9'
+ '7a18066683f3351b2bbd2653db783f80'
+ '55f160f63da3d642dc274b9830622187'
+ '679e90aa8d00df767dbd9315238bcecc'
+ '353091ec7dc615e242a6e00a712668b2'
+ 'd590f2af9d150f00bf9e5e4239e16105'
+ '116c87fd40aa252e6702ad61af27b824'
+ 'd3ce443630c8c9768637d4b123dd8c70'
+ '06d09873c61527e9488bf65973dc96c5'
+ 'c7f753fbb98202b9148ad7b4aed8ecad'
+ '87d3fc334bc0309968948a084a1c3459'
+ '90b82b89d96283e1f03d302676ecfe78'
+ 'eed9d1f3957af438f1c60d3d405dbb2d'
+ 'a4643fd62a9bf5b042d41cd0ddfa6906'
+ '3c2bada63ca2427c78e224db5ded7c09'
+ '425ec378dc6973e6185895d7a13a8d66'
+ '38e3b2c9490ac3b8201db37e73ff2534'
+ 'dfcd0e763405a425b3f277394ed65a5d'
+ 'c942f79b0f310ca6e8d5828fad539a7f')
prepare() {
- cd "${srcdir}/${_srcname}"
-
- # add upstream patch
- patch -p1 < ../patch-${pkgver}
+ cd ${_srcname}
- # ALARM patches
- patch -p1 < ../0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
- patch -p1 < ../0002-arm64-dts-rockchip-disable-pwm0-on-rk3399-firefly.patch
- patch -p1 < ../0003-arm64-dts-rockchip-add-usb3-controller-node-for-RK33.patch
- patch -p1 < ../0004-arm64-dts-rockchip-enable-usb3-nodes-on-rk3328-rock6.patch
+ 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}"
+
+ # 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)
+ patch -p1 < "${srcdir}/02-revert-TEXT_OFFSET-deletion.patch"
+
+ # Make proc cpuinfo consistent on arm64 and arm
+ patch -p1 < "${srcdir}/03-make-proc-cpuinfo-consistent-on-arm64-and-arm.patch"
+
+ # Patches from Armbian
+ # MMC
+ patch -p1 < "${srcdir}/general-meson-gx-mmc-set-core-clock-phase-to-270-degres.patch"
+ patch -p1 < "${srcdir}/general-meson-gx-mmc-fix-deferred-probing.patch"
+
+ # DRM and HDMI
+ patch -p1 < "${srcdir}/general-meson-aiu-Fix-HDMI-codec-control-selection.patch"
+ patch -p1 < "${srcdir}/general-gpu-drm-add-new-display-resolution-2560x1440.patch"
+ patch -p1 < "${srcdir}/general-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock.patch"
+ patch -p1 < "${srcdir}/general-hdmi-codec-reorder-channel-allocation-list.patch"
+ patch -p1 < "${srcdir}/general-revert-meson_drv_shutdown.patch"
+
+ # MESON-VDEC
+ patch -p1 < "${srcdir}/general-meson-vdec-remove-redundant-if-statement.patch"
+ patch -p1 < "${srcdir}/general-meson-vdec-add-HEVC-decode-codec.patch"
+ patch -p1 < "${srcdir}/general-meson-vdec-check-if-parser-has-really-parser.patch"
+ patch -p1 < "${srcdir}/general-meson-vdec-add-handling-to-HEVC-decoder-.patch"
+ patch -p1 < "${srcdir}/general-meson-vdec-improve-mmu-and-fbc-handling-.patch"
+
+ # MISC
+ patch -p1 < "${srcdir}/general-memory-marked-nomap.patch"
+ patch -p1 < "${srcdir}/general-usb-core-improve-handling-of-hubs-with-no-ports.patch"
+ patch -p1 < "${srcdir}/general-increase-cma-pool-896MB.patch"
+ patch -p1 < "${srcdir}/general-sound-soc-remove-mono-channel-as-it-curren.patch"
+
+ # Dts for Phicomm-N1
+ target_dts="meson-gxl-s905d-phicomm-n1.dts"
+ cat "${srcdir}/${target_dts}" > "./arch/arm64/boot/dts/amlogic/${target_dts}"
+
cat "${srcdir}/config" > ./.config
-
- # Amlogic S9xxx TEXT_OFFSET patch
- sed -i "s/TEXT_OFFSET := 0x00080000/TEXT_OFFSET := 0x01080000/g" arch/arm64/Makefile
- sed -i "s/#error TEXT_OFFSET must be less than 2MB//g" arch/arm64/kernel/head.S
-
- # 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
}
build() {
- cd "${srcdir}/${_srcname}"
+ cd ${_srcname}
# 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 dtbs
+ 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}"
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
optdepends=('crda: to set the correct wireless channels of your country')
- provides=('kernel26' "linux=${pkgver}")
+ provides=("linux=${pkgver}" "WIREGUARD-MODULE")
+ replaces=('linux-armv8')
conflicts=('linux')
backup=("etc/mkinitcpio.d/${pkgbase}.preset")
install=${pkgname}.install
- cd "${srcdir}/${_srcname}"
+ cd $_srcname
+ local kernver="$(<version)"
+ local modulesdir="$pkgdir/usr/lib/modules/$kernver"
- KARCH=arm64
-
- # get kernel version
- _kernver="$(make kernelrelease)"
- _basekernel=${_kernver%%-*}
- _basekernel=${_basekernel%.*}
-
- mkdir -p "${pkgdir}"/{lib/modules,lib/firmware}
- make INSTALL_MOD_PATH="${pkgdir}" 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/zImage"
- cp ${pkgdir}/boot/dtbs/amlogic/meson-gxl-s905d-p230.dtb "${pkgdir}/boot/dtb.img"
-
- # 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"
+
+ echo "Installing modules..."
+ make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
# 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"
+ rm "$modulesdir"/{source,build}
+
+ # sed expression for following substitutions
+ local _subst="
+ s|%PKGBASE%|${pkgbase}|g
+ s|%KERNVER%|${kernver}|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"
}
_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"
- install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
-
- 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"
-
- mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include"
-
- 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
-
- # 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/
-
- # 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"
-
- # 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"
-
- mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel"
-
- cp arch/${KARCH}/Makefile "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/"
-
- cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel/"
-
- # copy module linker script
- cp arch/$KARCH/kernel/module.lds "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel/"
-
- # 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"
-
- # 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/"
-
- # 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/"
-
- # add dvb headers for external modules
- # in reference to:
- # 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/"
-
- # 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/"
-
- # 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 "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 "${pkgdir}/usr/lib/modules/${_kernver}/build/fs/xfs"
- mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/mm"
-
- # 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}"
+ 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
- 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}";;
+ 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
+ done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -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/src"
+ ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}
pkgname=("${pkgbase}" "${pkgbase}-headers")
for _p in ${pkgname[@]}; do
eval "package_${_p}() {
+ $(declare -f "_package${_p#$pkgbase}")
_package${_p#${pkgbase}}
}"
done
+
+# vim: set sw=2 ts=2 et: