0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From c7df098a71e05dc81cee818747759e8060b59626 Mon Sep 17 00:00:00 2001
  2. From: Luca Ceresoli <luca@lucaceresoli.net>
  3. Date: Mon, 4 Jun 2018 12:21:01 +0200
  4. Subject: [PATCH] arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
  5. The value of PMUFW_INIT_FILE is prefixed with "$(srctree)/", thus
  6. forcing it to be a relative path inside the U-Boot source tree. Since
  7. the PMUFW is a binary file generated outside of U-Boot, the PMUFW
  8. binary must be copied inside the U-Boot source tree before the
  9. build.
  10. This generates a few problems:
  11. * if the source tree is shared among different out-of-tree builds,
  12. they will pollute (and potentially corrupt) each other
  13. * the source tree cannot be read-only
  14. * any buildsystem must add a command to copy the PMUFW binary
  15. * putting an externally-generated binary in the source tree is ugly
  16. as hell
  17. Avoid these problems by accepting an absolute path for
  18. PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/"
  19. prefix, but in order to keep backward compatibility we rather use the
  20. shell and readlink to get the absolute path even when starting from a
  21. relative path.
  22. Since 'readlink -f' produces an empty string if the file does not
  23. exist, we also add a check to ensure the file configured in
  24. PMUFW_INIT_FILE exists. Otherwise the build would exit successfully,
  25. but produce a boot.bin without PMUFW as if PMUFW_INIT_FILE were empty.
  26. Tested in the 12 possible combinations of:
  27. - PMUFW_INIT_FILE empty, relative, absolute, non-existing
  28. - building in-tree, in subdir, in other directory
  29. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
  30. Cc: Michal Simek <michal.simek@xilinx.com>
  31. Cc: Simon Glass <sjg@chromium.org>
  32. Cc: Emmanuel Vadot <manu@bidouilliste.com>
  33. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
  34. Backported from upstream: https://git.denx.de/?p=u-boot.git;a=commit;h=c7df098a71e05dc81cee818747759e8060b59626
  35. ---
  36. scripts/Makefile.spl | 8 +++++++-
  37. 1 file changed, 7 insertions(+), 1 deletion(-)
  38. diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
  39. index ef018b5b4056..252f13826d4c 100644
  40. --- a/scripts/Makefile.spl
  41. +++ b/scripts/Makefile.spl
  42. @@ -167,8 +167,14 @@ ifdef CONFIG_ARCH_ZYNQ
  43. MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE)
  44. endif
  45. ifdef CONFIG_ARCH_ZYNQMP
  46. +ifneq ($(CONFIG_PMUFW_INIT_FILE),"")
  47. +spl/boot.bin: zynqmp-check-pmufw
  48. +zynqmp-check-pmufw: FORCE
  49. + ( cd $(srctree) && test -r $(CONFIG_PMUFW_INIT_FILE) ) \
  50. + || ( echo "Cannot read $(CONFIG_PMUFW_INIT_FILE)" && false )
  51. +endif
  52. MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) \
  53. - -n $(srctree)/$(CONFIG_PMUFW_INIT_FILE)
  54. + -n "$(shell cd $(srctree); readlink -f $(CONFIG_PMUFW_INIT_FILE))"
  55. endif
  56. spl/boot.bin: $(obj)/u-boot-spl.bin FORCE
  57. --
  58. 2.7.4