Add support for Flattened Image Trees
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
@@ -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
@@ -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
@@ -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
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).
Signed-off-by Yegor Yefremov <[email protected]>---
Changes:
v2: moved configuration to fs infra instead of linuxfs/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 100644fs/fit/fit.mkfs/Config.in +0
-0@@ -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
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@@ -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
PATCH v2 1/1 Add support for Flattened Image Trees
In reply to Yegor YefremovYegor 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).
Signed-off-by Yegor Yefremov <[email protected]>---
Changes:
v2: moved configuration to fs infra instead of linuxfs/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 100644fs/fit/fit.mkfs/Config.in +0
-0@@ -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@@ -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
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).
Signed-off-by Yegor Yefremov <[email protected]>---
Changes:
v2: moved configuration to fs infra instead of linuxfs/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 100644fs/fit/fit.mkfs/Config.in +0
-0@@ -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@@ -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_FITfs/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
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).
Signed-off-by Yegor Yefremov <[email protected]>---
Changes:
v2: moved configuration to fs infra instead of linuxfs/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 100644fs/fit/fit.mkfs/Config.in +0
-0@@ -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@@ -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_FITfs/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
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).
Signed-off-by Yegor Yefremov <[email protected]>---
Changes:
v2: moved configuration to fs infra instead of linuxfs/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 100644fs/fit/fit.mkfs/Config.in +0
-0@@ -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@@ -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_FITfs/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 thetarget_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
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)
defineROOTFS_FIT_CMDcp $(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
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-toolsThis should be host-uboot-tools, no?
Fixed
Quoted 16 lines
Quoted 16 lines
ifeq ($(BR2_FIT_INSTALL_TARGET),y)
defineROOTFS_FIT_CMDcp $(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
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-toolsThis should be host-uboot-tools, no?
Fixed
Quoted 16 lines
Quoted 16 lines
ifeq ($(BR2_FIT_INSTALL_TARGET),y)
defineROOTFS_FIT_CMDcp $(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
Makefilesyntactically? 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
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-toolsThis should be host-uboot-tools, no?
Fixed
Quoted 16 lines
Quoted 16 lines
ifeq ($(BR2_FIT_INSTALL_TARGET),y)
defineROOTFS_FIT_CMDcp $(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
Makefilesyntactically? 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 $(callqstrip,$(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))
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-toolsifeq ($(BR2_FIT_INSTALL_TARGET),y)
defineFIT_INSTALL_ITB_TARGETmkdir -p $(TARGET_DIR)/boot/ && \ cp $(BINARIES_DIR)/$(basename $(notdir $(callqstrip,$(BR2_FIT_PATH)))).itb $(TARGET_DIR)/boot/
endef
else
defineFIT_INSTALL_ITB_TARGET
true
endef
endifdefine
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
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
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