ath79: move small-flash Engenius boards to tiny
[openwrt/staging/stintel.git] / target / linux / ath79 / image / common-engenius.mk
1 DEVICE_VARS += ENGENIUS_IMGNAME
2
3 # This needs to make /tmp/_sys/sysupgrade.tgz an empty file prior to
4 # sysupgrade, as otherwise it will implant the old configuration from
5 # OEM firmware when writing rootfs from factory.bin
6 define Build/engenius-tar-gz
7 -[ -f "$@" ] && \
8 mkdir -p $@.tmp && \
9 touch $@.tmp/failsafe.bin && \
10 echo '#!/bin/sh' > $@.tmp/before-upgrade.sh && \
11 echo ': > /tmp/_sys/sysupgrade.tgz' >> $@.tmp/before-upgrade.sh && \
12 $(CP) $(KDIR)/loader-$(DEVICE_NAME).uImage \
13 $@.tmp/openwrt-$(word 1,$(1))-uImage-lzma.bin && \
14 $(CP) $@ $@.tmp/openwrt-$(word 1,$(1))-root.squashfs && \
15 $(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \
16 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
17 -C $@.tmp . | gzip -9n > $@ && \
18 rm -rf $@.tmp
19 endef
20
21 define Device/engenius_loader_okli
22 DEVICE_VENDOR := EnGenius
23 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49
24 LOADER_TYPE := bin
25 COMPILE := loader-$(1).bin loader-$(1).uImage
26 COMPILE/loader-$(1).bin := loader-okli-compile
27 COMPILE/loader-$(1).uImage := append-loader-okli $(1) | pad-to 64k | lzma | \
28 uImage lzma
29 IMAGES += factory.bin
30 IMAGE/factory.bin := append-squashfs-fakeroot-be | pad-to $$$$(BLOCKSIZE) | \
31 append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
32 check-size | engenius-tar-gz $$$$(ENGENIUS_IMGNAME)
33 endef