# Maintainer: m0rf30 <morf3089@gmail.com>
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/vince_defconfig

pkgname=linux-xiaomi-vince
pkgver=4.9.267
pkgrel=1
pkgdesc="Xiaomi Redmi Note 5 Plus kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-vince"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="bash bc bison devicepkg-dev flex openssl-dev perl sed"

# Source
_repository="kernel_xiaomi_vince"
_commit="1168c9c785b4995f08cc1eff89eec5ce286d2258"
_config="config-$_flavor.$arch"
source="$pkgname-$_commit.tar.gz::https://github.com/M0Rf30/$_repository/archive/$_commit.tar.gz
	$_config
	"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"

prepare() {
	default_prepare
	REPLACE_GCCH=0 \
		. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS"
}

package() {
	downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
}

sha512sums="
43544ac76a3f4a325ea4d7760d60e12375ccfaf6e6865f331d785b7482241a2ba5e78334a071e9471b83cbecdc50d5717eeef8baa4bf714674cd8b36c7569e5a  linux-xiaomi-vince-1168c9c785b4995f08cc1eff89eec5ce286d2258.tar.gz
479fb6d64a6bf759cef502d911c2be76fb449417dfcd9bbc0ef76ce9f514b6310110b798e029f715359871afabe403576b99a28646ac5e6cfcfb7cabe052b3cb  config-xiaomi-vince.aarch64
"
