
maintainer="Duje Mihanović <duje@dujemihanovic.xyz>"
_flavor=samsung-coreprimevelte
pkgname=linux-$_flavor
pkgver=6.18.2
pkgrel=0
pkgdesc="Samsung Galaxy Core Prime VE LTE mainline kernel"
arch="aarch64"
_carch="arm64"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native pmb:kconfigcheck-community"
makedepends="
	bc
	bison
	clang
	dtc
	findutils
	flex
	lld
	llvm
	openssl-dev
	perl
	postmarketos-installkernel
	zstd
"

# Source
_config=config-$_flavor.$arch

case $pkgver in
	*.*.*)	_kernver=${pkgver%.0};;
	*.*)	_kernver=$pkgver;;
esac

source="
	https://cdn.kernel.org/pub/linux/kernel/v${_kernver%%.*}.x/linux-$_kernver.tar.xz
	0001-arm64-dts-samsung-coreprimevelte-add-PMIC.patch
	0002-arm64-dts-samsung-coreprimevelte-add-touchscreen.patch
	0003-arm64-dts-samsung-coreprimevelte-add-SDIO.patch
	0004-arm64-dts-marvell-samsung-coreprimevelte-Add-backlig.patch
	0005-arm64-dts-marvell-samsung-coreprimevelte-Correct-CD-.patch
	0006-arm64-dts-marvell-samsung-coreprimevelte-Enable-eMMC.patch
	0007-arm64-dts-marvell-pxa1908-Add-PWMs.patch
	0008-arm64-dts-marvell-samsung-coreprimevelte-Add-vibrato.patch
	0009-arm64-dts-marvell-pxa1908-Move-ramoops-to-SoC-dtsi.patch
	0010-arm64-dts-marvell-samsung-coreprimevelte-Drop-some-r.patch
	0011-arm64-dts-marvell-samsung-coreprimevelte-Fill-in-mem.patch
	0012-arm64-dts-marvell-samsung-coreprimevelte-Add-USB-con.patch
	0013-arm64-dts-marvell-pxa1908-Add-power-domains.patch
	0014-dmaengine-mmp_pdma-fix-DMA-mask-handling.patch
	0015-dt-bindings-mwifiex-document-use-with-the-SD8777-chi.patch
	0016-net-mwifiex-add-support-for-the-SD8777-chipset.patch
	0017-DONOTMERGE-net-mwifiex-fix-timeouts-with-the-SD8777-.patch
	0018-arm64-dts-samsung-coreprimevelte-add-wifi-node.patch
	0019-Bluetooth-btmrvl_sdio-Add-support-for-SD8777-chipset.patch
	0020-arm64-dts-marvell-samsung-coreprimevelte-Use-memory-.patch
	0021-arm64-dts-marvell-samsung-coreprimevelte-Increase-to.patch
	$_config
"
builddir="$srcdir"/linux-"$_kernver"

prepare() {
	default_prepare
	cp "$srcdir"/$_config "$builddir"/.config
}

build() {
	unset LDFLAGS
	make ARCH="$_carch" LLVM=1 \
		KBUILD_BUILD_VERSION="$((pkgrel + 1 ))"-$_flavor
}

package() {
	make zinstall modules_install dtbs_install \
		ARCH=$_carch \
		LLVM=1 \
		INSTALL_MOD_STRIP=1 \
		INSTALL_PATH="$pkgdir"/boot \
		INSTALL_MOD_PATH="$pkgdir" \
		INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs

	rm -f "$pkgdir"/lib/modules/*/build "$pkgdir"/lib/modules/*/source

	install -D "$builddir"/include/config/kernel.release \
		"$pkgdir"/usr/share/kernel/$_flavor/kernel.release
}

sha512sums="
15989d1a26c6a5200b8eab4ba348b308466398aa75dda3844b37e7eb320206236d47c94cbc0e0b1d7ead10385ca84d34d0f2aa02ba5c1bd65ca6a5aa71c57117  linux-6.18.2.tar.xz
319b165b01814a13efb3c765440d031c1ba3b773434d5523c12d306c5450aa143ca942b15efaa1df7442c7f966c781b09d431acdb06295cf70a8daa90d890d71  0001-arm64-dts-samsung-coreprimevelte-add-PMIC.patch
aa79d55f31fd2d5b8aec2a532a8b792eef07c5f57a7f3dbd5477047b1ce674b9a82ab057248807214383fd6441f08423acbcfe54c9e48aee5a2459afbd29743d  0002-arm64-dts-samsung-coreprimevelte-add-touchscreen.patch
57935ec12875a8c543789f91c5839e8cdeef27bc909f8136e8bad3ab2e48347872916841a2e369140bf99e59bec85bec6b89458e6a98735730253b8df6c038df  0003-arm64-dts-samsung-coreprimevelte-add-SDIO.patch
b7af2099b8ed4fbb1a6644cfbb798e86174802d61b96202e948a5695750f7b2ce9d271e53f8b2a414287fa30bb008a6ec603535ba2854e9fcbbeb3e38eaf3d10  0004-arm64-dts-marvell-samsung-coreprimevelte-Add-backlig.patch
c8e107023208cc105737e3de383895cd8c978feddee321fb32772dad6ae43fa329ccaa2b40e63c6b5542500ecadeb4d11caa86d04c24b605ac2d0625cb49c9e2  0005-arm64-dts-marvell-samsung-coreprimevelte-Correct-CD-.patch
e8e30b5f46c1d017db27edb1cf2812454a30701927957bf8248040c221892b610543792986c937e421430f662d18e2ab06456af0447cba3a8fddd3fe90d59a5f  0006-arm64-dts-marvell-samsung-coreprimevelte-Enable-eMMC.patch
f89c2d44cd5233eac3d157957703585fa60aea96de98e12c3d3eb146108ec321a1bdfec539e9dabdb2fa7cc00dbbfef456182ee546d879864ce1aea10e8ada99  0007-arm64-dts-marvell-pxa1908-Add-PWMs.patch
a02309ca372dcb551c21a8d98e80d8fc35da53b0aa06c09c05d812960aa60f431c473a9cae85a31bf67645da69e160ea9df8cb8a626e7e5a6eea7a59ba82f5a3  0008-arm64-dts-marvell-samsung-coreprimevelte-Add-vibrato.patch
4151f51571fc94db8b2b5d48edfea4ea74d77d23d4a4676e4c2db482a63a70b7493ae3393d4a71bfc0f9941ebb70528dc0a23ae8734e1ceac1900a207e3bea4b  0009-arm64-dts-marvell-pxa1908-Move-ramoops-to-SoC-dtsi.patch
46f17f2a2ee571b6d794a958d532f506e305f26c105a70fe5676d5fdf11823fe0fc364505fe3c9ee3fa5ac86d86032d1874b1c5d704b5c9ffaa47a9e30284f2e  0010-arm64-dts-marvell-samsung-coreprimevelte-Drop-some-r.patch
a7d11b3fe58dd5349ba8307af77df75d3ed7d2a971872251eb8b4bcc3d4c9c80c15224fecac2d0c950da7a39e91a52bbd20c258c9b089c5fbdec6d684a94f21d  0011-arm64-dts-marvell-samsung-coreprimevelte-Fill-in-mem.patch
db58b31fa35ab95d30a0132a419dacac1e35a6b7a7cc2b45d13c9878a74ca489512e67c3b5bf85c95428fbc905b3fcda945bcbf6080008d1760067f3e61f43d0  0012-arm64-dts-marvell-samsung-coreprimevelte-Add-USB-con.patch
662aa29dd8e5d95ad4dbb7ad3c98761f9493d6713378f4b4a449d747241e6d6be63d363b9dd5f6ffc33f814ccd13fbed571f4082d864cf538ae89a1da55df8a1  0013-arm64-dts-marvell-pxa1908-Add-power-domains.patch
61f5d7faef590c1fc87513d777b8fceed6502075589d5a4a49962647e7cdf6f75482bfd2ecdb48c66b8a1372604cd0189a97a1c8a36d05652d1f7c2178ee7597  0014-dmaengine-mmp_pdma-fix-DMA-mask-handling.patch
2393932e4b91cd7ef59a9c1795cc5987e184e7d24199993df1d8d19af470acb1e7c7fd0c05d08fe5b8ad213f521077b7138d1eed8f12c23cab42aa91ef529c57  0015-dt-bindings-mwifiex-document-use-with-the-SD8777-chi.patch
16ffff8c2eebee47db8298841ac5627a7a956711b7308fa8b1e24c97a3c84a596d0c8ef279d3c2d5e0a028859b4b10fc2fa3bf9b19609df92e3355ad5accbc70  0016-net-mwifiex-add-support-for-the-SD8777-chipset.patch
0ccd19306ba8555673a85a491ee12bc5ed3d43ad1aa4548dbdfd58ea9b4ba81ff294f4cda4daabc5d7f0064e389b6b32d34c1e2a84c69b5241ae923baa2e643d  0017-DONOTMERGE-net-mwifiex-fix-timeouts-with-the-SD8777-.patch
d93d9a3ad2c02b9df69dc5291cd1f038a35aa2af2156f2d0c79e43a7b24e9e97dbf183421a9a448df54d35144cb827115246617ad3e95b9a5589c528ba320630  0018-arm64-dts-samsung-coreprimevelte-add-wifi-node.patch
b03f0cbbc5ec4d2bfeb1d021c5e91cc55c6d8742043e8e0e9754ec160571eb2ffc83f9811efa0c459dade1854b3fe51f7cb21ab3001a53e5db7651171ed784a5  0019-Bluetooth-btmrvl_sdio-Add-support-for-SD8777-chipset.patch
560b45049530c5453dc7f51a2632fa390e9f7380ee142f17a311eb806d3a7275e7b8e6de7b5f956a76ea2e99210841098b83320e3db808d9f0aa2de7c1ada8e7  0020-arm64-dts-marvell-samsung-coreprimevelte-Use-memory-.patch
95a6f5d31df6869dd36eb7397339ccecc1b40456159932071a19d76551de528970765230de09b733a4a51d4b6d501c3d77c20b1d052846626b624d5e079170b2  0021-arm64-dts-marvell-samsung-coreprimevelte-Increase-to.patch
3fd69d4c87d72a472bc05669864d50b8c9fe5816e98faace31fc63b55c118eff8c30594e5e10c65b6f6e38ff99305dd3bf6e5fcfa91d3a6a08ba5e9e12e0b98d  config-samsung-coreprimevelte.aarch64
"
