# Archived: Downstream port, only for testing. Use mainline port!
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/sturgeon_defconfig

pkgname=linux-huawei-sturgeon-downstream
pkgver=3.10.40
pkgrel=0
pkgdesc="Huawei Watch kernel fork"
arch="armv7"
_carch="arm"
_flavor="huawei-sturgeon"
url="https://android.googlesource.com/kernel/msm/+/refs/heads/android-msm-sturgeon-3.10-marshmallow-dr1-wear-release/"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
	bash
	bc
	bison
	devicepkg-dev
	flex
	linux-headers
	openssl-dev
	perl
"

# Source
_repository="android-kernel-msm-sturgeon"
_commit="97abcf5b24684a46530ffc8a4748dd7ae6c2e65a"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/timbz/$_repository/archive/$_commit.tar.gz
	$_config
	gcc7-give-up-on-ilog2-const-optimizations.patch
	gcc8-fix-put-user.patch
	gcc10-extern_YYLOC_global_declaration.patch
	kernel-use-the-gnu89-standard-explicitly.patch
	linux3.4-ARM-8933-1-replace-Sun-Solaris-style-flag-on-section.patch
	linux3.4-fix-piggy.gzip.S.patch
	0001-mmc-card-not-access-RPMB-partition-for-normal-read-and-write.patch
	0002-msm-mdss-fix-fb-memory-allocation.patch
"

builddir="$srcdir/$_repository-$_commit"
_outdir="out"

prepare() {
	default_prepare
	. 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="
515ae0ddd89251b234368c1082332e216051d528ba7164267c943b5b5b077620fe50aceabc28d0c151fc31804a1c532c38c1289e67bcd87d4a07c5cd9e9729f5  linux-huawei-sturgeon-downstream-97abcf5b24684a46530ffc8a4748dd7ae6c2e65a.tar.gz
a3847fe930298714f3eef645ec5c828842d40abf8b84ce7bc2c41bc9729c4bfe2dda3b0357fdf3b18896319b3eeee5b9e5a79dc796e331c4b81e9063b413b929  config-huawei-sturgeon.armv7
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7  gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967  gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb  gcc10-extern_YYLOC_global_declaration.patch
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c  kernel-use-the-gnu89-standard-explicitly.patch
9e3b067fa1b19ad02500c4fce1b6142051df3845c508e615788beb650c4f953683107ac2d80670c4e3df38f532e0e91060d2d13ec04c9ec985abd2dfa82e900b  linux3.4-ARM-8933-1-replace-Sun-Solaris-style-flag-on-section.patch
080745ca4ecaa804ee1df26ea81975ca93b74372e0c08322a6c481e97807495ae6ceb6cc77653afa24f9f2df45da8ebf8e5de6b06037fbb08e0279877ce42188  linux3.4-fix-piggy.gzip.S.patch
ed1c144529612e7e5320a00979095431135bd3a65271ca76b8b6ceecb26db11d11899a9104695387ffea64cc618f72c79d3caa41481fa11a8bd9b54fdf6fd1d7  0001-mmc-card-not-access-RPMB-partition-for-normal-read-and-write.patch
88443774add9efe2c3278da0e8e75710dbc93fcf2930d07d00346f86860278e2cfe9e9cba1192e9bafda4e0df604e63efbfe2f6242ebe67d08f2c7ce4991532c  0002-msm-mdss-fix-fb-memory-allocation.patch
"
