arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
PATCH v2 1/1 arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
The value of PMUFW_INIT_FILE is prefixed with "$(srctree)/", thus forcing it to be a relative path inside the U-Boot source tree. Since the PMUFW is a binary file generated outside of U-Boot, the PMUFW binary must be copied inside the U-Boot source tree before the build.
This generates a few problems:
* if the source tree is shared among different out-of-tree builds, they will pollute (and potentially corrupt) each other
* the source tree cannot be read-only
* any buildsystem must add a command to copy the PMUFW binary
* putting an externally-generated binary in the source tree is ugly as hell
Avoid these problems by accepting an absolute path for PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/" prefix, but in order to keep backward compatibility we rather use the shell and readlink to get the absolute path even when starting from a relative path.
Since 'readlink -f' produces an empty string if the file does not exist, we also add a check to ensure the file configured in PMUFW_INIT_FILE exists. Otherwise the build would exit successfully, but produce a boot.bin without PMUFW as if PMUFW_INIT_FILE were empty.
Tested in the 12 possible combinations of:
- PMUFW_INIT_FILE empty, relative, absolute, non-existing
- building in-tree, in subdir, in other directory
---
Changes v1 -> v2:
- avoid non-portable 'readlink -m' by adding an explicit check to ensure the file exists
- test also the case where PMUFW_INIT_FILE points to a non-existing file
--- scripts/Makefile.spl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
scripts/Makefile.spl +7 -1
@@ -167,8 +167,14 @@ ifdef CONFIG_ARCH_ZYNQ MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) endif ifdef CONFIG_ARCH_ZYNQMP +ifneq ($(CONFIG_PMUFW_INIT_FILE),"") +spl/boot.bin: zynqmp-check-pmufw +zynqmp-check-pmufw: FORCE + ( cd $(srctree) && test -r $(CONFIG_PMUFW_INIT_FILE) ) \ + || ( echo "Cannot read $(CONFIG_PMUFW_INIT_FILE)" && false ) +endif MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) \ - -n $(srctree)/$(CONFIG_PMUFW_INIT_FILE) + -n "$(shell cd $(srctree); readlink -f $(CONFIG_PMUFW_INIT_FILE))" endif spl/boot.bin: $(obj)/u-boot-spl.bin FORCE
Signature · 1 line
2.7.4
PATCH v2 1/1 arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
Quoted 57 lines · Luca Ceresoli
The value of
PMUFW_INIT_FILEis prefixed with "$(srctree)/", thus forcing it to be a relative path inside the U-Boot source tree. Since the PMUFW is a binary file generated outside of U-Boot, the PMUFW binary must be copied inside the U-Boot source tree before the build.This generates a few problems:
* if the source tree is shared among different out-of-tree builds, they will pollute (and potentially corrupt) each other
* the source tree cannot be read-only
* any buildsystem must add a command to copy the PMUFW binary
* putting an externally-generated binary in the source tree is ugly as hellAvoid these problems by accepting an absolute path for
PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/" prefix, but in order to keep backward compatibility we rather use the shell and readlink to get the absolute path even when starting from a relative path.Since 'readlink -f' produces an empty string if the file does not exist, we also add a check to ensure the file configured in
PMUFW_INIT_FILEexists. Otherwise the build would exit successfully, but produce a boot.bin without PMUFW as ifPMUFW_INIT_FILEwere empty.Tested in the 12 possible combinations of:
-PMUFW_INIT_FILEempty, relative, absolute, non-existing
- building in-tree, in subdir, in other directorySigned-off-by Luca Ceresoli <[email protected]>Cc Michal Simek <[email protected]>Cc Simon Glass <[email protected]>Cc Emmanuel Vadot <[email protected]>---
Changes v1 -> v2:
- avoid non-portable 'readlink -m' by adding an explicit check to ensure the file exists
- test also the case wherePMUFW_INIT_FILEpoints to a non-existing file--- scripts/Makefile.spl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)scripts/Makefile.spl +2
-0@@ -167,8 +167,14 @@ ifdef CONFIG_ARCH_ZYNQ MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) endif ifdef CONFIG_ARCH_ZYNQMP +ifneq ($(CONFIG_PMUFW_INIT_FILE),"") +spl/boot.bin: zynqmp-check-pmufw
scripts/Makefile.spl ifdef CONFIG_ARCH_ZYNQ · line 180
Quoted 10 lines
scripts/Makefile.spl +5
-1+zynqmp-check-pmufw: FORCE + ( cd $(srctree) && test -r $(CONFIG_PMUFW_INIT_FILE) ) \ + || ( echo "Cannot read $(CONFIG_PMUFW_INIT_FILE)" && false ) +endif MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) \ - -n $(srctree)/$(CONFIG_PMUFW_INIT_FILE) + -n "$(shell cd $(srctree); readlink -f $(CONFIG_PMUFW_INIT_FILE))" endif spl/boot.bin: $(obj)/u-boot-spl.bin FORCE
Emmanuel: Can you please try it and let me know if this works on BSD?
Thanks,
Michal
PATCH v2 1/1 arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
Quoted 66 lines · On Fri, 8 Jun 2018 08:28:02 +0200 Michal Simek <[email protected]> wrote:
Quoted 65 lines · Luca Ceresoli
The value of
PMUFW_INIT_FILEis prefixed with "$(srctree)/", thus forcing it to be a relative path inside the U-Boot source tree. Since the PMUFW is a binary file generated outside of U-Boot, the PMUFW binary must be copied inside the U-Boot source tree before the build.This generates a few problems:
* if the source tree is shared among different out-of-tree builds, they will pollute (and potentially corrupt) each other
* the source tree cannot be read-only
* any buildsystem must add a command to copy the PMUFW binary
* putting an externally-generated binary in the source tree is ugly as hellAvoid these problems by accepting an absolute path for
PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/" prefix, but in order to keep backward compatibility we rather use the shell and readlink to get the absolute path even when starting from a relative path.Since 'readlink -f' produces an empty string if the file does not exist, we also add a check to ensure the file configured in
PMUFW_INIT_FILEexists. Otherwise the build would exit successfully, but produce a boot.bin without PMUFW as ifPMUFW_INIT_FILEwere empty.Tested in the 12 possible combinations of:
-PMUFW_INIT_FILEempty, relative, absolute, non-existing
- building in-tree, in subdir, in other directorySigned-off-by Luca Ceresoli <[email protected]>Cc Michal Simek <[email protected]>Cc Simon Glass <[email protected]>Cc Emmanuel Vadot <[email protected]>---
Changes v1 -> v2:
- avoid non-portable 'readlink -m' by adding an explicit check to ensure the file exists
- test also the case wherePMUFW_INIT_FILEpoints to a non-existing file--- scripts/Makefile.spl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)scripts/Makefile.spl +7
-1@@ -167,8 +167,14 @@ ifdef CONFIG_ARCH_ZYNQ MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) endif ifdef CONFIG_ARCH_ZYNQMP +ifneq ($(CONFIG_PMUFW_INIT_FILE),"") +spl/boot.bin: zynqmp-check-pmufw +zynqmp-check-pmufw: FORCE + ( cd $(srctree) && test -r $(CONFIG_PMUFW_INIT_FILE) ) \ + || ( echo "Cannot read $(CONFIG_PMUFW_INIT_FILE)" && false ) +endif MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) \ - -n $(srctree)/$(CONFIG_PMUFW_INIT_FILE) + -n "$(shell cd $(srctree); readlink -f $(CONFIG_PMUFW_INIT_FILE))" endif
Quoted 7 lines
scripts/Makefile.spl ifdef CONFIG_ARCH_ZYNQ · line 180
Quoted 2 lines
scripts/Makefile.spl +0
-0spl/boot.bin: $(obj)/u-boot-spl.bin FORCEEmmanuel: Can you please try it and let me know if this works on BSD?
Thanks,
Michal
Yes no problem for readlink -f on BSD, I already answered to Luca. I don't know if you need a acked-by or something (and how to properly
send it) since I'm in CC.
Cheers,
Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
PATCH v2 1/1 arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
Quoted 74 lines · Emmanuel Vadot
Quoted 71 lines · On Fri, 8 Jun 2018 08:28:02 +0200 Michal Simek <[email protected]> wrote:
Quoted 57 lines · Luca Ceresoli
The value of
PMUFW_INIT_FILEis prefixed with "$(srctree)/", thus forcing it to be a relative path inside the U-Boot source tree. Since the PMUFW is a binary file generated outside of U-Boot, the PMUFW binary must be copied inside the U-Boot source tree before the build.This generates a few problems:
* if the source tree is shared among different out-of-tree builds, they will pollute (and potentially corrupt) each other
* the source tree cannot be read-only
* any buildsystem must add a command to copy the PMUFW binary
* putting an externally-generated binary in the source tree is ugly as hellAvoid these problems by accepting an absolute path for
PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/" prefix, but in order to keep backward compatibility we rather use the shell and readlink to get the absolute path even when starting from a relative path.Since 'readlink -f' produces an empty string if the file does not exist, we also add a check to ensure the file configured in
PMUFW_INIT_FILEexists. Otherwise the build would exit successfully, but produce a boot.bin without PMUFW as ifPMUFW_INIT_FILEwere empty.Tested in the 12 possible combinations of:
-PMUFW_INIT_FILEempty, relative, absolute, non-existing
- building in-tree, in subdir, in other directorySigned-off-by Luca Ceresoli <[email protected]>Cc Michal Simek <[email protected]>Cc Simon Glass <[email protected]>Cc Emmanuel Vadot <[email protected]>---
Changes v1 -> v2:
- avoid non-portable 'readlink -m' by adding an explicit check to ensure the file exists
- test also the case wherePMUFW_INIT_FILEpoints to a non-existing file--- scripts/Makefile.spl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)scripts/Makefile.spl +2
-0@@ -167,8 +167,14 @@ ifdef CONFIG_ARCH_ZYNQ MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) endif ifdef CONFIG_ARCH_ZYNQMP +ifneq ($(CONFIG_PMUFW_INIT_FILE),"") +spl/boot.bin: zynqmp-check-pmufwscripts/Makefile.spl ifdef CONFIG_ARCH_ZYNQ · line 180
Quoted 10 lines
scripts/Makefile.spl +5
-1+zynqmp-check-pmufw: FORCE + ( cd $(srctree) && test -r $(CONFIG_PMUFW_INIT_FILE) ) \ + || ( echo "Cannot read $(CONFIG_PMUFW_INIT_FILE)" && false ) +endif MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) \ - -n $(srctree)/$(CONFIG_PMUFW_INIT_FILE) + -n "$(shell cd $(srctree); readlink -f $(CONFIG_PMUFW_INIT_FILE))" endif spl/boot.bin: $(obj)/u-boot-spl.bin FORCEEmmanuel: Can you please try it and let me know if this works on BSD?
Quoted 6 lines
Quoted 2 lines
Thanks,
MichalYes no problem for readlink -f on BSD, I already answered to Luca. I don't know if you need a acked-by or something (and how to properly
send it) since I'm in CC.
ok. Then applied.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180611/008f571d/attachment.sig>