X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Framips%2Fimage%2FMakefile;h=05d979573a0cd62a4ba02b0175ce327c9e4586d2;hb=67402aee494334f23cfbc95e5c7cbb080ddc7bbf;hp=63d622222351afcd3a8e2b9784a5938692da3a8b;hpb=a2a6eb8983b20b4bda52ec7ef042863057e521be;p=openwrt.git diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 63d6222223..05d979573a 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -32,6 +32,7 @@ KERNEL_LOADADDR := $(loadaddr-y) 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) @@ -69,6 +70,51 @@ define Build/relocate-kernel 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 $(BIN_DIR)/$(KERNEL_INITRAMFS_IMAGE) ]; then \ + $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp/' $(BIN_DIR)/$(KERNEL_INITRAMFS_IMAGE); \ + \ + md5sum --binary $(BIN_DIR)/$(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 \ @@ -954,7 +1000,7 @@ endif # ifeq ($(SUBTARGET),mt7621) - TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3 witi wf-2881 zbt-wg2626 + 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 @@ -1023,15 +1069,31 @@ define Device/wf-2881 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 @@ -1040,13 +1102,13 @@ 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