aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Koch2023-08-28 12:37:28 +0200
committerAlexander Koch2023-08-30 11:29:27 +0200
commit573779671fd8e17e41e65a7258988e91fd375ee1 (patch)
tree5573ad74a82a30fae6623584f1d247e29c5075aa
parent82594e0ad41334fa67a90526cdbc5388b46e2c1d (diff)
downloadaur-573779671fd8e17e41e65a7258988e91fd375ee1.tar.gz
Refactor PKGBUILD to get closer to Arch
Heavy refactoring to more closely match 'linux-lts' from Arch Linux [core]. - switch to CDN for kernel sources - unify indentation - re-order variables - remove old custom steps
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD312
2 files changed, 162 insertions, 172 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b2f5db3de254..ab4789e54780 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = linux-aarch64-lts
- pkgdesc = The Linux Kernel and modules - AArch64 multi-platform LTS
+ pkgdesc = AArch64 multi-platform LTS Linux
pkgver = 6.1.49
pkgrel = 2
url = https://github.com/lynix/linux-aarch64-lts
@@ -14,19 +14,27 @@ pkgbase = linux-aarch64-lts
makedepends = uboot-tools
makedepends = dtc
options = !strip
- source = https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.1.tar.xz
- source = https://www.kernel.org/pub/linux/kernel/v6.x/patch-6.1.49.xz
+ source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.49.tar.xz
source = 0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
source = 0002-arm64-dts-rockchip-disable-pwm0-on-rk3399-firefly.patch
source = config
- source = linux.preset
- sha256sums = 2ca1f17051a430f6fed1196e4952717507171acfd97d96577212502703b25deb
- sha256sums = 5056dfbf6818ebd6b9c34a3991283f271de4cd76fa322acd45d8a973ae33d34b
+ sha256sums = c9ea14231ca4ca6e3882a9339a8c3c414e4c91519d3e50af6822f47e99057a0f
sha256sums = 013ab7f5bcf2cd486e819fb13fde1f673ac72978984a8befea13938eaf8ddd8e
sha256sums = bcb8a42654df5f9670367950daaa01b165c15618f827d18b7b2a8d53d39227a4
sha256sums = 9677007ecd3bb176af4652ab850082e3390e8b581b4af1e7ac5721449b7aebe2
- sha256sums = 6837b3e2152f142f3fff595c6cbd03423f6e7b8d525aac8ae3eb3b58392bd255
pkgname = linux-aarch64-lts
+ pkgdesc = The AArch64 multi-platform LTS Linux kernel and modules
+ depends = coreutils
+ depends = linux-firmware
+ depends = kmod
+ depends = initramfs
+ optdepends = wireless-regdb: to set the correct wireless channels of your country
+ provides = linux=6.1.49
+ provides = WIREGUARD-MODULE
+ conflicts = linux
pkgname = linux-aarch64-lts-headers
+ pkgdesc = Headers and scripts for building modules for the AArch64 multi-platform LTS Linux kernel
+ provides = linux-headers=6.1.49
+ conflicts = linux-headers
diff --git a/PKGBUILD b/PKGBUILD
index 623e94b5021b..f6b2f4f55898 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,198 +1,180 @@
-# AArch64 multi-platform LTS
-#
# Maintainer: Alexander Koch (lynix) <mail@alexanderkoch.net>
# Based on work by: Kevin Mihelich <kevin@archlinuxarm.org>
buildarch=8
pkgbase=linux-aarch64-lts
-_srcname=linux-6.1
-_kernelname=${pkgbase#linux}
-_desc='AArch64 multi-platform LTS'
-pkgdesc="The Linux Kernel and modules - ${_desc}"
pkgver=6.1.49
pkgrel=2
-arch=('aarch64')
+pkgdesc='AArch64 multi-platform LTS Linux'
url='https://github.com/lynix/linux-aarch64-lts'
-license=('GPL2')
+arch=(aarch64)
+license=(GPL2)
makedepends=(
- 'xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools'
- 'dtc'
+ xmlto docbook-xsl kmod inetutils bc git uboot-tools dtc
)
options=('!strip')
+_srcname=linux-$pkgver
source=(
- "https://www.kernel.org/pub/linux/kernel/v6.x/${_srcname}.tar.xz"
- "https://www.kernel.org/pub/linux/kernel/v6.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'
- 'config' 'linux.preset'
+ https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.xz
+ 0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
+ 0002-arm64-dts-rockchip-disable-pwm0-on-rk3399-firefly.patch
+ config
)
-sha256sums=('2ca1f17051a430f6fed1196e4952717507171acfd97d96577212502703b25deb'
- '5056dfbf6818ebd6b9c34a3991283f271de4cd76fa322acd45d8a973ae33d34b'
+sha256sums=('c9ea14231ca4ca6e3882a9339a8c3c414e4c91519d3e50af6822f47e99057a0f'
'013ab7f5bcf2cd486e819fb13fde1f673ac72978984a8befea13938eaf8ddd8e'
'bcb8a42654df5f9670367950daaa01b165c15618f827d18b7b2a8d53d39227a4'
- '9677007ecd3bb176af4652ab850082e3390e8b581b4af1e7ac5721449b7aebe2'
- '6837b3e2152f142f3fff595c6cbd03423f6e7b8d525aac8ae3eb3b58392bd255')
+ '9677007ecd3bb176af4652ab850082e3390e8b581b4af1e7ac5721449b7aebe2')
prepare() {
- cd $_srcname
-
- echo "Setting version..."
- scripts/setlocalversion --save-scmversion
- echo "-$pkgrel" > localversion.10-pkgrel
- echo "${pkgbase#linux}" > localversion.20-pkgname
-
- # upstream patch
- patch -Nsp1 < ../patch-${pkgver}
-
- local src
- for src in "${source[@]}"; do
- src="${src%%::*}"
- src="${src##*/}"
- [[ $src = *.patch ]] || continue
- echo "Applying patch $src..."
- patch -Nsp1 < "../$src"
- done
-
- echo "Setting config..."
- cp ../config .config
- make olddefconfig
- diff -u ../config .config
-
- make -s kernelrelease > version
- echo "Prepared $pkgbase version $(<version)"
+ 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
+
+ echo "Setting config..."
+ cp ../config .config
+ make olddefconfig
+ diff -u ../config .config
+
+ make -s kernelrelease > version
+ echo "Prepared $pkgbase version $(<version)"
}
build() {
- cd ${_srcname}
+ cd $_srcname
- unset LDFLAGS
- make ${MAKEFLAGS} Image modules
+ unset LDFLAGS
+ make ${MAKEFLAGS} Image modules
- # Generate device tree blobs with symbols to support applying
- # device tree overlays in U-Boot
- make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs
+ # Generate device tree blobs with symbols to support applying
+ # device tree overlays in U-Boot
+ make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs
}
_package() {
- depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
- optdepends=(
- 'wireless-regdb: to set the correct wireless channels of your country'
- )
- provides=("linux=${pkgver}" "WIREGUARD-MODULE")
- conflicts=('linux')
-
- cd $_srcname
- local kernver="$(<version)"
- local modulesdir="$pkgdir/usr/lib/modules/$kernver"
-
- echo "Installing boot image and dtbs..."
- # systemd expects to find the kernel here to allow hibernation
- # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
- install -Dm644 arch/arm64/boot/Image "$modulesdir/vmlinuz"
- make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
-
- # Used by mkinitcpio to name the kernel
- echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
-
- echo "Installing modules..."
- make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
- modules_install
-
- # remove build and source links
- rm "$modulesdir"/{source,build}
+ pkgdesc="The $pkgdesc kernel and modules"
+ depends=(coreutils linux-firmware kmod initramfs)
+ optdepends=('wireless-regdb: to set the correct wireless channels of your country')
+ provides=("linux=${pkgver}" WIREGUARD-MODULE)
+ conflicts=(linux)
+
+ cd $_srcname
+ local kernver="$(<version)"
+ local modulesdir="$pkgdir/usr/lib/modules/$kernver"
+
+ echo "Installing boot image..."
+ # systemd expects to find the kernel here to allow hibernation
+ # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
+ install -Dm644 arch/arm64/boot/Image "$modulesdir/vmlinuz"
+
+ echo "Installing boot dtbs..."
+ make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
+
+ # Used by mkinitcpio to name the kernel
+ echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
+
+ echo "Installing modules..."
+ make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist \
+ modules_install
+
+ # remove build and source links
+ rm "$modulesdir"/{source,build}
}
_package-headers() {
- pkgdesc="Headers and scripts for building modules for the ${_desc} kernel"
- provides=("linux-headers=${pkgver}")
- conflicts=('linux-headers')
-
- cd $_srcname
- local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
-
- 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}
-
- 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
-
- 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)
-
- echo "Adding symlink..."
- mkdir -p "$pkgdir/usr/src"
- ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
+ pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
+ provides=("linux-headers=$pkgver")
+ conflicts=(linux-headers)
+
+ cd $_srcname
+ local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
+
+ 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
+
+ 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
+
+ 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 -Sib "$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)
+
+ 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}() {
- _package${_p#${pkgbase}}
- }"
+pkgname=("$pkgbase" "$pkgbase-headers")
+for _p in "${pkgname[@]}"; do
+ eval "package_$_p() {
+ $(declare -f "_package${_p#$pkgbase}")
+ _package${_p#$pkgbase}
+ }"
done
-# vim:set ts=4:sw=4:et:
+# vim:set ts=8 sts=2 sw=2 et: