Skip to contentSkip to conversation

image types: split live into iso and hddimg

PATCH_V5 Valentin Popa 2 participants 4 messages Sep 19, 2013 – Sep 23, 2013

lore
Share & tools
lore
#0 lore raw

Changes to split live into iso and hddimg without adding a new image type class.
This patch has only a visible effect on HOB and solves part 2 of #3197

[YOCTO #3197]

---
 meta/classes/image.bbclass       | 13 ++++++++++++-
 meta/classes/image_types.bbclass | 13 +++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)
meta/classes/image.bbclass +12 -1
index f1e62f1..bbeb765 100644
@@ -87,7 +87,18 @@ do_rootfs[depends] += "makedevs-native:do_populate_sysroot virtual/fakeroot-nati
 do_rootfs[depends] += "virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot"
 do_rootfs[recrdeptask] += "do_packagedata"
 
-IMAGE_TYPE_live = '${@base_contains("IMAGE_FSTYPES", "live", "live", "empty", d)}'
+def build_live(d):
+    if base_contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg
+        d.setVar('NOISO', base_contains('IMAGE_FSTYPES', "iso", "0", "1", d))
+        d.setVar('NOHDD', base_contains('IMAGE_FSTYPES', "hddimg", "0", "1", d))
+        if d.getVar('NOISO', True) == "0" or d.getVar('NOHDD', True) == "0":
+            return "live"
+        return "empty"
+    return "live"
+
+IMAGE_TYPE_temp = "${@build_live(d)}"
+IMAGE_TYPE_live = "${@base_contains("IMAGE_FSTYPES", "live", "live", "${IMAGE_TYPE_temp}", d)}"
+
 inherit image-${IMAGE_TYPE_live}
 IMAGE_TYPE_vmdk = '${@base_contains("IMAGE_FSTYPES", "vmdk", "vmdk", "empty", d)}'
 inherit image-${IMAGE_TYPE_vmdk}
meta/classes/image_types.bbclass +9 -4
index 8c49169..9ead059 100644
@@ -43,12 +43,17 @@ def get_imagecmds(d):
         if "ext3" not in alltypes:
             alltypes.append("ext3")
         types.remove("vmdk")
-    if "live" in types:
+    if "live" in types or "iso" in types or "hddimg" in types:
         if "ext3" not in types:
             types.append("ext3")
         if "ext3" not in alltypes:
             alltypes.append("ext3")
-        types.remove("live")
+        if "live" in types:
+            types.remove("live")
+        if "iso" in types:
+            types.remove("iso")
+        if "hddimg" in types:
+            types.remove("hddimg")
 
     if d.getVar('IMAGE_LINK_NAME', True):
         if d.getVar('RM_OLD_IMAGE', True) == "1":
@@ -115,7 +120,7 @@ def imagetypes_getdepends(d):
     deps = []
     ctypes = d.getVar('COMPRESSIONTYPES', True).split()
     for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
-        if type == "vmdk" or type == "live":
+        if type == "vmdk" or type == "live" or type == "iso" or type == "hddimg":
             type = "ext3"
         basetype = type
         for ctype in ctypes:
@@ -230,7 +235,7 @@ IMAGE_DEPENDS_ubi = "mtd-utils-native"
 IMAGE_DEPENDS_ubifs = "mtd-utils-native"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
-IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs live squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf"
+IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs iso hddimg squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf"
 
 COMPRESSIONTYPES = "gz bz2 lzma xz"
 COMPRESS_CMD_lzma = "lzma -k -f -7 ${IMAGE_NAME}.rootfs.${type}"
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 24 lines · Valentin Popa

Changes to split live into iso and hddimg without adding a new image type class.
This patch has only a visible effect on HOB and solves part 2 of #3197

[YOCTO #3197]

---
  meta/classes/image.bbclass       | 13 ++++++++++++-
  meta/classes/image_types.bbclass | 13 +++++++++----
  2 files changed, 21 insertions(+), 5 deletions(-)
meta/classes/image.bbclass +2 -1
index f1e62f1..bbeb765 100644
@@ -87,7 +87,18 @@ do_rootfs[depends] += "makedevs-native:do_populate_sysroot virtual/fakeroot-nati
  do_rootfs[depends] += "virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot"
  do_rootfs[recrdeptask] += "do_packagedata"
 
-IMAGE_TYPE_live = '${@base_contains("IMAGE_FSTYPES", "live", "live", "empty", d)}'
+def build_live(d):
+    if base_contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg

meta/classes/image.bbclass do_rootfs[depends] += "makedevs-native:do_populate_sysroot virtual/fakeroot-nati · line 101

Quoted 10 lines
meta/classes/image.bbclass +10 -0
+        d.setVar('NOISO', base_contains('IMAGE_FSTYPES', "iso", "0", "1", d))
+        d.setVar('NOHDD', base_contains('IMAGE_FSTYPES', "hddimg", "0", "1", d))
+        if d.getVar('NOISO', True) == "0" or d.getVar('NOHDD', True) == "0":
+            return "live"
+        return "empty"
+    return "live"
+
+IMAGE_TYPE_temp = "${@build_live(d)}"
+IMAGE_TYPE_live = "${@base_contains("IMAGE_FSTYPES", "live", "live", "${IMAGE_TYPE_temp}", d)}"
+

I don't think you need the _temp thing anymore since you have the live check above, is that not correct?

Quoted 37 lines
meta/classes/image.bbclass +0 -0
  inherit image-${IMAGE_TYPE_live}
  IMAGE_TYPE_vmdk = '${@base_contains("IMAGE_FSTYPES", "vmdk", "vmdk", "empty", d)}'
  inherit image-${IMAGE_TYPE_vmdk}
meta/classes/image_types.bbclass +8 -3
index 8c49169..9ead059 100644
@@ -43,12 +43,17 @@ def get_imagecmds(d):
          if "ext3" not in alltypes:
              alltypes.append("ext3")
          types.remove("vmdk")
-    if "live" in types:
+    if "live" in types or "iso" in types or "hddimg" in types:
          if "ext3" not in types:
              types.append("ext3")
          if "ext3" not in alltypes:
              alltypes.append("ext3")
-        types.remove("live")
+        if "live" in types:
+            types.remove("live")
+        if "iso" in types:
+            types.remove("iso")
+        if "hddimg" in types:
+            types.remove("hddimg")
 
      if d.getVar('IMAGE_LINK_NAME', True):
          if d.getVar('RM_OLD_IMAGE', True) == "1":
@@ -115,7 +120,7 @@ def imagetypes_getdepends(d):
      deps = []
      ctypes = d.getVar('COMPRESSIONTYPES', True).split()
      for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
-        if type == "vmdk" or type == "live":
+        if type == "vmdk" or type == "live" or type == "iso" or type == "hddimg":
              type = "ext3"
          basetype = type
          for ctype in ctypes:

meta/classes/image_types.bbclass IMAGE_DEPENDS_ubi = "mtd-utils-native" · line 239

Quoted 6 lines
meta/classes/image_types.bbclass +1 -1
@@ -230,7 +235,7 @@ IMAGE_DEPENDS_ubi = "mtd-utils-native"
  IMAGE_DEPENDS_ubifs = "mtd-utils-native"
 
  # This variable is available to request which values are suitable for IMAGE_FSTYPES
-IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs live squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf"
+IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs iso hddimg squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf"
 

If live is still a valid type, why remove it from the IMAGE_TYPES list?

Sau!

Quoted 3 lines
meta/classes/image_types.bbclass +0 -0
  COMPRESSIONTYPES = "gz bz2 lzma xz"
  COMPRESS_CMD_lzma = "lzma -k -f -7 ${IMAGE_NAME}.rootfs.${type}"
#2 lore raw
Quoted 36 lines · Saul Wold
Quoted 35 lines · Valentin Popa

Changes to split live into iso and hddimg without adding a new image type class.
This patch has only a visible effect on HOB and solves part 2 of #3197

[YOCTO #3197]

---
  meta/classes/image.bbclass       | 13 ++++++++++++-
  meta/classes/image_types.bbclass | 13 +++++++++----
  2 files changed, 21 insertions(+), 5 deletions(-)
meta/classes/image.bbclass +0 -0
index f1e62f1..bbeb765 100644
@@ -87,7 +87,18 @@ do_rootfs[depends] += 

"makedevs-native:do_populate_sysroot virtual/fakeroot-nati
do_rootfs[depends] +=
"virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot"
do_rootfs[recrdeptask] += "do_packagedata"

-IMAGE_TYPE_live = '${@base_contains("IMAGE_FSTYPES", "live", "live", "empty", d)}'

meta/classes/image.bbclass +2 -0
+def build_live(d):
+    if base_contains("IMAGE_FSTYPES", "live", "live", "0", d) == 

"0": # live is not set but hob might set iso or hddimg
+ d.setVar('NOISO', base_contains('IMAGE_FSTYPES', "iso", "0",
"1", d))
+ d.setVar('NOHDD', base_contains('IMAGE_FSTYPES', "hddimg",
"0", "1", d))
+ if d.getVar('NOISO', True) == "0" or d.getVar('NOHDD', True)
== "0":
+ return "live"

Quoted 8 lines
Quoted 7 lines
meta/classes/image.bbclass +5 -0
+        return "empty"
+    return "live"
+
+IMAGE_TYPE_temp = "${@build_live(d)}"
+IMAGE_TYPE_live = "${@base_contains("IMAGE_FSTYPES", "live", "live", 

"${IMAGE_TYPE_temp}", d)}"
+

I don't think you need the _temp thing anymore since you have the live check above, is that not correct?

You are right, but tried to call "build_live" form "base_contains"
and gave me "ExpansionError during parsing ..."

Quoted 42 lines
Quoted 42 lines

inherit image-${IMAGE_TYPE_live}
IMAGE_TYPE_vmdk = '${@base_contains("IMAGE_FSTYPES", "vmdk",
"vmdk", "empty", d)}'
inherit image-${IMAGE_TYPE_vmdk}

meta/classes/image_types.bbclass +8 -3
index 8c49169..9ead059 100644
@@ -43,12 +43,17 @@ def get_imagecmds(d):
          if "ext3" not in alltypes:
              alltypes.append("ext3")
          types.remove("vmdk")
-    if "live" in types:
+    if "live" in types or "iso" in types or "hddimg" in types:
          if "ext3" not in types:
              types.append("ext3")
          if "ext3" not in alltypes:
              alltypes.append("ext3")
-        types.remove("live")
+        if "live" in types:
+            types.remove("live")
+        if "iso" in types:
+            types.remove("iso")
+        if "hddimg" in types:
+            types.remove("hddimg")
 
      if d.getVar('IMAGE_LINK_NAME', True):
          if d.getVar('RM_OLD_IMAGE', True) == "1":
@@ -115,7 +120,7 @@ def imagetypes_getdepends(d):
      deps = []
      ctypes = d.getVar('COMPRESSIONTYPES', True).split()
      for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
-        if type == "vmdk" or type == "live":
+        if type == "vmdk" or type == "live" or type == "iso" or type 

== "hddimg":
type = "ext3"
basetype = type
for ctype in ctypes:

meta/classes/image_types.bbclass +0 -0
@@ -230,7 +235,7 @@ IMAGE_DEPENDS_ubi = "mtd-utils-native"
  IMAGE_DEPENDS_ubifs = "mtd-utils-native"
 
Quoted 9 lines
Quoted 7 lines
meta/classes/image_types.bbclass +0 -0
  # This variable is available to request which values are suitable 

for IMAGE_FSTYPES
-IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3
ext3.gz ext2.lzma btrfs live squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf" +IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3
ext3.gz ext2.lzma btrfs iso hddimg squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf"

If live is still a valid type, why remove it from the IMAGE_TYPES list?

Because HOB displays everything that IMAGE_TYPES contains and is
not ok to have both "live" and "iso & hddimg".
Indeed this is a problem for the moment (that will be fixed with
the part 2 of #3197 : "display only those image types that make sense") if the user selects to build only the "iso" , but the machine has "live" specified, both "iso" and "hddimg" will be built.

Quoted 6 lines

Sau!

Quoted 3 lines
  COMPRESSIONTYPES = "gz bz2 lzma xz"
  COMPRESS_CMD_lzma = "lzma -k -f -7 ${IMAGE_NAME}.rootfs.${type}"
#3 lore raw
Quoted 48 lines · Valentin Popa
Quoted 38 lines · Saul Wold
Quoted 37 lines · Valentin Popa

Changes to split live into iso and hddimg without adding a new image type class.
This patch has only a visible effect on HOB and solves part 2 of #3197

[YOCTO #3197]

---
  meta/classes/image.bbclass       | 13 ++++++++++++-
  meta/classes/image_types.bbclass | 13 +++++++++----
  2 files changed, 21 insertions(+), 5 deletions(-)
meta/classes/image.bbclass +0 -0
index f1e62f1..bbeb765 100644
@@ -87,7 +87,18 @@ do_rootfs[depends] +=

"makedevs-native:do_populate_sysroot virtual/fakeroot-nati
do_rootfs[depends] +=
"virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot"
do_rootfs[recrdeptask] += "do_packagedata"

-IMAGE_TYPE_live = '${@base_contains("IMAGE_FSTYPES", "live", "live", "empty", d)}'

meta/classes/image.bbclass +2 -0
+def build_live(d):
+    if base_contains("IMAGE_FSTYPES", "live", "live", "0", d) ==

"0": # live is not set but hob might set iso or hddimg
+ d.setVar('NOISO', base_contains('IMAGE_FSTYPES', "iso", "0",
"1", d))
+ d.setVar('NOHDD', base_contains('IMAGE_FSTYPES', "hddimg",
"0", "1", d))
+ if d.getVar('NOISO', True) == "0" or d.getVar('NOHDD', True)
== "0":

meta/classes/image.bbclass +2 -0
+            return "live"
+        return "empty"
Quoted 8 lines
Quoted 6 lines
meta/classes/image.bbclass +4 -0
+    return "live"
+
+IMAGE_TYPE_temp = "${@build_live(d)}"
+IMAGE_TYPE_live = "${@base_contains("IMAGE_FSTYPES", "live", "live",

"${IMAGE_TYPE_temp}", d)}"
+

I don't think you need the _temp thing anymore since you have the live check above, is that not correct?

Quoted 2 lines

You are right, but tried to call "build_live" form "base_contains"
and gave me "ExpansionError during parsing ..."

But you don't need the second base_contains since you have that line in the build_live() function, you only need to set IMAGE_TYPE_live = ${@build_live(d)} now.

Quoted 54 lines
Quoted 43 lines
Quoted 43 lines

inherit image-${IMAGE_TYPE_live}
IMAGE_TYPE_vmdk = '${@base_contains("IMAGE_FSTYPES", "vmdk",
"vmdk", "empty", d)}'
inherit image-${IMAGE_TYPE_vmdk}

meta/classes/image_types.bbclass +8 -3
index 8c49169..9ead059 100644
@@ -43,12 +43,17 @@ def get_imagecmds(d):
          if "ext3" not in alltypes:
              alltypes.append("ext3")
          types.remove("vmdk")
-    if "live" in types:
+    if "live" in types or "iso" in types or "hddimg" in types:
          if "ext3" not in types:
              types.append("ext3")
          if "ext3" not in alltypes:
              alltypes.append("ext3")
-        types.remove("live")
+        if "live" in types:
+            types.remove("live")
+        if "iso" in types:
+            types.remove("iso")
+        if "hddimg" in types:
+            types.remove("hddimg")
 
      if d.getVar('IMAGE_LINK_NAME', True):
          if d.getVar('RM_OLD_IMAGE', True) == "1":
@@ -115,7 +120,7 @@ def imagetypes_getdepends(d):
      deps = []
      ctypes = d.getVar('COMPRESSIONTYPES', True).split()
      for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
-        if type == "vmdk" or type == "live":
+        if type == "vmdk" or type == "live" or type == "iso" or type

== "hddimg":
type = "ext3"
basetype = type
for ctype in ctypes:

meta/classes/image_types.bbclass +0 -0
@@ -230,7 +235,7 @@ IMAGE_DEPENDS_ubi = "mtd-utils-native"
  IMAGE_DEPENDS_ubifs = "mtd-utils-native"
 
Quoted 11 lines
Quoted 9 lines
meta/classes/image_types.bbclass +0 -0
  # This variable is available to request which values are suitable

for IMAGE_FSTYPES
-IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs live squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf" +IMAGE_TYPES = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs iso hddimg squashfs squashfs-xz ubi ubifs tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma vmdk elf"

If live is still a valid type, why remove it from the IMAGE_TYPES list?

Quoted 7 lines

Because HOB displays everything that IMAGE_TYPES contains and is
not ok to have both "live" and "iso & hddimg".
Indeed this is a problem for the moment (that will be fixed with
the part 2 of #3197 : "display only those image types that make sense") if the user selects to build only the "iso" , but the machine has "live" specified, both "iso" and "hddimg" will be built.

So are you saying there will be a patch in HOB that will just ignore the live type?

Sau!

Quoted 9 lines
Quoted 6 lines

Sau!

Quoted 3 lines
  COMPRESSIONTYPES = "gz bz2 lzma xz"
  COMPRESS_CMD_lzma = "lzma -k -f -7 ${IMAGE_NAME}.rootfs.${type}"