MEDIA_TYPE = u-boot binaries

TARGET = u-boot-binaries
EXTRANAME = $(MEDIUM)/

.PHONY: u-boot-binaries
u-boot-binaries:
	mkdir -p $(SOME_DEST)/$(EXTRANAME)/
	for target in a64-olinuxino nanopi_neo2 orangepi_zero_plus2 pine64_plus pinebook teres_i ; do \
		echo "Providing u-boot binaries for $$target ..." ; \
		gen-hd-image -v -b firmware -o $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		TARGET=/usr/lib/u-boot/$${target} u-boot-install-sunxi $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		gzip -9nf $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		update-manifest "$(SOME_DEST)/$(EXTRANAME)/$${target}.gz" "u-boot image for $${target}"	; \
	done
	for target in firefly-rk3399 pinebook-pro-rk3399 rockpro64-rk3399 rock64-rk3328 rock-pi-4-rk3399 ; do \
		echo "Providing u-boot binaries for $$target ..." ; \
		gen-hd-image -v -p 32768 -b firmware -o $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		TARGET=/usr/lib/u-boot/$${target} u-boot-install-rockchip $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		gzip -9nf $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		update-manifest "$(SOME_DEST)/$(EXTRANAME)/$${target}.gz" "u-boot image for $${target}"	; \
	done
	for target in puma-rk3399 ; do \
		echo "Providing u-boot binaries for $$target ..." ; \
		gen-hd-image -v -p 32768 -b firmware -o $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		TARGET=/usr/lib/u-boot/$${target} UBOOT_OFFSET=512 u-boot-install-rockchip $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		gzip -9nf $(SOME_DEST)/$(EXTRANAME)/$${target}.img ; \
		update-manifest "$(SOME_DEST)/$(EXTRANAME)/$${target}.gz" "u-boot image for $${target}"	; \
	done
