[meta-xilinx] [PATCH 3/7] u-boot-spl-zynq-init.inc: Use task and rework logic
Nathan Rossi
nathan at nathanrossi.com
Fri Oct 13 05:42:26 PDT 2017
On 7 October 2017 at 19:57, Nathan Rossi <nathan at nathanrossi.com> wrote:
> Change the include so that is adds a task for platform-init setup when
> required. This avoids the need to modify the do_configure task which
> prevents changes to its taskhash and avoids issues with taskhash
> modification when the meta-xilinx layer is added but no configuration is
> changed or used from it.
>
> Improve the logic around how configs are detected such that
> UBOOT_MACHINE can specify either the make target or the defconfig file
> name (e.g. *_config or *_defconfig). U-Boot and u-boot.inc accept both
> targets as valid configs since the values are passed directory to
> U-Boot's kbuild/kconfig.
>
> This change also drops compatibility with the older variable names
> HAS_PS7INIT and FORCE_PS7INIT. Additionally the 'virtual/boot-bin'
> provide logic was broken in most cases since SPL_BINARY =
> "spl/boot.bin", so remove it.
>
> Clean up use of tabs in python.
>
> Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
> ---
> recipes-bsp/u-boot/u-boot-spl-zynq-init.inc | 69 +++++++++++++++--------------
> recipes-bsp/u-boot/u-boot-xlnx-dev.bb | 2 +-
> 2 files changed, 36 insertions(+), 35 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 6fd6559d19..60c95cd69b 100644
> --- a/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc
> +++ b/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc
> @@ -1,48 +1,49 @@
> inherit xilinx-platform-init
>
> +FORCE_PLATFORM_INIT[doc] = "This variable is used to force the overriding of all platform init files in u-boot source."
> +
> 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/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
> +do_zynq_platform_init() {
> + 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
> }
>
> -FORCE_PLATFORM_INIT[doc] = "This variable is used to force the overriding of all platform init files in u-boot source."
> -
> python () {
> - 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"))
> + # strip the tail _config/_defconfig for better comparison
> + def strip_config_name(c):
> + for i in ["_config", "_defconfig"]:
> + if c.endswith(i):
> + return c[0:len(c) - len(i)]
> + return c
>
> - # 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-boot doesn't already provide the platform init files
> - if forceoverride or not (d.getVar("UBOOT_MACHINE") in hasconfigs):
> - # force the dependency on a recipe that provides the platform init files
> - d.appendVar("DEPENDS", " virtual/xilinx-platform-init")
> + # Determine if target machine needs to provide a custom platform init files
> + if d.getVar("SPL_BINARY") and d.getVar("SOC_FAMILY") in ["zynq", "zynqmp"]:
> + hasconfigs = [strip_config_name(c) for c in (d.getVar("HAS_PLATFORM_INIT") or "").split()]
> + currentconfig = strip_config_name(d.getVar("UBOOT_MACHINE"))
>
> - if d.getVar("SPL_BINARY") == "boot.bin":
> - # Add this for backwards compatibility
> - d.setVar("PROVIDES", "%s virtual/boot-bin" % d.getVar("PROVIDES"))
> + # only add the dependency if u-boot doesn't already provide the platform init files
> + if (currentconfig not in hasconfigs) or (d.getVar("FORCE_PLATFORM_INIT") == "1"):
> + # force the dependency on a recipe that provides the platform init files
> + d.appendVar("DEPENDS", " virtual/xilinx-platform-init")
> + # setup task to modify platform init after unpack and before configure
> + bb.build.addtask("do_zynq_platform_init", "do_configure", "do_unpack", d)
The do_unpack here should be do_prepare_recipe_sysroot since the
platform init files are being consumed from the sysroot.
I've updated the patch here:
https://github.com/nathanrossi/meta-xilinx/commit/bf9c55f9b3e76cc0bc99a08f8b0dbb10e0f01850
Regards,
Nathan
> }
>
> diff --git a/recipes-bsp/u-boot/u-boot-xlnx-dev.bb b/recipes-bsp/u-boot/u-boot-xlnx-dev.bb
> index 7653da5a4b..3e40bfa173 100644
> --- a/recipes-bsp/u-boot/u-boot-xlnx-dev.bb
> +++ b/recipes-bsp/u-boot/u-boot-xlnx-dev.bb
> @@ -18,7 +18,7 @@ SRCREV ?= "${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/bootloader", "u-b
> PV = "${UBRANCH}-xilinx-dev+git${SRCPV}"
>
> # Newer versions of u-boot have support for these
> -HAS_PS7INIT ?= " \
> +HAS_PLATFORM_INIT ?= " \
> zynq_microzed_config \
> zynq_zed_config \
> zynq_zc702_config \
> --
> 2.14.2
>
>
More information about the meta-xilinx
mailing list