summaryrefslogtreecommitdiff
path: root/linux-mox/APKBUILD
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2021-09-10 15:11:12 +0200
committerKarel Kočí <cynerd@email.cz>2021-09-10 15:11:39 +0200
commitf80779158d7ac2bcfe0ffa8cf52bec9008edd2eb (patch)
tree78530938325b958baf78e46ddaeedb732261b32b /linux-mox/APKBUILD
parent5f00cd187889eec2339f8aa622099fcf1c03e6d7 (diff)
downloadalpine-personal-pkgs-f80779158d7ac2bcfe0ffa8cf52bec9008edd2eb.tar.gz
alpine-personal-pkgs-f80779158d7ac2bcfe0ffa8cf52bec9008edd2eb.tar.bz2
alpine-personal-pkgs-f80779158d7ac2bcfe0ffa8cf52bec9008edd2eb.zip
linux-mox: add
Diffstat (limited to 'linux-mox/APKBUILD')
-rw-r--r--linux-mox/APKBUILD241
1 files changed, 241 insertions, 0 deletions
diff --git a/linux-mox/APKBUILD b/linux-mox/APKBUILD
new file mode 100644
index 0000000..56886eb
--- /dev/null
+++ b/linux-mox/APKBUILD
@@ -0,0 +1,241 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+
+_flavor=mox
+pkgname=linux-${_flavor}
+provides=linux-lts
+pkgver=5.10.63
+case $pkgver in
+ *.*.*) _kernver=${pkgver%.*};;
+ *.*) _kernver=$pkgver;;
+esac
+pkgrel=0
+pkgdesc="Linux Mox kernel"
+url="https://www.kernel.org"
+depends="mkinitfs"
+_depends_dev="perl gmp-dev elfutils-dev bash flex bison"
+makedepends="$_depends_dev sed installkernel bc linux-headers linux-firmware-any openssl-dev
+ diffutils findutils"
+options="!strip"
+_config=${config:-config-mox.${CARCH}}
+install=
+source="https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
+ 0002-powerpc-config-defang-gcc-check-for-stack-protector-.patch
+
+ 0007-pci-hotplug-declare-IDT-bridge-as-hotpluggabl-bridge.patch
+ 0008-pci-spr2803-quirk-to-fix-class-ID.patch
+ ampere-mt-jade.patch
+
+ config-mox.aarch64
+ "
+subpackages="$pkgname-dev:_dev:$CBUILD_ARCH"
+_flavors=
+for _i in $source; do
+ case $_i in
+ config-*.$CARCH)
+ _f=${_i%.$CARCH}
+ _f=${_f#config-}
+ _flavors="$_flavors ${_f}"
+ if [ "linux-$_f" != "$pkgname" ]; then
+ subpackages="$subpackages linux-${_f}::$CBUILD_ARCH linux-${_f}-dev:_dev:$CBUILD_ARCH"
+ fi
+ ;;
+ esac
+done
+
+if [ "${pkgver%.0}" = "$pkgver" ]; then
+ source="$source
+ https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/patch-$pkgver.xz"
+fi
+arch="aarch64"
+license="GPL-2.0"
+
+_carch=${CARCH}
+case "$_carch" in
+aarch64*) _carch="arm64" ;;
+arm*) _carch="arm" ;;
+mips*) _carch="mips" ;;
+ppc*) _carch="powerpc" ;;
+s390*) _carch="s390" ;;
+esac
+
+# secfixes:
+# 5.10.4-r0:
+# - CVE-2020-29568
+# - CVE-2020-29569
+
+prepare() {
+ local _patch_failed=
+ cd "$srcdir"/linux-$_kernver
+ if [ "$_kernver" != "$pkgver" ]; then
+ msg "Applying patch-$pkgver.xz"
+ unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N
+ fi
+
+ # first apply patches in specified order
+ for i in $source; do
+ case $i in
+ *.patch)
+ msg "Applying $i..."
+ if ! patch -s -p1 -N -i "$srcdir"/$i; then
+ echo $i >>failed
+ _patch_failed=1
+ fi
+ ;;
+ esac
+ done
+
+ if ! [ -z "$_patch_failed" ]; then
+ error "The following patches failed:"
+ cat failed
+ return 1
+ fi
+
+ # remove localversion from patch if any
+ rm -f localversion*
+ oldconfig
+}
+
+oldconfig() {
+ for i in $_flavors; do
+ local _config=config-$i.${CARCH}
+ local _builddir="$srcdir"/build-$i.$CARCH
+ mkdir -p "$_builddir"
+ echo "-$pkgrel-$i" > "$_builddir"/localversion-alpine \
+ || return 1
+
+ cp "$srcdir"/$_config "$_builddir"/.config
+ make -C "$srcdir"/linux-$_kernver \
+ O="$_builddir" \
+ ARCH="$_carch" \
+ listnewconfig oldconfig
+ done
+}
+
+build() {
+ unset LDFLAGS
+ export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
+ for i in $_flavors; do
+ cd "$srcdir"/build-$i.$CARCH
+ make ARCH="$_carch" CC="${CC:-gcc}" \
+ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine"
+ done
+}
+
+_package() {
+ local _buildflavor="$1" _outdir="$2"
+ local _abi_release=${pkgver}-${pkgrel}-${_buildflavor}
+ export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
+
+ cd "$srcdir"/build-$_buildflavor.$CARCH
+ # modules_install seems to regenerate a defect Modules.symvers on s390x. Work
+ # around it by backing it up and restore it after modules_install
+ cp Module.symvers Module.symvers.backup
+
+ mkdir -p "$_outdir"/boot "$_outdir"/lib/modules
+
+ local _install
+ case "$CARCH" in
+ arm*|aarch64) _install="zinstall dtbs_install";;
+ *) _install=install;;
+ esac
+
+ make -j1 modules_install $_install \
+ ARCH="$_carch" \
+ INSTALL_MOD_PATH="$_outdir" \
+ INSTALL_PATH="$_outdir"/boot \
+ INSTALL_DTBS_PATH="$_outdir/boot/dtbs-$_buildflavor"
+
+ cp Module.symvers.backup Module.symvers
+
+ rm -f "$_outdir"/lib/modules/${_abi_release}/build \
+ "$_outdir"/lib/modules/${_abi_release}/source
+ rm -rf "$_outdir"/lib/firmware
+
+ install -D -m644 include/config/kernel.release \
+ "$_outdir"/usr/share/kernel/$_buildflavor/kernel.release
+}
+
+# main flavor installs in $pkgdir
+package() {
+ depends="$depends linux-firmware-any"
+
+ _package mox "$pkgdir"
+}
+
+# subflavors install in $subpkgdir
+virt() {
+ _package virt "$subpkgdir"
+}
+
+_dev() {
+ local _flavor=$(echo $subpkgname | sed -E 's/(^linux-|-dev$)//g')
+ local _abi_release=${pkgver}-${pkgrel}-$_flavor
+ # copy the only the parts that we really need for build 3rd party
+ # kernel modules and install those as /usr/src/linux-headers,
+ # simlar to what ubuntu does
+ #
+ # this way you dont need to install the 300-400 kernel sources to
+ # build a tiny kernel module
+ #
+ pkgdesc="Headers and script for third party modules for $_flavor kernel"
+ depends="$_depends_dev"
+ local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
+ export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
+
+ # first we import config, run prepare to set up for building
+ # external modules, and create the scripts
+ mkdir -p "$dir"
+ cp "$srcdir"/config-$_flavor.${CARCH} "$dir"/.config
+ echo "-$pkgrel-$_flavor" > "$dir"/localversion-alpine
+
+ make -j1 -C "$srcdir"/linux-$_kernver O="$dir" ARCH="$_carch" \
+ syncconfig prepare modules_prepare scripts
+
+ # remove the stuff that points to real sources. we want 3rd party
+ # modules to believe this is the soruces
+ rm "$dir"/Makefile "$dir"/source
+
+ # copy the needed stuff from real sources
+ #
+ # this is taken from ubuntu kernel build script
+ # http://kernel.ubuntu.com/git/ubuntu/ubuntu-zesty.git/tree/debian/rules.d/3-binary-indep.mk
+ cd "$srcdir"/linux-$_kernver
+ 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 "$dir"
+
+ cp -a scripts include "$dir"
+
+ find $(find arch -name include -type d -print) -type f \
+ | cpio -pdm "$dir"
+
+ install -Dm644 "$srcdir"/build-$_flavor.$CARCH/Module.symvers \
+ "$dir"/Module.symvers
+
+ mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
+ ln -sf /usr/src/linux-headers-${_abi_release} \
+ "$subpkgdir"/lib/modules/${_abi_release}/build
+}
+
+sha512sums="
+95bc137d0cf9148da6a9d1f1a878698dc27b40f68e22c597544010a6c591ce1b256f083489d3ff45ff77753289b535135590194d88ef9f007d0ddab3d74de70e linux-5.10.tar.xz
+d19365fe94431008768c96a2c88955652f70b6df6677457ee55ee95246a64fdd2c6fed9b3bef37c29075178294a7fc91f148ead636382530ebfa822be4ad8c2f 0002-powerpc-config-defang-gcc-check-for-stack-protector-.patch
+ca5aafac37e0b5f3fcbaf801e12f98beb58ffaf1d8c88f76caff22b059831869b4094e7fdcb6d6860422d6b2d036e072caff460e1feb84bd04d10740ad56265b 0007-pci-hotplug-declare-IDT-bridge-as-hotpluggabl-bridge.patch
+cbe85cf34e8420c91d2276c2d2aa0ab5023af68e57a1fa613f073f16a76766c67f585eda71c28f232bd0625e0dc8275a9eddc95f49409205dc0dbcc28c9fac1c 0008-pci-spr2803-quirk-to-fix-class-ID.patch
+16b2d5b0255b37075ba894fc797673d633395907ce0b93400c5a8bd05b512b5cd040b91000fa41f9240d42afc664a69206597d1e3f754a1aa64b9be21a67f5c6 ampere-mt-jade.patch
+5f1268611e2b9c42de28e43deb3d17161a57b718e40fad8f321d4b96725703552ead202dabc8123d6eaebb5cd9b1484ca854919911939f56a1a093025f3d3987 config-lts.aarch64
+7921d082235ce1d75c67bfbac1b62a10bb0168e35be6c30127c8b801fb644741c063f75e544ad5ec2c49017a1d4eec1ae4944ccd6fe4098b47f1c7e62f6b4ed0 config-lts.armv7
+e052b250e8cde2b706a0870f912fff69f641ce9c34e80fbcd6c0ef7f553378df4bd9d2b19c80af7a963f05e87e1a8e7ccbde107cc84b0da8d8f920770fb71baa config-lts.x86
+aed0ff4a352aeaf131430e0f9238626dd2fe8bf6d2b43fb1545bdc07e1a0b11b69e72156cf87088119860d1183a80d0c4b8c51afd9ac90c12b33fa323d569b8f config-lts.x86_64
+5090598d92de456ad9f19751662cc6d1b5894ee7fde404f994bbf4ffdbdebd5d9a71d5663f6ebe495356531f60f2ba4097dc250e00f032e6b9f3d2b8bb405e86 config-lts.ppc64le
+a1bd9a425054a02a26e9403ce1414a3cbdb2307f28a66d7c5d2b7426517b8da64c7eac698bf09f697cb44f9114e60833ee22ec040f3426a4d1e4d1a02a82a14c config-lts.s390x
+61d027575ecb9d0f4f248fe78aab0697ec02efb2d06116d5e5c3445719f087cef8886d95117a9d65bff7dbd0f871b94cc8609d3c886a6a05dbecb639bad8c490 config-lts.mips64
+54958bbc5ca4229dc0431b220f6f470900f1a9ca0b80bad4080b9f202ff87c81e9facd4bba3354d84c66cbbc812e0b8ff63ff96f35effeb18acd5328e4ab1fa1 config-virt.aarch64
+5290247832cbd4d959bc9b8c1c4fc4964987c2ff4e8ada7085d23137afde6acfccd8daebe67ce0fbccffa75da74447e6674cd8128de3aa6f4b9dfc1e78e2d325 config-virt.armv7
+8bf0f6b0e19c8c8bc74fb3ed43d985638bf1a94fb420bdb61fcc05d0a88b8cbc158809a22f1955116878e4ec2987d8511f69ee885c625b97dacfc57ecefaabb5 config-virt.ppc64le
+ebb1b701ecc5edd0bb758e7eb4ede03f500d46313052631e0beec22c81b61479b4f6b7474d763c99daea9c94ae33ea55c7e29f92dbe9ab24b7d9a82b6105a9e7 config-virt.x86
+d19b2054aaf636e8ed6ea371242e78ec818dce91a00ccf2ccee007aeab219ffa29804c783310b006079f1066465b6511baa5e800f99cc0fc6108054b3be6fc5f config-virt.x86_64
+742a73defb64dda8a016cbbe05004dd2ec52d9615b5c7a21ec136b4089ce567b5f199cb56f66d5fb2524aa23c1f62ee22e7bef668852edbb946067412c653289 patch-5.10.63.xz
+"