$(call Image/Build/Profile/$(PROFILE),initramfs)
endef
-DEVICE_VARS += DTS
+DEVICE_VARS += DTS IMAGE_SIZE
loadaddr-y := 0x80000000
loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
KERNEL_DTB = kernel-bin | patch-dtb | lzma
define Device/Default
+ KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts)
KERNEL := $(KERNEL_DTB) | uImage lzma
IMAGES := sysupgrade.bin
IMAGE_SIZE := $(ralink_default_fw_size_8M)
endef
define Build/patch-dtb
- $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $@.dtb ../dts/$(DTS).dts
+ $(call Image/BuildDTB,../dts/$(DTS).dts,$@.dtb)
$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
endef
mv $@.new $@
endef
+define Build/ubnt-erx-factory-compat
+ echo '21001:6' > $@.compat
+ $(TAR) -cf $@ --transform='s/^.*/compat/' $@.compat
+ $(RM) $@.compat
+endef
+
+define Build/ubnt-erx-factory-kernel
+ if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) ]; then \
+ $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp/' $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \
+ \
+ md5sum --binary $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) | awk '{print $$1}'> $@.md5; \
+ $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp.md5/' $@.md5; \
+ $(RM) $@.md5; \
+ fi
+endef
+
+define Build/ubnt-erx-factory-rootfs
+ echo "dummy" > $@.rootfs
+ $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp/' $@.rootfs
+
+ md5sum --binary $@.rootfs | awk '{print $$1}'> $@.md5
+ $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp.md5/' $@.md5
+ $(RM) $@.md5
+ $(RM) $@.rootfs
+endef
+
+define Build/ubnt-erx-factory-version
+ echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $@.version
+ $(TAR) -rf $@ --transform='s/^.*/version.tmp/' $@.version
+ $(RM) $@.version
+endef
+
+#We need kernel+initrams fit into kernel partition
+define Build/ubnt-erx-factory-check-size
+ @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$($(TAR) -xf $@ vmlinux.tmp -O | wc -c)" ] || { \
+ echo "WARNING: Initramfs kernel for image $@ is too big (kernel size: $$($(TAR) -xf $@ vmlinux.tmp -O | wc -c), max size $(1))" >&2; \
+ $(RM) -f $@; \
+ }
+
+ @[ "$$($(TAR) -xf $@ vmlinux.tmp -O | wc -c)" -gt 0 ] || { \
+ echo "WARNING: Kernel for image $@ not found" >&2; \
+ $(RM) -f $@; \
+ }
+endef
+
define MkCombineduImage
$(call PatchKernelLzma,$(2),$(3))
if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 64` ]; then \
define MkImageTpl/squashfs
$(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
- $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -j \
+ -$(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -j \
-o $(KDIR)/$(output_name) \
-k $(KDIR)/vmlinux-$(1)$(4).bin.lzma \
- -r $(KDIR)/root.$(1)
- $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
+ -r $(KDIR)/root.$(1) && \
+ $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
endef
define MkImageTpl/initramfs
$(eval output_name=$(IMG_PREFIX)-$(2)-$(1).bin)
- $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -c \
+ -$(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -c \
-o $(KDIR)/$(output_name) \
- -k $(KDIR)/vmlinux-$(1).bin.lzma
- $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
+ -k $(KDIR)/vmlinux-$(1).bin.lzma && \
+ $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
endef
# $(1), lowercase board name like "mt7620a_v22sg"
$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
mkhilinkfw -e -i$(call imgname,$(1),$(2))-uImage.bin -o $(call imgname,$(1),$(2))-factory.bin;
endef
-Image/Build/Profile/HLKRM04=$(call BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM02)
+Image/Build/Profile/HLKRM04=$(call BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM04)
Image/Build/Profile/HT-TM02=$(call BuildFirmware/Default8M/$(1),$(1),ht-tm02,HT-TM02)
$(call Image/Build/Profile/3G6200NL,$(1))
$(call Image/Build/Profile/3G150B,$(1))
$(call Image/Build/Profile/3G300M,$(1))
- $(call Image/Build/Profile/A5-11,$(1))
+ $(call Image/Build/Profile/A5-V11,$(1))
$(call Image/Build/Profile/AIR3GII,$(1))
$(call Image/Build/Profile/ALL02393G,$(1))
$(call Image/Build/Profile/ALL0256N,$(1))
#
Image/Build/Profile/E1700=$(call BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
+Image/Build/Profile/EX2700=$(call BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
Image/Build/Profile/MT7620a=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
Image/Build/Profile/MT7620a_MT7610e=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
Image/Build/Profile/MT7620a_MT7530=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
ifeq ($(SUBTARGET),mt7620)
define Image/Build/Profile/Default
$(call Image/Build/Profile/E1700,$(1))
+ $(call Image/Build/Profile/EX2700,$(1))
$(call Image/Build/Profile/MT7620a,$(1))
$(call Image/Build/Profile/MT7620a_MT7610e,$(1))
$(call Image/Build/Profile/MT7620a_MT7530,$(1))
#
ifeq ($(SUBTARGET),mt7621)
- TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3 zbt-wg2626 wf-2881
+ TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3 ubnt-erx witi wf-2881 zbt-wg2626
endif
define Device/mt7621
define Device/wsr-600
DTS := WSR-600
+ IMAGE_SIZE := $(ralink_default_fw_size_16M)
endef
define Device/re6500
define Device/wsr-1166
DTS := WSR-1166
IMAGE/sysupgrade.bin := trx | pad-rootfs
+ IMAGE_SIZE := $(ralink_default_fw_size_16M)
endef
define Device/dir-860l-b1
IMAGE/factory.bin := \
append-kernel | pad-offset 65536 64 | append-rootfs | pad-rootfs -x 64 | \
seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
- check-size $$$$(IMAGE_SIZE) | \
- seama-seal -m "signature=wrgac13_dlink.2013gui_dir860lb"
+ seama-seal -m "signature=wrgac13_dlink.2013gui_dir860lb" | \
+ check-size $$$$(IMAGE_SIZE)
endef
define Device/firewrt
DTS := SAP-G3200U3
endef
+define Device/witi
+ DTS := WITI
+ IMAGE_SIZE := $(ralink_default_fw_size_16M)
+endef
+
define Device/zbt-wg2626
DTS := ZBT-WG2626
IMAGE_SIZE := $(ralink_default_fw_size_16M)
IMAGE/sysupgrade.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
endef
+define Device/ubnt-erx
+ DTS := UBNT-ERX
+ FILESYSTEMS := squashfs
+ KERNEL_SIZE := 3145728
+ KERNEL := $(KERNEL_DTB) | uImage lzma
+ IMAGES := sysupgrade.tar $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),factory-initramfs.tar)
+ IMAGE/factory-initramfs.tar := ubnt-erx-factory-compat | \
+ ubnt-erx-factory-kernel | \
+ ubnt-erx-factory-rootfs | \
+ ubnt-erx-factory-version | \
+ ubnt-erx-factory-check-size $$(KERNEL_SIZE)
+ IMAGE/sysupgrade.tar := sysupgrade-nand
+endef
+
#
# MT7628 Profiles
#
Image/Build/Profile/MT7628=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
+Image/Build/Profile/WRTNODE2P=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode2p,WRTNODE2P)
ifeq ($(SUBTARGET),mt7628)
define Image/Build/Profile/Default
$(call Image/Build/Profile/MT7628,$(1))
+ $(call Image/Build/Profile/WRTNODE2P,$(1))
endef
endif
# MT7688 Profiles
#
-Image/Build/Profile/mt7688=$(call BuildFirmware/Default16M/$(1),$(1),mt7688,MT7688)
Image/Build/Profile/LinkIt7688=$(call BuildFirmware/Default32M/$(1),$(1),LinkIt7688,LINKIT7688)
+Image/Build/Profile/WRTNODE2R=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode2r,WRTNODE2R)
ifeq ($(SUBTARGET),mt7688)
define Image/Build/Profile/Default
- $(call Image/Build/Profile/mt7688,$(1))
$(call Image/Build/Profile/LinkIt7688,$(1))
+ $(call Image/Build/Profile/WRTNODE2R,$(1))
endef
endif