# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Ferass El Hafidi <funderscore@postmarketos.org>
pkgname=device-amlogic-tvbox
pkgdesc="Amlogic TV box"
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	postmarketos-base
	soc-amlogic-s905
"
makedepends="devicepkg-dev"
source="
	deviceinfo
	modules-initfs
"
subpackages="
	$pkgname-kernel-p201:kernel_p201
	$pkgname-kernel-p212:kernel_p212
	$pkgname-kernel-videostrong-kii-pro:kernel_videostrong_kii_pro
	$pkgname-kernel-xiaomi-once:kernel_xiaomi_once
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

kernel_p201() {
	pkgdesc="Kernel for Amlogic P201-based TV box (S905)"
	depends="linux-postmarketos-amlogic u-boot-amlogic-s905-tv"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_p212() {
	pkgdesc="Kernel for Amlogic P212-based TV box (S905X)"
	depends="linux-postmarketos-amlogic u-boot-amlogic-s905x-tv"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_videostrong_kii_pro() {
	pkgdesc="Kernel for Videostrong KII Pro (S905)"
	depends="linux-postmarketos-amlogic u-boot-amlogic-s905-tv"
	_pmb_recommends="firmware-videostrong-kii-pro"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_xiaomi_once() {
	pkgdesc="Kernel for Xiaomi Mi Box 3 (S905X)"
	depends="linux-postmarketos-amlogic u-boot-amlogic-s905x-tv"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

sha512sums="
f676256f02dba6e0dcdf3ef763cb96e4a0e6b44ba5cddfb0e675a808d5dd37267abb9086d9fa401d7cb39cf99f7fe63866baacb0d9959b7357cc8824236e3789  deviceinfo
52948c2884a6f6384e12b7a598f70878526d0d3293c214425170145231144ec7de805c038641741a4a5d75b50e554f6a3fa3769784a674217ed032f9b6a233c8  modules-initfs
"
