Update to using the xilinx-platform-init.bbclass and depending on the
'virtual/xilinx-platform-init' provider. This allows for more generic
support of platform-init (between Zynq7, ZynqMP and any future targets).

This change also renames some of the variables used for defining the
source of the platform-init files for SPL. Specifically HAS_PS7INIT is
renamed to HAS_PLATFORM_INIT, and FORCE_PS7INIT is renamed to
FORCE_PLATFORM_INIT. However for compatibility the existing variables
still function as expected.

Signed-off-by: Nathan Rossi <nat...@nathanrossi.com>
---
 recipes-bsp/u-boot/u-boot-spl-zynq-init.inc | 58 +++++++++++++++++------------
 recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb    |  2 +-
 recipes-bsp/u-boot/u-boot_%.bbappend        |  2 +-
 3 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc 
b/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc
index cc06de6cc5..442a24f9b2 100644
--- a/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc
+++ b/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc
@@ -1,38 +1,48 @@
-inherit zynq7-platform-paths
+inherit xilinx-platform-init
+
+PLATFORM_BOARD_DIR ?= ""
+PLATFORM_BOARD_DIR_zynq = "board/xilinx/zynq"
+PLATFORM_BOARD_DIR_zynqmp = "board/xilinx/zynqmp"
 
 do_configure_prepend() {
-       if ${@bb.utils.contains('DEPENDS', 'virtual/zynq7-platform-init', 
'true', 'false', d)}; then
-               if [ -d "${S}/board/xilinx/zynq/custom_hw_platform" ]; then
-                       cp ${PLATFORM_INIT_STAGE_DIR}/ps7_init_gpl.h 
${S}/board/xilinx/zynq/custom_hw_platform/
-                       cp ${PLATFORM_INIT_STAGE_DIR}/ps7_init_gpl.c 
${S}/board/xilinx/zynq/custom_hw_platform/
-               else
-                       cp ${PLATFORM_INIT_STAGE_DIR}/ps7_init_gpl.h 
${S}/board/xilinx/zynq/
-                       cp ${PLATFORM_INIT_STAGE_DIR}/ps7_init_gpl.c 
${S}/board/xilinx/zynq/
-               fi
-               if [ -n "${FORCE_PS7INIT}" ]; then
-                       # overwrite all the existing platforms ps7_init files, 
this is a shotgun approach and only works due to
-                       # u-boot being built for each machine seperately with 
seperate source directories.
-                       for i in ${S}/board/xilinx/zynq/*/; do
-                               cp ${PLATFORM_INIT_STAGE_DIR}/ps7_init_gpl.h $i
-                               cp ${PLATFORM_INIT_STAGE_DIR}/ps7_init_gpl.c $i
+       if ${@bb.utils.contains('DEPENDS', 'virtual/xilinx-platform-init', 
'true', 'false', d)}; then
+               for f in ${PLATFORM_INIT_FILES}; do
+                       if [ -d "${S}/${PLATFORM_BOARD_DIR}/custom_hw_platform" 
]; then
+                               cp ${PLATFORM_INIT_STAGE_DIR}/$f 
${S}/${PLATFORM_BOARD_DIR}/custom_hw_platform/
+                       else
+                               cp ${PLATFORM_INIT_STAGE_DIR}/$f 
${S}/${PLATFORM_BOARD_DIR}/
+                       fi
+                       # Newer u-boot sources use the init files in a sub 
directory named
+                       # based on the name of the device tree. This is not 
straight
+                       # forward to detect. Instead of detecting just 
overwrite all the
+                       # platform init files so that the correct one is always 
used. This
+                       # shotgun approach only works due to this recipe being 
machine arch
+                       # specific. Do this overwrite un-conditionally as there 
is no
+                       # guarantees that the chosen board config does not have 
the device
+                       # tree config set.
+                       for i in ${S}/${PLATFORM_BOARD_DIR}/*/; do
+                               [ -d $i ] && cp ${PLATFORM_INIT_STAGE_DIR}/$f $i
                        done
-               fi
+               done
        fi
 }
 
-FORCE_PS7INIT[doc] = "This variable is used to force the overriding of all 
ps7_init_gpl.* files in u-boot source with what is provided by 
virtual/zynq7-platform-init."
+FORCE_PLATFORM_INIT[doc] = "This variable is used to force the overriding of 
all platform init files in u-boot source."
 
 python () {
-       # Determine if target machine needs to provide a custom ps7_init_gpl.*
-       if d.getVar("SOC_FAMILY", True) == "zynq":
-               if d.getVar("SPL_BINARY", True):
+       hasconfigs = (d.getVar("HAS_PLATFORM_INIT") or "").split() + 
(d.getVar("HAS_PS7INIT") or "").split()
+       forceoverride = (d.getVar("FORCE_PLATFORM_INIT") == "1") or 
(d.getVar("FORCE_PS7INIT"))
+
+       # Determine if target machine needs to provide a custom platform init 
files
+       if d.getVar("SOC_FAMILY") in ["zynq", "zynqmp"]:
+               if d.getVar("SPL_BINARY"):
                        # only add the dependency if u-bopt doesn't already 
provide the platform init files
-                       if d.getVar("FORCE_PS7INIT", True) or not 
bb.utils.contains("HAS_PS7INIT", d.getVar("UBOOT_MACHINE", True), True, False, 
d):
+                       if forceoverride or not (d.getVar("UBOOT_MACHINE") in 
hasconfigs):
                                # force the dependency on a recipe that 
provides the platform init files
-                               d.setVar("DEPENDS", "%s 
virtual/zynq7-platform-init" % d.getVar("DEPENDS", True))
+                               d.appendVar("DEPENDS", " 
virtual/xilinx-platform-init")
 
-               if d.getVar("SPL_BINARY", True) == "boot.bin":
+               if d.getVar("SPL_BINARY") == "boot.bin":
                        # Add this for backwards compatiblity
-                       d.setVar("PROVIDES", "%s virtual/boot-bin" % 
d.getVar("PROVIDES", True))
+                       d.setVar("PROVIDES", "%s virtual/boot-bin" % 
d.getVar("PROVIDES"))
 }
 
diff --git a/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb 
b/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb
index 5f38537621..99ce95a031 100644
--- a/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb
+++ b/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb
@@ -27,7 +27,7 @@ SRC_URI_append_zc702-zynq7 = " file://uEnv.txt"
 SRC_URI_append_zedboard-zynq7 = " file://uEnv.txt"
 
 # u-boot 2016.07 has support for these
-HAS_PS7INIT ?= " \
+HAS_PLATFORM_INIT ?= " \
                zynq_microzed_config \
                zynq_zed_config \
                zynq_zc702_config \
diff --git a/recipes-bsp/u-boot/u-boot_%.bbappend 
b/recipes-bsp/u-boot/u-boot_%.bbappend
index 8513670671..b852236998 100644
--- a/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -1,7 +1,7 @@
 include u-boot-spl-zynq-init.inc
 
 # u-boot 2016.11 has support for these
-HAS_PS7INIT ??= " \
+HAS_PLATFORM_INIT ??= " \
                zynq_microzed_config \
                zynq_zed_config \
                zynq_zc702_config \
-- 
2.11.0

-- 
_______________________________________________
meta-xilinx mailing list
meta-xilinx@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-xilinx

Reply via email to