build: split legacy image mkfs.ubifs command from the one used for the new image...
authorFelix Fietkau <nbd@nbd.name>
Tue, 19 Jul 2016 10:35:27 +0000 (12:35 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Jul 2016 08:13:50 +0000 (10:13 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/image-legacy.mk
include/image.mk

index 3acf2b9760fff70108e8f7a245e11d0402822f7c..1b8a9115fc95ade793b83012da4fd1f43c1e08dd 100644 (file)
@@ -1,3 +1,44 @@
+ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),)
+    define Image/mkfs/ubifs/generate
+       $(CP) ./ubinize$(1).cfg $(KDIR)
+       ( cd $(KDIR); \
+               $(STAGING_DIR_HOST)/bin/ubinize \
+               $(if $($(PROFILE)_UBI_OPTS), \
+                       $(shell echo $($(PROFILE)_UBI_OPTS)), \
+                       $(shell echo $(UBI_OPTS)) \
+               ) \
+               -o $(KDIR)/root$(1).ubi \
+               ubinize$(1).cfg \
+       )
+    endef
+
+    define Image/mkfs/ubifs/legacy
+
+        $(if $($(PROFILE)_UBIFS_OPTS)$(UBIFS_OPTS),
+               $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
+                       $(if $($(PROFILE)_UBIFS_OPTS), \
+                               $(shell echo $($(PROFILE)_UBIFS_OPTS)), \
+                               $(shell echo $(UBIFS_OPTS)) \
+                       ) \
+                       $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \
+                       $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \
+                       $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \
+                       $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \
+                       $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \
+                       --squash-uids \
+                       -o $(KDIR)/root.ubifs \
+                       -d $(TARGET_DIR)
+       )
+       $(call Image/Build,ubifs)
+
+        $(if $($(PROFILE)_UBI_OPTS)$(UBI_OPTS),
+               $(if $(wildcard ./ubinize.cfg),$(call Image/mkfs/ubifs/generate,))
+               $(if $(wildcard ./ubinize-overlay.cfg),$(call Image/mkfs/ubifs/generate,-overlay))
+       )
+       $(if $(wildcard ./ubinize.cfg),$(call Image/Build,ubi))
+    endef
+endif
+
 LegacyDevice/Dump = $(Device/Dump)
 
 define LegacyDevice/Check
index 792960bf7989c781c2a9ec4d297af7bcae184562..bb24ba2cf9f5c9dc5e86a26435c0b7ba79e4d5d1 100644 (file)
@@ -201,46 +201,17 @@ ifneq ($(CONFIG_NAND_SUPPORT),)
 
 endif
 
-ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),)
-    define Image/mkfs/ubifs/generate
-       $(CP) ./ubinize$(1).cfg $(KDIR)
-       ( cd $(KDIR); \
-               $(STAGING_DIR_HOST)/bin/ubinize \
-               $(if $($(PROFILE)_UBI_OPTS), \
-                       $(shell echo $($(PROFILE)_UBI_OPTS)), \
-                       $(shell echo $(UBI_OPTS)) \
-               ) \
-               -o $(KDIR)/root$(1).ubi \
-               ubinize$(1).cfg \
-       )
-    endef
-
-    define Image/mkfs/ubifs
-
-        $(if $($(PROFILE)_UBIFS_OPTS)$(UBIFS_OPTS),
-               $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
-                       $(if $($(PROFILE)_UBIFS_OPTS), \
-                               $(shell echo $($(PROFILE)_UBIFS_OPTS)), \
-                               $(shell echo $(UBIFS_OPTS)) \
-                       ) \
-                       $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \
-                       $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \
-                       $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \
-                       $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \
-                       $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \
-                       --squash-uids \
-                       -o $(KDIR)/root.ubifs \
-                       -d $(TARGET_DIR)
-       )
-       $(call Image/Build,ubifs)
-
-        $(if $($(PROFILE)_UBI_OPTS)$(UBI_OPTS),
-               $(if $(wildcard ./ubinize.cfg),$(call Image/mkfs/ubifs/generate,))
-               $(if $(wildcard ./ubinize-overlay.cfg),$(call Image/mkfs/ubifs/generate,-overlay))
-       )
-       $(if $(wildcard ./ubinize.cfg),$(call Image/Build,ubi))
-    endef
-endif
+define Image/mkfs/ubifs
+       $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
+               $(UBIFS_OPTS) \
+               $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \
+               $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \
+               $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \
+               $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \
+               $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \
+               --squash-uids \
+               -o $@ -d $(TARGET_DIR)
+endef
 
 define Image/mkfs/cpiogz
        ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9n >$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
@@ -503,13 +474,13 @@ define BuildImage
   $(foreach device,$(TARGET_DEVICES),$(call Device,$(device)))
   $(foreach device,$(LEGACY_DEVICES),$(call LegacyDevice,$(device)))
 
-  install-images: kernel_prepare $(foreach fs,$(TARGET_FILESYSTEMS) $(fs-subtypes-y),$(KDIR)/root.$(fs))
+  install-images: kernel_prepare $(foreach fs,$(filter-out ubifs,$(TARGET_FILESYSTEMS) $(fs-subtypes-y)),$(KDIR)/root.$(fs))
        $(foreach fs,$(TARGET_FILESYSTEMS),
                $(call Image/Build,$(fs))
        )
-       $(call Image/mkfs/ubifs)
 
   legacy-images-make: install-images
+       $(call Image/mkfs/ubifs/legacy)
        $(MAKE) legacy-images
 
   install: install-images