# Contributor: Natanael Copa # Contributor: Alex Denes # Maintainer: Alex Denes pkgname=linux majorver=6 minorver=4 patchver=6 _configs=" config-full.x86_64 config-slim.x86_64 config-rockpro64.aarch64 config-bananapi_m2b.armhf config-bananapi_m2z.armhf " # https://github.com/Scrumplex/community-patches/raw/503b977cfe18f0ba367f4dd559f3529ef4834b15/linux61-tkg/cap_sys_nice_begone.mypatch _patches=" cap_sys_nice_begone.patch " pkgver="$majorver.$minorver" pkgrel=0 if [ "$patchver" != 0 ]; then _patches=" $_patches linux-$majorver.$minorver.$patchver.patch.xz::https://cdn.kernel.org/pub/linux/kernel/v$majorver.x/patch-$majorver.$minorver.$patchver.xz " pkgver="$pkgver.$patchver" fi _kbdir="linux-$majorver.$minorver" source=" https://cdn.kernel.org/pub/linux/kernel/v$majorver.x/linux-$majorver.$minorver.tar.gz $_patches $_configs " _kabi= _klocalver= _kconfig= _kbdmain= _kbddev= _kflavour= _kdir_src="$srcdir/$_kbdir" arch="noarch" _depends_dev=" perl gmp-dev mpc1-dev mpfr-dev elfutils-dev bash flex bison zstd " makedepends=" $_depends_dev sed installkernel bc linux-headers=$pkgver-r$pkgrel linux-firmware-any openssl-dev>3 mawk diffutils findutils zstd pahole python3 " pkgdesc="Linux Kernel - Metapackage" url="https://www.kernel.org" license="GPL-2.0" options="!strip" builddir="$_kdir_src" _carch=${CARCH} # abuild to kernel arch mapping case "$_carch" in aarch64*) _carch="arm64" ;; arm*) _carch="arm" ;; mips*) _carch="mips" ;; ppc*) _carch="powerpc" ;; s390*) _carch="s390" ;; esac _archflavors() { for i in $_configs; do local _nocfg="${i#config-}" local _arch="${_nocfg#*.}" local _flavour="${_nocfg%.*}" [ "$_arch" == "$CARCH" ] && echo "$_flavour" done } _bvars() { _kconfig="config-$_kflavour.$CARCH" _kdir_main="$srcdir/build-$_kflavour.$CARCH" _kdir_dev="$srcdir/build-$_kflavour-dev.$CARCH" _ksaf="$_kflavour" _kabi="$pkgver-$pkgrel-$_ksaf" _klocalver="-$pkgrel-$_ksaf" } _spvars() { _kflavour="$(echo $subpkgname | cut -d- -f2)" } for _kflavour in $(_archflavors); do _bvars subpackages=" $subpackages $pkgname-$_ksaf:_pkg_kernel:$CBUILD_ARCH $pkgname-$_ksaf-dev:_pkg_extmod:$CBUILD_ARCH " done export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" prepare() { default_prepare for _kflavour in $(_archflavors); do _bvars for _kbuilddir in "$_kdir_main" "$_kdir_dev"; do mkdir -p "$_kbuilddir" echo "$_klocalver" > "$_kbuilddir"/localversion-alpine \ || return 1 cp "$srcdir"/"$_kconfig" "$_kbuilddir"/.config make -C "$_kdir_src" \ O="$_kbuilddir" \ ARCH="$_carch" \ olddefconfig done done } build() { unset LDFLAGS for _kflavour in $(_archflavors); do _bvars # Build kernel and modules msg "Building $_kflavour for $CARCH" cd "$_kdir_main" make \ ARCH="$_carch" \ CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" # Build out-of-tree builder msg "Building $_kflavour-dev for $CARCH" cd "$_kdir_dev" make syncconfig \ ARCH="$_carch" make prepare \ ARCH="$_carch" make modules_prepare \ ARCH="$_carch" make scripts \ ARCH="$_carch" done } package() { mkdir -p "$pkgdir" } _pkg_kernel() { _spvars _bvars local _install= case "$CARCH" in arm*|aarch64) _install="zinstall dtbs_install";; *) _install=install;; esac local _outdir="$subpkgdir" mkdir -p "$_outdir"/boot "$_outdir"/lib/modules cd "$_kdir_main" # Install modules make modules_install \ ARCH="$_carch" \ INSTALL_MOD_PATH="$_outdir" # Install kernel make $_install \ ARCH="$_carch" \ INSTALL_PATH="$_outdir"/boot \ INSTALL_DTBS_PATH="$_outdir/boot/dtbs-$_ksaf" # Remove incorrect build-time symlinks rm -f "$_outdir"/lib/modules/"$_kabi"/build \ "$_outdir"/lib/modules/"$_kabi"/source rm -rf "$_outdir"/lib/firmware # Install release file install -D -m644 include/config/kernel.release \ "$_outdir"/usr/share/kernel/"$_kflavour"/kernel.release } _pkg_extmod() { _spvars _bvars depends="$_depends_dev" local _outdir="$subpkgdir/usr/src/linux-headers-$_kabi" _builddir="$subpkgdir/lib/modules/$_kabi" mkdir -p "$_outdir" cd "$_kdir_dev" msg "Copying kernel out-of-tree build files" rm Makefile source cp -a . "$_outdir" cd "$_kdir_src" msg "Copying kernel out-of-tree build tree" cp -a scripts include "$_outdir" find . \ -path './include/*' -prune -o \ -path './scripts/*' -prune -o \ -type f \( \ -name 'Makefile*' -o \ -name 'Kconfig*' -o \ -name 'Kbuild*' -o \ -name '*.sh' -o \ -name '*.pl' -o \ -name '*.lds' -o \ -name 'Platform' \ \) -print | \ cpio -pdm "$_outdir" find ./arch \ -path './arch/*/include/*' \ -type f -print | \ cpio -pdm "$_outdir" mkdir -p "$_builddir" ln -sf "/usr/src/linux-headers-$_kabi" "$_builddir"/build } sha512sums=" 83a20d86306e91df48a65b30f7b0a608aa9e6a3bd023f2c680c749af0027d58a851775ff01bf3877098aac7375b70ec75ef37054b3094babb697d3f8a5e10035 linux-6.4.tar.gz 5850732523a33e9b71f2a969b011033708343c4a4e4a62477b00224d676bf9e5d6b82f55105e8461be8529354ae53495e06e6a568af1cdafa98ad26341bb89d5 cap_sys_nice_begone.patch a5b87b55edce088db14924978acd88fae4150ce9a061f3ba7491e7d3b0fc0b263dcd88792a1ada01ea7cf53f707221ea29745a19bdc6e6b7888dac2e8bb26507 linux-6.4.6.patch.xz fcff404de4f54f483a53ecd81c9f9cd3e42c837dcfda1b6bb426298f33075378b562087fc97833fe7804dcd28edfd0e5c54d9d4c244013364f9d1f9bd3b59616 config-full.x86_64 32d1da2d0d42e585294bf1e7a701229a249d51e505cced5aeb7818ce4865cb4402f5cc0b084b77630dab5e87ef19dce01bb0533e28f11f0df888befba54c1b0d config-slim.x86_64 9e3cfc61a6627a2c8a37f33d4231b77c594fa41da14eace23f1518eb0024404e70b737a096a9ee9c96139cd3dcd7dcb0571f95ca7636296a6ef5f91af53d7053 config-rockpro64.aarch64 e258b4bbd5a83dbfd070f8011e79fccd025957265f84a69819ced6bda7055f9db55a768ec6bbdc67742e569ee8df21b8d964e137e11a91ec24638fb9cd486f13 config-bananapi_m2b.armhf e31dd09657439310f0588fcb93215534b6aa5710522f3e06ec8d3e62d9c4bd1544b4bc9e00d2c91c7345aad77e1318e8f11ad1fee030d08c06d6b9dbebecd5ff config-bananapi_m2z.armhf "