* this still assumes that IMAGE_LINK_NAME will contain IMAGE_BASENAME
  which will be BPN 'multiconfig-image-packager' and that replacing
  it with 'core-image-minimal' will match with the actual IMAGE_LINK_NAME
  from core-image-minimal recipe - there is no good way to query
  core-image-minimal's context, but this is still closer than assuming:
  core-image-minimal-${MCMACHINE}.${MCIMGTYPE}
  which works only with the current default:
  IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"

[YOCTO #12937]

Signed-off-by: Martin Jansa <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
---
 .../multiconfig-image-packager_0.1.bb          | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/meta-selftest/recipes-test/multiconfig/multiconfig-image-packager_0.1.bb 
b/meta-selftest/recipes-test/multiconfig/multiconfig-image-packager_0.1.bb
index daf2834958..d7785cee2e 100644
--- a/meta-selftest/recipes-test/multiconfig/multiconfig-image-packager_0.1.bb
+++ b/meta-selftest/recipes-test/multiconfig/multiconfig-image-packager_0.1.bb
@@ -7,15 +7,19 @@ MCIMGTYPE:virtclass-mcextend-musl = "ext4"
 MCIMGTYPE:virtclass-mcextend-tiny = "cpio.gz"
 
 MC_DEPLOY_DIR_IMAGE = "${TOPDIR}/tmp-mc-${MCNAME}/deploy/images/${MCMACHINE}"
+MC_DEPLOY_IMAGE_BASENAME = "core-image-minimal"
 
 do_install[mcdepends] += "mc::${MCNAME}:core-image-minimal:do_image_complete 
mc::${MCNAME}:virtual/kernel:do_deploy"
 
 do_install () {
     install -d ${D}/var/lib/machines/${MCNAME}
-    install 
${MC_DEPLOY_DIR_IMAGE}/core-image-minimal-${MCMACHINE}.${MCIMGTYPE} 
${D}/var/lib/machines/${MCNAME}/core-image-minimal.${MCIMGTYPE}
+    install 
${MC_DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME_CORE_IMAGE_MINIMAL}.${MCIMGTYPE} 
${D}/var/lib/machines/${MCNAME}/${MC_DEPLOY_IMAGE_BASENAME}.${MCIMGTYPE}
     install ${MC_DEPLOY_DIR_IMAGE}/bzImage ${D}/var/lib/machines/${MCNAME}
 }
 
+# for IMAGE_LINK_NAME, IMAGE_BASENAME
+inherit image-artifact-names
+
 python () {
     mcname = d.getVar('MCNAME')
     if not mcname:
@@ -23,6 +27,18 @@ python () {
     multiconfigs = d.getVar('BBMULTICONFIG') or ""
     if mcname not in multiconfigs:
         raise bb.parse.SkipRecipe("multiconfig target %s not enabled" % mcname)
+
+    # these will most likely start with my BPN multiconfig-image-packager, but 
I want them from core-image-minimal
+    # as there is no good way to query core-image-minimal's context lets 
assume that there are no overrides
+    # and that we can just replace IMAGE_BASENAME
+    image_link_name = d.getVar('IMAGE_LINK_NAME')
+    image_basename = d.getVar('IMAGE_BASENAME')
+    machine = d.getVar('MACHINE')
+    mcmachine = d.getVar('MCMACHINE')
+    image_to_deploy = d.getVar('MC_DEPLOY_IMAGE_BASENAME')
+    image_link_name_to_deploy = image_link_name.replace(image_basename, 
image_to_deploy).replace(machine, mcmachine)
+    bb.warn('%s: assuming that "%s" built for "%s" has IMAGE_LINK_NAME "%s"' % 
(d.getVar('PN'), mcmachine, image_to_deploy, image_link_name_to_deploy))
+    d.setVar('IMAGE_LINK_NAME_CORE_IMAGE_MINIMAL', image_link_name_to_deploy)
 }
 
 BBCLASSEXTEND = "mcextend:tiny mcextend:musl"
-- 
2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182680): 
https://lists.openembedded.org/g/openembedded-core/message/182680
Mute This Topic: https://lists.openembedded.org/mt/99486942/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to