[source] image: add wrapper variable to get the target dir for mkfs commands

LEDE Commits lede-commits at lists.infradead.org
Fri Jul 29 04:38:01 PDT 2016


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=c5ca181d12a18ecaff5d89e56a79226bec31f2c0

commit c5ca181d12a18ecaff5d89e56a79226bec31f2c0
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Jul 22 10:53:12 2016 +0200

    image: add wrapper variable to get the target dir for mkfs commands
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/image.mk | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 812d515..2ed089d 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -20,6 +20,8 @@ param_get = $(patsubst $(1)=%,%,$(filter $(1)=%,$(2)))
 param_mangle = $(subst $(space),_,$(strip $(1)))
 param_unmangle = $(subst _,$(space),$(1))
 
+mkfs_target_dir = $(TARGET_DIR)
+
 KDIR=$(KERNEL_BUILD_DIR)
 KDIR_TMP=$(KDIR)/tmp
 DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts
@@ -149,18 +151,18 @@ define Image/mkfs/jffs2/sub-raw
 	$(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
 		$(2) \
 		-e $(patsubst %k,%KiB,$(1)) \
-		-o $@ -d $(TARGET_DIR) \
+		-o $@ -d $(call mkfs_target_dir,$(3)) \
 		-v 2>&1 1>/dev/null | awk '/^.+$$$$/'
 endef
 
 define Image/mkfs/jffs2/sub
-	$(call Image/mkfs/jffs2/sub-raw,$(1),--pad $(2))
+	$(call Image/mkfs/jffs2/sub-raw,$(1),--pad $(2),$(3))
 	$(call add_jffs2_mark,$@)
 endef
 
 define Image/mkfs/jffs2/template
-  Image/mkfs/jffs2-$(1) = $$(call Image/mkfs/jffs2/sub,$(1),$(JFFS2OPTS))
-  Image/mkfs/jffs2-$(1)-raw = $$(call Image/mkfs/jffs2/sub-raw,$(1),$(JFFS2OPTS))
+  Image/mkfs/jffs2-$(1) = $$(call Image/mkfs/jffs2/sub,$(1),$(JFFS2OPTS),$$(1))
+  Image/mkfs/jffs2-$(1)-raw = $$(call Image/mkfs/jffs2/sub-raw,$(1),$(JFFS2OPTS),$$(1))
 
 endef
 
@@ -168,7 +170,7 @@ define Image/mkfs/jffs2-nand/template
   Image/mkfs/jffs2-nand-$(1) = \
 	$$(call Image/mkfs/jffs2/sub, \
 		$(word 2,$(subst -, ,$(1))), \
-			$(JFFS2OPTS) --no-cleanmarkers --pagesize=$(word 1,$(subst -, ,$(1))))
+			$(JFFS2OPTS) --no-cleanmarkers --pagesize=$(word 1,$(subst -, ,$(1))),$$(1))
 
 endef
 
@@ -176,7 +178,7 @@ $(eval $(foreach S,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/template,$(S))))
 $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))))
 
 define Image/mkfs/squashfs
-	$(STAGING_DIR_HOST)/bin/mksquashfs4 $(TARGET_DIR) $@ \
+	$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
 		-nopad -noappend -root-owned \
 		-comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
 		-processors $(if $(CONFIG_PKG_BUILD_JOBS),$(CONFIG_PKG_BUILD_JOBS),1) \
@@ -220,7 +222,7 @@ define Image/mkfs/ubifs
 		$(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)
+		-o $@ -d $(call mkfs_target_dir,$(1))
 endef
 
 E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024)))
@@ -232,7 +234,7 @@ define Image/mkfs/ext4
 		-m $(CONFIG_TARGET_EXT4_RESERVED_PCT) \
 		$(if $(CONFIG_TARGET_EXT4_JOURNAL),,-J) \
 		$(if $(SOURCE_DATE_EPOCH),-T $(SOURCE_DATE_EPOCH)) \
-		$@ $(TARGET_DIR)/
+		$@ $(call mkfs_target_dir,$(1))/
 endef
 
 define Image/mkfs/prepare/default



More information about the lede-commits mailing list