Skip to contentSkip to conversation

image-live: multiconfig ISO generation

PATCH In review Rich Persaud 2 participants 3 messages Mar 9, 2020 – Mar 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image-live: multiconfig ISO generation

When a target is specified for INITRD_IMAGE_LIVE, a task dependency is added for do_image_complete. At present, image-live initrd will not accept multiconfig dependency targets.

If BBMULTICONFIG is non-empty and INITRD_IMAGE_LIVE is a multiconfig target, use mcdepends instead of depends. The packaging recipe must also override machine-specific path construction of INITRD_LIVE.

Required to build an ISO with mixed machine types, a primary use case for multiconfig. This is a minimal fix to make multiconfig ISOs possible.

---
 meta/classes/image-live.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes/image-live.bbclass +4 -1
index 54058b350d..1afd48005a 100644
@@ -50,11 +50,14 @@ IMAGE_TYPES_MASKED += "live hddimg iso"
 python() {
     image_b = d.getVar('IMAGE_BASENAME')
     initrd_i = d.getVar('INITRD_IMAGE_LIVE')
+    depends_type = ('mcdepends' if (d.getVar('BBMULTICONFIG')
+                                    and initrd_i.count(':') == 3)
+                                else 'depends')
     if image_b == initrd_i:
         bb.error('INITRD_IMAGE_LIVE %s cannot use image live, hddimg or iso.' % initrd_i)
         bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.')
     elif initrd_i:
-        d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i)
+        d.appendVarFlag('do_bootimg', depends_type, ' %s:do_image_complete' % initrd_i)
 }
 
 HDDDIR = "${S}/hddimg"
Signature · 1 line
2.20.1
#1 lore raw
Quoted 3 lines · Rich Persaud

When a target is specified for INITRD_IMAGE_LIVE, a task dependency is added for do_image_complete. At present, image-live initrd will not accept multiconfig dependency targets.

Can you give an example? That might help with understanding what this is supposed to do.

Quoted 19 lines

If BBMULTICONFIG is non-empty and INITRD_IMAGE_LIVE is a multiconfig target, use mcdepends instead of depends. The packaging recipe must also override machine-specific path construction of INITRD_LIVE.

Required to build an ISO with mixed machine types, a primary use case for multiconfig. This is a minimal fix to make multiconfig ISOs possible.

---
  meta/classes/image-live.bbclass | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes/image-live.bbclass +0 -0
index 54058b350d..1afd48005a 100644

meta/classes/image-live.bbclass IMAGE_TYPES_MASKED += "live hddimg iso" · line 55

Quoted 6 lines
meta/classes/image-live.bbclass +3 -0
@@ -50,11 +50,14 @@ IMAGE_TYPES_MASKED += "live hddimg iso"
  python() {
      image_b = d.getVar('IMAGE_BASENAME')
      initrd_i = d.getVar('INITRD_IMAGE_LIVE')
+    depends_type = ('mcdepends' if (d.getVar('BBMULTICONFIG')
+                                    and initrd_i.count(':') == 3)
+                                else 'depends')

Potentially, this could be simplified:

 depends_type = 'mcdepends' if initrd_i.startswith('mc:') else 'depends'

?

Quoted 9 lines
meta/classes/image-live.bbclass +1 -1
      if image_b == initrd_i:
          bb.error('INITRD_IMAGE_LIVE %s cannot use image live, hddimg or iso.' % initrd_i)
          bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.')
      elif initrd_i:
-        d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i)
+        d.appendVarFlag('do_bootimg', depends_type, ' %s:do_image_complete' % initrd_i)
  }
 
  HDDDIR = "${S}/hddimg"
#2 lore raw
Quoted 7 lines · Joshua Watt



Quoted 4 lines · Rich Persaud

When a target is specified for INITRD_IMAGE_LIVE, a task dependency is added for do_image_complete. At present, image-live initrd will not accept multiconfig dependency targets.

Can you give an example? That might help with understanding what this is supposed to do.

Any initrd with a machine type that is different from the "machine type" of the ISO image, which may itself be a composite image of multiple machine types, e.g. virtual machines with logical property variances rather than physical architecture changes. The traditional notion of ISO "machine type" is already suspect in a multiconfig scenario, and need not imply that the initrd has an identical machine type.

For the purpose of this patch, let's assume an ISO could be built with different initramfs versions for testing, each with a different machine type. More generally, image-live translates the presence of an initrd to a recipe dependency which assumes a singleconfig target. This capability can be extended to multiconfig targets, if they are to be first-class targets throughout bitbake. If not, we can document a whitelist of bitbake features where multiconfig targets are permitted.

Quoted 27 lines
Quoted 18 lines

If BBMULTICONFIG is non-empty and INITRD_IMAGE_LIVE is a multiconfig target, use mcdepends instead of depends. The packaging recipe must also override machine-specific path construction of INITRD_LIVE.

Required to build an ISO with mixed machine types, a primary use case for multiconfig. This is a minimal fix to make multiconfig ISOs possible.

---
 meta/classes/image-live.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes/image-live.bbclass +0 -0
index 54058b350d..1afd48005a 100644

meta/classes/image-live.bbclass IMAGE_TYPES_MASKED += "live hddimg iso" · line 55

Quoted 6 lines
meta/classes/image-live.bbclass +3 -0
@@ -50,11 +50,14 @@ IMAGE_TYPES_MASKED += "live hddimg iso"
 python() {
     image_b = d.getVar('IMAGE_BASENAME')
     initrd_i = d.getVar('INITRD_IMAGE_LIVE')
+    depends_type = ('mcdepends' if (d.getVar('BBMULTICONFIG')
+                                    and initrd_i.count(':') == 3)
+                                else 'depends')

Potentially, this could be simplified:

Quoted 3 lines

depends_type = 'mcdepends' if initrd_i.startswith('mc:') else 'depends'

?

Yes, if this is the agreed-upon standard definition of a multiconfig target, which should perhaps be a reusable validation function? If a singleconfig target is specified for mcdepends, bitbake prints an error message which cites three colons in the target definition, as the minimum requirement for a multiconfig target. I haven't traced the code which generates that error, or tested an mcdepends target which has three colons but does not begin with 'mc'. There must be several places which need to perform this validation, it would be good to share a common function/snippet.

Quoted 14 lines
Quoted 9 lines
meta/classes/image-live.bbclass +1 -1
     if image_b == initrd_i:
         bb.error('INITRD_IMAGE_LIVE %s cannot use image live, hddimg or iso.' % initrd_i)
         bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.')
     elif initrd_i:
-        d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i)
+        d.appendVarFlag('do_bootimg', depends_type, ' %s:do_image_complete' % initrd_i)
 }
   HDDDIR = "${S}/hddimg"
Signature · 4 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core