From 70edc0b47d51473be5d819ecf1c4b9a067d18514 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Thu, 23 May 2024 09:51:43 -0600 Subject: meta-xilinx-standalone: Move to YP best practices Follow the examples from meta-virtualization on how to enable bbappends and set PREFERRED_VERSIONS. This will require the user to set XILINX_WITH_ESW to some value. Any value will enable the components in this layer at this time. We may choose to be more selective in the future. Signed-off-by: Mark Hatle --- .../classes/meta-xilinx-standalone-cfg.bbclass | 6 ++++++ .../classes/sanity-meta-xilinx-standalone.bbclass | 10 ++++++++++ .../meta-xilinx-standalone-default-versions.inc | 10 ++++++++++ meta-xilinx-standalone/conf/layer.conf | 23 +++++++++++++--------- 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 meta-xilinx-standalone/classes/meta-xilinx-standalone-cfg.bbclass create mode 100644 meta-xilinx-standalone/classes/sanity-meta-xilinx-standalone.bbclass create mode 100644 meta-xilinx-standalone/conf/distro/include/meta-xilinx-standalone-default-versions.inc (limited to 'meta-xilinx-standalone') diff --git a/meta-xilinx-standalone/classes/meta-xilinx-standalone-cfg.bbclass b/meta-xilinx-standalone/classes/meta-xilinx-standalone-cfg.bbclass new file mode 100644 index 00000000..a7367f7d --- /dev/null +++ b/meta-xilinx-standalone/classes/meta-xilinx-standalone-cfg.bbclass @@ -0,0 +1,6 @@ +# We need to load the ESW and related config components, only if XILINX_WITH_ESW +# is in defined in some way. Since we don't know the configuration during +# layer.conf load time, we delay using a special bbclass that simply includes +# the META_XILINX_STANDLONE_CONFIG_PATH file. + +include ${@'${META_XILINX_STANDALONE_CONFIG_PATH}' if d.getVar('XILINX_WITH_ESW') else ''} diff --git a/meta-xilinx-standalone/classes/sanity-meta-xilinx-standalone.bbclass b/meta-xilinx-standalone/classes/sanity-meta-xilinx-standalone.bbclass new file mode 100644 index 00000000..27d191c6 --- /dev/null +++ b/meta-xilinx-standalone/classes/sanity-meta-xilinx-standalone.bbclass @@ -0,0 +1,10 @@ +addhandler security_bbappend_distrocheck +security_bbappend_distrocheck[eventmask] = "bb.event.SanityCheck" +python security_bbappend_distrocheck() { + skip_check = e.data.getVar('SKIP_META_XILINX_STANDALONE_SANITY_CHECK') == "1" + if not e.data.getVar('XILINX_WITH_ESW') and not skip_check: + bb.warn("You have included the meta-xilinx-standalone layer, but \ +it has not been enabled using XILINX_WITH_ESW in your configuration. Some \ +bbappend files and preferred version setting may not take effect. See the \ +meta-security README for details on enabling security support.") +} diff --git a/meta-xilinx-standalone/conf/distro/include/meta-xilinx-standalone-default-versions.inc b/meta-xilinx-standalone/conf/distro/include/meta-xilinx-standalone-default-versions.inc new file mode 100644 index 00000000..1d17741b --- /dev/null +++ b/meta-xilinx-standalone/conf/distro/include/meta-xilinx-standalone-default-versions.inc @@ -0,0 +1,10 @@ + +# What version of ESW and related should we default to? +# Note, there is no 'esw' recipe, but we're going to use this for all +# of the related items in this layer. +PREFERRED_VERSION_esw ??= "${@(d.getVar('XILINX_RELEASE_VERSION') or 'undefined').replace('v', '')}" + +PREFERRED_VERSION_plm-firmware ??= "${PREFERRED_VERSION_esw}%" +PREFERRED_VERSION_psm-firmware ??= "${PREFERRED_VERSION_esw}%" +PREFERRED_VERSION_pmu-firmware ??= "${PREFERRED_VERSION_esw}%" +PREFERRED_VERSION_fsbl-firmware ??= "${PREFERRED_VERSION_esw}%" diff --git a/meta-xilinx-standalone/conf/layer.conf b/meta-xilinx-standalone/conf/layer.conf index ef4a919e..8087d5a6 100644 --- a/meta-xilinx-standalone/conf/layer.conf +++ b/meta-xilinx-standalone/conf/layer.conf @@ -17,12 +17,17 @@ LAYERRECOMMENDS_xilinx-standalone = "xilinx-microblaze" LAYERSERIES_COMPAT_xilinx-standalone = "scarthgap" -# What version of ESW and related should we default to? -# Note, there is no 'esw' recipe, but we're going to use this for all -# of the related items in this layer. -PREFERRED_VERSION_esw ??= "${@(d.getVar('XILINX_RELEASE_VERSION') or 'undefined').replace('v', '')}" - -PREFERRED_VERSION_plm-firmware ??= "${PREFERRED_VERSION_esw}%" -PREFERRED_VERSION_psm-firmware ??= "${PREFERRED_VERSION_esw}%" -PREFERRED_VERSION_pmu-firmware ??= "${PREFERRED_VERSION_esw}%" -PREFERRED_VERSION_fsbl-firmware ??= "${PREFERRED_VERSION_esw}%" +# Set this to enable this layer +#XILINX_WITH_ESW = "generic" + +# Sanity check for meta-xilinx-standalone layer. +# Setting SKIP_META_XILINX_STANDALONE_SANITY_CHECK to "1" would skip the bbappend files check. +INHERIT += "sanity-meta-xilinx-standalone" + +# We need to load the ESW and related config components, only if XILINX_WITH_ESW +# is in defined in some way. Since we don't know the configuration during +# layer.conf load time, we delay using a special bbclass that simply includes +# the META_XILINX_STANDLONE_CONFIG_PATH file. +META_XILINX_STANDALONE_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-xilinx-standalone-default-versions.inc" + +USER_CLASSES:append = " meta-xilinx-standalone-cfg" -- cgit v1.2.3-54-g00ecf