Skip to contentSkip to conversation

Add support for Flattened Image Trees

PATCH Superseded Yegor Yefremov 3 participants 13 messages Sep 17, 2014 – Sep 19, 2014 VFS

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

This patch provides an option to specify a FIT source file (*.its), that will usually be stored in a board directory, and the resulting blob file name (*.itb).

---
Changes:
v2: moved configuration to fs infra instead of linux

 fs/Config.in     |  1 +
 fs/fit/Config.in | 28 ++++++++++++++++++++++++++++
 fs/fit/fit.mk    | 19 +++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 fs/fit/Config.in
 create mode 100644 fs/fit/fit.mk
fs/Config.in +1 -0
index 5853113..8d882d0 100644
@@ -4,6 +4,7 @@ source "fs/cloop/Config.in"
 source "fs/cpio/Config.in"
 source "fs/cramfs/Config.in"
 source "fs/ext2/Config.in"
+source "fs/fit/Config.in"
 source "fs/initramfs/Config.in"
 source "fs/iso9660/Config.in"
 source "fs/jffs2/Config.in"
fs/fit/Config.in new file +28 -0
new file mode 100644
index 0000000..add4d27
@@ -0,0 +1,28 @@
+config BR2_TARGET_ROOTFS_FIT
+	bool "Flattened Image Tree support"
+	help
+	  Compile a flattened image tree source into a flattened
+	  image tree blob. Select the *.its file to compile in the
+	  options below.
+
+if BR2_TARGET_ROOTFS_FIT
+
+config BR2_FIT_PATH
+	string "Flattened Image Tree source file path"
+	help
+	  Path to the image tree tree source files.
+
+config BR2_FIT_BLOB_NAME
+	string "Flattened Image Tree blob file name"
+	help
+	  File name for the resulting FIT blob.
+
+config BR2_FIT_INSTALL_TARGET
+	bool "Install Flattened Image Tree blob to /boot in target"
+	depends on !BR2_TARGET_ROOTFS_INITRAMFS
+	help
+	  Select this option to have the FIT image installed to
+	  /boot in the target root filesystem.
+
+endif
+
fs/fit/fit.mk new file +19 -0
new file mode 100644
index 0000000..84cc91c
@@ -0,0 +1,19 @@
+################################################################################
+#
+# Build the FIT image
+#
+################################################################################
+
+ifeq ($(BR2_FIT_INSTALL_TARGET),y)
+define FIT_INSTALL_ITB_TARGET
+	cp $(BINARIES_DIR)/$(BR2_LINUX_KERNEL_FIT_BLOB_NAME) $(TARGET_DIR)/boot/
+endef
+endif
+
+define ROOTFS_FIT_CMD
+	cp $(BR2_FIT_PATH) $(BINARIES_DIR)
+	mkimage -f $(BINARIES_DIR)/`basename $(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME)
+	$(FIT_INSTALL_ITB_TARGET)
+endef
+
+$(eval $(call ROOTFS_TARGET,fit))
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Yegor Yefremov <[email protected]> schreef:

Quoted 34 lines

This patch provides an option to specify a FIT source file (*.its), that will usually be stored in a board directory, and the resulting blob file name (*.itb).

---
Changes:
v2: moved configuration to fs infra instead of linux

fs/Config.in     |  1 +
fs/fit/Config.in | 28 ++++++++++++++++++++++++++++
fs/fit/fit.mk    | 19 +++++++++++++++++++
3 files changed, 48 insertions(+)

create mode 100644 fs/fit/Config.in
create mode 100644 fs/fit/fit.mk

fs/Config.in +0 -0
index 5853113..8d882d0 100644
@@ -4,6 +4,7 @@ source "fs/cloop/Config.in"

source "fs/cpio/Config.in"
source "fs/cramfs/Config.in"
source "fs/ext2/Config.in"
+source "fs/fit/Config.in"
source "fs/initramfs/Config.in"
source "fs/iso9660/Config.in"
source "fs/jffs2/Config.in"

fs/fit/Config.in new file +0 -0
new file mode 100644
index 0000000..add4d27

fs/fit/Config.in line 5

Quoted 5 lines
fs/fit/Config.in new file +5 -0
@@ -0,0 +1,28 @@
+config BR2_TARGET_ROOTFS_FIT
+	bool "Flattened Image Tree support"
+	help
+	  Compile a flattened image tree source into a flattened
+	  image tree blob. Select the *.its file to compile in the

Minor comment: I would use the word Specify instead of Select here.

Quoted 38 lines
fs/fit/Config.in new file +23 -0
+	  options below.
+
+if BR2_TARGET_ROOTFS_FIT
+
+config BR2_FIT_PATH
+	string "Flattened Image Tree source file path"
+	help
+	  Path to the image tree tree source files.
+
+config BR2_FIT_BLOB_NAME
+	string "Flattened Image Tree blob file name"
+	help
+	  File name for the resulting FIT blob.
+
+config BR2_FIT_INSTALL_TARGET
+	bool "Install Flattened Image Tree blob to /boot in target"
+	depends on !BR2_TARGET_ROOTFS_INITRAMFS
+	help
+	  Select this option to have the FIT image installed to
+	  /boot in the target root filesystem.
+
+endif
+
fs/fit/fit.mk new file +9 -0
new file mode 100644
index 0000000..84cc91c
@@ -0,0 +1,19 @@
+################################################################################
+#
+# Build the FIT image
+#
+################################################################################
+
+ifeq ($(BR2_FIT_INSTALL_TARGET),y)
+define FIT_INSTALL_ITB_TARGET
+	cp $(BINARIES_DIR)/$(BR2_LINUX_KERNEL_FIT_BLOB_NAME) $(TARGET_DIR)/boot/

fs/fit/fit.mk line 19

Quoted 10 lines
fs/fit/fit.mk new file +10 -0
+endef
+endif
+
+define ROOTFS_FIT_CMD
+	cp $(BR2_FIT_PATH) $(BINARIES_DIR)
+	mkimage -f $(BINARIES_DIR)/`basename $(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME)
+	$(FIT_INSTALL_ITB_TARGET)
+endef
+
+$(eval $(call ROOTFS_TARGET,fit))

Should we add a check on the presence of the source file to print a nice error message instead of a weird error if it doesn't exist?

Also, instead of using basename you could use the make function $(file xxx).

Finally I think you should use $(call qstrip,xxxx) on the string options.

Best regards,
Thomas

#2 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

In reply to Yegor Yefremov

Yegor Yefremov <[email protected]> schreef:

Quoted 42 lines

This patch provides an option to specify a FIT source file (*.its), that will usually be stored in a board directory, and the resulting blob file name (*.itb).

---
Changes:
v2: moved configuration to fs infra instead of linux

fs/Config.in     |  1 +
fs/fit/Config.in | 28 ++++++++++++++++++++++++++++
fs/fit/fit.mk    | 19 +++++++++++++++++++
3 files changed, 48 insertions(+)

create mode 100644 fs/fit/Config.in
create mode 100644 fs/fit/fit.mk

fs/Config.in +0 -0
index 5853113..8d882d0 100644
@@ -4,6 +4,7 @@ source "fs/cloop/Config.in"

source "fs/cpio/Config.in"
source "fs/cramfs/Config.in"
source "fs/ext2/Config.in"
+source "fs/fit/Config.in"
source "fs/initramfs/Config.in"
source "fs/iso9660/Config.in"
source "fs/jffs2/Config.in"

fs/fit/Config.in new file +8 -0
new file mode 100644
index 0000000..add4d27
@@ -0,0 +1,28 @@
+config BR2_TARGET_ROOTFS_FIT
+	bool "Flattened Image Tree support"
+	help
+	  Compile a flattened image tree source into a flattened
+	  image tree blob. Select the *.its file to compile in the
+	  options below.
+
+if BR2_TARGET_ROOTFS_FIT

fs/fit/Config.in line 18

Quoted 10 lines
fs/fit/Config.in new file +10 -0
+
+config BR2_FIT_PATH
+	string "Flattened Image Tree source file path"
+	help
+	  Path to the image tree tree source files.
+
+config BR2_FIT_BLOB_NAME
+	string "Flattened Image Tree blob file name"
+	help
+	  File name for the resulting FIT blob.

Two extra comments after sleeping over it:

- is it really needed to ask for the blob file name? We could simply use the same file name as the source, but with modified extension.

- I think we should add support for multiple fit images at once, which is not hard to do. The user would specify a space separated list of its files.

Best regards,
Thomas

#3 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Quoted 56 lines · Thomas De Schampheleire

Yegor Yefremov <[email protected]> schreef:

Quoted 42 lines

This patch provides an option to specify a FIT source file (*.its), that will usually be stored in a board directory, and the resulting blob file name (*.itb).

---
Changes:
v2: moved configuration to fs infra instead of linux

fs/Config.in     |  1 +
fs/fit/Config.in | 28 ++++++++++++++++++++++++++++
fs/fit/fit.mk    | 19 +++++++++++++++++++
3 files changed, 48 insertions(+)

create mode 100644 fs/fit/Config.in
create mode 100644 fs/fit/fit.mk

fs/Config.in +0 -0
index 5853113..8d882d0 100644
@@ -4,6 +4,7 @@ source "fs/cloop/Config.in"

source "fs/cpio/Config.in"
source "fs/cramfs/Config.in"
source "fs/ext2/Config.in"
+source "fs/fit/Config.in"
source "fs/initramfs/Config.in"
source "fs/iso9660/Config.in"
source "fs/jffs2/Config.in"

fs/fit/Config.in new file +8 -0
new file mode 100644
index 0000000..add4d27
@@ -0,0 +1,28 @@
+config BR2_TARGET_ROOTFS_FIT
+      bool "Flattened Image Tree support"
+      help
+        Compile a flattened image tree source into a flattened
+        image tree blob. Select the *.its file to compile in the
+        options below.
+
+if BR2_TARGET_ROOTFS_FIT

fs/fit/Config.in line 18

Quoted 10 lines
fs/fit/Config.in new file +10 -0
+
+config BR2_FIT_PATH
+      string "Flattened Image Tree source file path"
+      help
+        Path to the image tree tree source files.
+
+config BR2_FIT_BLOB_NAME
+      string "Flattened Image Tree blob file name"
+      help
+        File name for the resulting FIT blob.

Two extra comments after sleeping over it:

Quoted 3 lines

- is it really needed to ask for the blob file name? We could simply use the same file name as the source, but with modified extension.

You're right, we can get rid of it or at least make it optional.

Quoted 3 lines

- I think we should add support for multiple fit images at once, which is not hard to do. The user would specify a space separated list of its files.

O.K.

But the first problem is, that cp command fails to execute because of missing quote. I've discussed this issue with Thomas Petazzoni on IRC yesterday, but we couldn't see the problem. Could you try the patch and let me know, if it can be executed without any issues?

Thanks.

Yegor

#4 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Hi Yegor,

Quoted 68 lines · Yegor Yefremov
Quoted 56 lines · Thomas De Schampheleire

Yegor Yefremov <[email protected]> schreef:

Quoted 42 lines

This patch provides an option to specify a FIT source file (*.its), that will usually be stored in a board directory, and the resulting blob file name (*.itb).

---
Changes:
v2: moved configuration to fs infra instead of linux

fs/Config.in     |  1 +
fs/fit/Config.in | 28 ++++++++++++++++++++++++++++
fs/fit/fit.mk    | 19 +++++++++++++++++++
3 files changed, 48 insertions(+)

create mode 100644 fs/fit/Config.in
create mode 100644 fs/fit/fit.mk

fs/Config.in +0 -0
index 5853113..8d882d0 100644
@@ -4,6 +4,7 @@ source "fs/cloop/Config.in"

source "fs/cpio/Config.in"
source "fs/cramfs/Config.in"
source "fs/ext2/Config.in"
+source "fs/fit/Config.in"
source "fs/initramfs/Config.in"
source "fs/iso9660/Config.in"
source "fs/jffs2/Config.in"

fs/fit/Config.in new file +8 -0
new file mode 100644
index 0000000..add4d27
@@ -0,0 +1,28 @@
+config BR2_TARGET_ROOTFS_FIT
+      bool "Flattened Image Tree support"
+      help
+        Compile a flattened image tree source into a flattened
+        image tree blob. Select the *.its file to compile in the
+        options below.
+
+if BR2_TARGET_ROOTFS_FIT

fs/fit/Config.in line 18

Quoted 10 lines
fs/fit/Config.in new file +10 -0
+
+config BR2_FIT_PATH
+      string "Flattened Image Tree source file path"
+      help
+        Path to the image tree tree source files.
+
+config BR2_FIT_BLOB_NAME
+      string "Flattened Image Tree blob file name"
+      help
+        File name for the resulting FIT blob.

Two extra comments after sleeping over it:

Quoted 3 lines

- is it really needed to ask for the blob file name? We could simply use the same file name as the source, but with modified extension.

You're right, we can get rid of it or at least make it optional.

Quoted 3 lines

- I think we should add support for multiple fit images at once, which is not hard to do. The user would specify a space separated list of its files.

Quoted 6 lines

O.K.

But the first problem is, that cp command fails to execute because of missing quote. I've discussed this issue with Thomas Petazzoni on IRC yesterday, but we couldn't see the problem. Could you try the patch and let me know, if it can be executed without any issues?

I see the same problem. It is caused by the fact that you have multiple commands in ROOTFS_FIT_CMD, you should join them with '&& \' at the end of each line.
I think you will then have to provide a default implementation for the target_cmd ('true') to avoid a syntax error.

Also, I detected a missing dependency: you're using mkimage so you should depend on host-uboot-tools I think.

Best regards,
Thomas

#5 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Quoted 79 lines · Thomas De Schampheleire

Hi Yegor,

Quoted 68 lines · Yegor Yefremov
Quoted 56 lines · Thomas De Schampheleire

Yegor Yefremov <[email protected]> schreef:

Quoted 42 lines

This patch provides an option to specify a FIT source file (*.its), that will usually be stored in a board directory, and the resulting blob file name (*.itb).

---
Changes:
v2: moved configuration to fs infra instead of linux

fs/Config.in     |  1 +
fs/fit/Config.in | 28 ++++++++++++++++++++++++++++
fs/fit/fit.mk    | 19 +++++++++++++++++++
3 files changed, 48 insertions(+)

create mode 100644 fs/fit/Config.in
create mode 100644 fs/fit/fit.mk

fs/Config.in +0 -0
index 5853113..8d882d0 100644
@@ -4,6 +4,7 @@ source "fs/cloop/Config.in"

source "fs/cpio/Config.in"
source "fs/cramfs/Config.in"
source "fs/ext2/Config.in"
+source "fs/fit/Config.in"
source "fs/initramfs/Config.in"
source "fs/iso9660/Config.in"
source "fs/jffs2/Config.in"

fs/fit/Config.in new file +8 -0
new file mode 100644
index 0000000..add4d27
@@ -0,0 +1,28 @@
+config BR2_TARGET_ROOTFS_FIT
+      bool "Flattened Image Tree support"
+      help
+        Compile a flattened image tree source into a flattened
+        image tree blob. Select the *.its file to compile in the
+        options below.
+
+if BR2_TARGET_ROOTFS_FIT

fs/fit/Config.in line 18

Quoted 10 lines
fs/fit/Config.in new file +10 -0
+
+config BR2_FIT_PATH
+      string "Flattened Image Tree source file path"
+      help
+        Path to the image tree tree source files.
+
+config BR2_FIT_BLOB_NAME
+      string "Flattened Image Tree blob file name"
+      help
+        File name for the resulting FIT blob.

Two extra comments after sleeping over it:

Quoted 3 lines

- is it really needed to ask for the blob file name? We could simply use the same file name as the source, but with modified extension.

You're right, we can get rid of it or at least make it optional.

Quoted 3 lines

- I think we should add support for multiple fit images at once, which is not hard to do. The user would specify a space separated list of its files.

Quoted 6 lines

O.K.

But the first problem is, that cp command fails to execute because of missing quote. I've discussed this issue with Thomas Petazzoni on IRC yesterday, but we couldn't see the problem. Could you try the patch and let me know, if it can be executed without any issues?

Quoted 8 lines

I see the same problem. It is caused by the fact that you have multiple commands in ROOTFS_FIT_CMD, you should join them with '&& \' at the end of each line.
I think you will then have to provide a default implementation for the target_cmd ('true') to avoid a syntax error.

Also, I detected a missing dependency: you're using mkimage so you should depend on host-uboot-tools I think.

I've figured the stuff out too:

ROOTFS_FIT_DEPENDENCIES = uboot-tools

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define ROOTFS_FIT_CMD

        cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
        $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename
$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) && \
        mkdir -p $(TARGET_DIR)/boot/ && \
        cp $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) $(TARGET_DIR)/boot/
endef
else
define ROOTFS_FIT_CMD
        cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
        $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename

$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) endef
endif

$(eval $(call ROOTFS_TARGET,fit))

Thanks for the help.

Yegor

#6 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Yegor Yefremov <[email protected]> schreef:

Quoted 4 lines

I've figured the stuff out too:

ROOTFS_FIT_DEPENDENCIES = uboot-tools

This should be host-uboot-tools, no?

Quoted 13 lines

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define ROOTFS_FIT_CMD

       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename
$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) && \
       mkdir -p $(TARGET_DIR)/boot/ && \
       cp $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) $(TARGET_DIR)/boot/
endef
else
define ROOTFS_FIT_CMD
       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename
Quoted 5 lines

$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) endef
endif

$(eval $(call ROOTFS_TARGET,fit))

There's a lot of duplication here that can be avoided...

Best regards,
Thomas

#7 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Quoted 7 lines · Thomas De Schampheleire

Yegor Yefremov <[email protected]> schreef:

Quoted 4 lines

I've figured the stuff out too:

ROOTFS_FIT_DEPENDENCIES = uboot-tools

This should be host-uboot-tools, no?

Fixed

Quoted 16 lines
Quoted 16 lines

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define ROOTFS_FIT_CMD

       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename
$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) && \
       mkdir -p $(TARGET_DIR)/boot/ && \
       cp $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) $(TARGET_DIR)/boot/
endef
else
define ROOTFS_FIT_CMD
       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename

$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) endef
endif

Quoted 3 lines
Quoted 1 line

$(eval $(call ROOTFS_TARGET,fit))

There's a lot of duplication here that can be avoided...

How do I define "nop" in a Makefile syntactically? What do you mean with "target_cmd ('true') "?

Yegor

#8 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Yegor Yefremov <[email protected]> schreef:

Quoted 28 lines
Quoted 7 lines · Thomas De Schampheleire

Yegor Yefremov <[email protected]> schreef:

Quoted 4 lines

I've figured the stuff out too:

ROOTFS_FIT_DEPENDENCIES = uboot-tools

This should be host-uboot-tools, no?

Fixed

Quoted 16 lines
Quoted 16 lines

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define ROOTFS_FIT_CMD

       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename
$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) && \
       mkdir -p $(TARGET_DIR)/boot/ && \
       cp $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) $(TARGET_DIR)/boot/
endef
else
define ROOTFS_FIT_CMD
       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename

$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) endef
endif

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

$(eval $(call ROOTFS_TARGET,fit))

There's a lot of duplication here that can be avoided...

How do I define "nop" in a Makefile syntactically? What do you mean with "target_cmd ('true') "?

I meant what Thomas P proposed in his comments on v3, the shell command true which is basically a nop if used in this way..

Best regards,
Thomas

#9 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Quoted 29 lines · Thomas De Schampheleire

Yegor Yefremov <[email protected]> schreef:

Quoted 28 lines
Quoted 7 lines · Thomas De Schampheleire

Yegor Yefremov <[email protected]> schreef:

Quoted 4 lines

I've figured the stuff out too:

ROOTFS_FIT_DEPENDENCIES = uboot-tools

This should be host-uboot-tools, no?

Fixed

Quoted 16 lines
Quoted 16 lines

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define ROOTFS_FIT_CMD

       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename
$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) && \
       mkdir -p $(TARGET_DIR)/boot/ && \
       cp $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) $(TARGET_DIR)/boot/
endef
else
define ROOTFS_FIT_CMD
       cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
       $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/`basename

$(BR2_FIT_PATH)` $(BINARIES_DIR)/$(BR2_FIT_BLOB_NAME) endef
endif

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

$(eval $(call ROOTFS_TARGET,fit))

There's a lot of duplication here that can be avoided...

How do I define "nop" in a Makefile syntactically? What do you mean with "target_cmd ('true') "?

I meant what Thomas P proposed in his comments on v3, the shell command true which is basically a nop if used in this way..

Something like this?

################################################################################
#
# Build the FIT image
#
################################################################################

ROOTFS_FIT_DEPENDENCIES = host-uboot-tools

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define FIT_INSTALL_ITB_TARGET

        mkdir -p $(TARGET_DIR)/boot/ && \
        cp $(BINARIES_DIR)/$(basename $(notdir $(call

qstrip,$(BR2_FIT_PATH)))).itb $(TARGET_DIR)/boot/
endef
else
define FIT_INSTALL_ITB_TARGET
true
endef
endif

define ROOTFS_FIT_CMD

        cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
        $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/$(notdir $(call
qstrip,$(BR2_FIT_PATH))) $(BINARIES_DIR)/$(basename $(notdir $(call
qstrip,$(BR2_FIT_PATH)))).itb && \
        $(FIT_INSTALL_ITB_TARGET)

endef

$(eval $(call ROOTFS_TARGET,fit))

#10 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Quoted 24 lines · Yegor Yefremov

Something like this?

################################################################################
#
# Build the FIT image
#
################################################################################

ROOTFS_FIT_DEPENDENCIES = host-uboot-tools

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define FIT_INSTALL_ITB_TARGET

        mkdir -p $(TARGET_DIR)/boot/ && \
        cp $(BINARIES_DIR)/$(basename $(notdir $(call

qstrip,$(BR2_FIT_PATH)))).itb $(TARGET_DIR)/boot/
endef
else
define FIT_INSTALL_ITB_TARGET
true
endef
endif

define ROOTFS_FIT_CMD

Quoted 8 lines
        cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
        $(HOST_DIR)/usr/bin/mkimage -f $(BINARIES_DIR)/$(notdir $(call
qstrip,$(BR2_FIT_PATH))) $(BINARIES_DIR)/$(basename $(notdir $(call
qstrip,$(BR2_FIT_PATH)))).itb && \
        $(FIT_INSTALL_ITB_TARGET)

endef

$(eval $(call ROOTFS_TARGET,fit))

Yes, exactly.

I don't yet see, as ThomasP also noticed, how this would work for multiple files. I think you will need a foreach statement here and there.

Regarding the automatic calculation of the .itb file, if multiple its files are supported, one possible problem is where a user specifies two .its files with the same name but in a separate directory. For example

BR2_FIT_PATH="/tmp/foo/project.its /tmp/bar/project.its"

In this case, the .itb name will be calculated as $(BINARIES_DIR)/project.itb for both source files.
Since handling this is not trivial in a common way, I would propose to not handle it and document it in the help text as a limitation.

Regarding the implementation: I think it'd be more clear to calculate the final ITS and ITB values (so after qstrip, basename, etc.) in a separate variable, so that the commands are easy to read and there is less duplication.

Best regards,
Thomas

#11 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Dear Thomas De Schampheleire,

Quoted 4 lines · Thomas De Schampheleire

Regarding the implementation: I think it'd be more clear to calculate the final ITS and ITB values (so after qstrip, basename, etc.) in a separate variable, so that the commands are easy to read and there is less duplication.

I think that's exactly what I did in the prototype code I sent to Yegor, but apparently, he didn't use it...

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#12 lore raw

PATCH v2 1/1 Add support for Flattened Image Trees

Quoted 11 lines · Thomas Petazzoni

Dear Thomas De Schampheleire,

Quoted 4 lines · Thomas De Schampheleire

Regarding the implementation: I think it'd be more clear to calculate the final ITS and ITB values (so after qstrip, basename, etc.) in a separate variable, so that the commands are easy to read and there is less duplication.

I think that's exactly what I did in the prototype code I sent to Yegor, but apparently, he didn't use it...

I think I drunk not enough coffee today :-) I've added foreach, but haven't tested it with multiple source files. Will integrate your example too. I must deal with some real life stuff today, so I'll answer all questions next week. Thanks for helping.

################################################################################
#
# Build the FIT image
#
################################################################################

ROOTFS_FIT_DEPENDENCIES = host-uboot-tools

FIT_SRCS = $(BINARIES_DIR)/$(notdir $(call qstrip,$(BR2_FIT_PATH))) FIT_BLOBS = $(BINARIES_DIR)/$(basename $(notdir $(call qstrip,$(BR2_FIT_PATH)))).itb

ifeq ($(BR2_FIT_INSTALL_TARGET),y)
define FIT_INSTALL_ITB_TARGET

        mkdir -p $(TARGET_DIR)/boot/ && \
        cp $(FIT_BLOBS) $(TARGET_DIR)/boot/

endef
else
define FIT_INSTALL_ITB_TARGET
true
endef
endif

define ROOTFS_FIT_CMD

        cp $(BR2_FIT_PATH) $(BINARIES_DIR) && \
        $(foreach its,$(FIT_SRCS),$(HOST_DIR)/usr/bin/mkimage -f
$(its) $(basename $(its)).itb) && \
        $(FIT_INSTALL_ITB_TARGET)

endef

$(eval $(call ROOTFS_TARGET,fit))

Yegor