# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Henrik Grimler <henrik@grimler.se>

pkgname=device-odroid-u2
pkgdesc="ODROID U2/U3"
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
	 postmarketos-base>=25-r1
	 u-boot-odroid>=2023.04-r1
"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-kernel-lts:kernel_lts
	$pkgname-kernel-exynos4:kernel_exynos4
	$pkgname-nonfree-firmware:nonfree_firmware
"
source="deviceinfo modules-initfs.exynos4 modules-initfs.lts"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

kernel_lts() {
	pkgdesc="Use Alpine's long-term support kernel"
	depends="linux-lts"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_exynos4() {
	pkgdesc="Use linux-postmarketos-exynos4"
	depends="linux-postmarketos-exynos4"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

nonfree_firmware() {
	pkgdesc="Early bootloaders and trustzone firmware (required for a bootable system)"
	depends="firmware-odroid-u2"
	mkdir "$subpkgdir"
}

sha512sums="
62c9de1208c91517821769d21fafb0aada7c1c3a0e4515208c89f82d00e82d36e88ae65a7749a277c696ab413484ee26056b8863ea16add481a9b180fb17c4c2  deviceinfo
bc0c4f7eb77cc3393ac83114fe982b7d2d74725a7a390074ce29bb67b235895487018a407b8ce3593c1fa7e9dbd526199515f7932938c6169a440549eb73dfd3  modules-initfs.exynos4
ba1229a573d863e783a0f945eb825fb77cfd10662d2eacf74c2e20d1e4d118a4fa68200305cd10e1606b489fc8c86e4da7f3305ac6973d3787420eec2bed91b2  modules-initfs.lts
"
