pkgname=firmware-xiaomi-wt86047-modem
pkgver=20161223
pkgrel=0
pkgdesc="Xiaomi Redmi 2 (wt86047) modem firmware"
url="https://androidfilehost.com/?w=files&flid=303434"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck !tracedeps pmb:cross-native"
makedepends="mtools"
source="https://archive.org/download/lineage-15.1-20200223-nightly-wt88047-signed_202004/wt86047-firmware_20161223.zip"

_fwdir="/lib/firmware/postmarketos"

unpack() {
	default_unpack

	# Extract firmware files from FAT file system image
	mcopy -i firmware-update/NON-HLOS.bin -p -m -v \
		::image/mba.mbn ::image/modem.* "$srcdir"
}

package() {
	install -Dm644 "$srcdir"/mba.mbn -t "$pkgdir/$_fwdir"
	install -Dm644 "$srcdir"/modem.* -t "$pkgdir/$_fwdir"
}

sha512sums="7960acd95e296c41c82a3c3f7a6733ddeac31c484f812d57ce7a2cf5f811721f099fe57af45bae217d543f57930f4329d5613eac45fd0fc867f24273106181db  wt86047-firmware_20161223.zip"
