Author: blogic
Date: 2016-04-09 12:24:29 +0200 (Sat, 09 Apr 2016)
New Revision: 49123

Modified:
   trunk/target/linux/ramips/image/mt7621.mk
Log:
ramips: mt7621: fix initramfs image for ubnt-erx

Signed-off-by: Roman Yeryomin <[email protected]>

Modified: trunk/target/linux/ramips/image/mt7621.mk
===================================================================
--- trunk/target/linux/ramips/image/mt7621.mk   2016-04-09 09:59:21 UTC (rev 
49122)
+++ trunk/target/linux/ramips/image/mt7621.mk   2016-04-09 10:24:29 UTC (rev 
49123)
@@ -11,51 +11,28 @@
        $(call Build/seama,-s [email protected] $(1))
 endef
 
-define Build/ubnt-erx-factory-compat
-       echo '21001:6' > [email protected]
-       $(TAR) -cf $@ --transform='s/^.*/compat/' [email protected]
-       $(RM) [email protected]
-endef
-
-define Build/ubnt-erx-factory-kernel
+define Build/ubnt-erx-factory-image
        if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) ]; then \
-               $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp/' 
$(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \
+               echo '21001:6' > $(1).compat; \
+               $(TAR) -cf $(1) --transform='s/^.*/compat/' $(1).compat; \
                \
-               md5sum --binary $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) | awk 
'{print $$1}'> [email protected]; \
-               $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp.md5/' [email protected]; \
-               $(RM) [email protected]; \
+               $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp/' 
$(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \
+               md5sum --binary $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) | awk 
'{print $$1}'> $(1).md5; \
+               $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp.md5/' $(1).md5; \
+               \
+               echo "dummy" > $(1).rootfs; \
+               $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp/' $(1).rootfs; \
+               \
+               md5sum --binary $(1).rootfs | awk '{print $$1}'> $(1).md5; \
+               $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp.md5/' $(1).md5; 
\
+               \
+               echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > 
$(1).version; \
+               $(TAR) -rf $(1) --transform='s/^.*/version.tmp/' $(1).version; \
+               \
+               $(CP) $(1) $(BIN_DIR)/; \
        fi
 endef
 
-define Build/ubnt-erx-factory-rootfs
-       echo "dummy" > [email protected]
-       $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp/' [email protected]
-
-       md5sum --binary [email protected] | awk '{print $$1}'> [email protected]
-       $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp.md5/' [email protected]
-       $(RM) [email protected]
-       $(RM) [email protected]
-endef
-
-define Build/ubnt-erx-factory-version
-       echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > [email protected]
-       $(TAR) -rf $@ --transform='s/^.*/version.tmp/' [email protected]
-       $(RM) [email protected]
-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
-
 ifeq ($(SUBTARGET),mt7621)
   TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 
sap-g3200u3 ubnt-erx witi wf-2881 zbt-wg2626
 endif
@@ -134,12 +111,9 @@
   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)
+  IMAGES := sysupgrade.tar
+  KERNEL_INITRAMFS := $$(KERNEL) | check-size $$(KERNEL_SIZE) | \
+                       ubnt-erx-factory-image 
$(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar
   IMAGE/sysupgrade.tar := sysupgrade-nand
 endef
 
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to