Skip to contentSkip to conversation

image_types: Fix bmaptool support for RSS

PATCH Superseded Tom Rini 4 participants 16 messages Sep 27, 2017 – Oct 2, 2017

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 image_types: Fix bmaptool support for RSS

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +3 -0
index 61dca626311e..3ff960e3a889 100644
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"
Signature · 1 line
1.9.1
#1 lore raw
Quoted 11 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

Doesn't bmap in Pyro use Python 2?

Ross

author
#2 lore raw
Quoted 7 lines · Ross
Quoted 5 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

Quoted 7 lines
Quoted 5 lines

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

Doesn't bmap in Pyro use Python 2?

I hadn't tested my fix in pyro yet, only confirmed that it was broken there. I'll check and get back to you on that part.

Signature · 1 line
Tom
author
#3 lore raw
Quoted 14 lines · Tom Rini
Quoted 13 lines · Ross
Quoted 10 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

Quoted 4 lines
Quoted 1 line

Doesn't bmap in Pyro use Python 2?

I hadn't tested my fix in pyro yet, only confirmed that it was broken there. I'll check and get back to you on that part.

OK, I need to investigate the pyro failure I saw more to see what else was going in there. Just oe-core pyro is fine as bamptool uses python2 and .../recipe-sysroot-native/usr/bin/bmaptool is /usr/bin/env nativepython which is also in usr/bin and is thus found.

Signature · 1 line
Tom
#4 lore raw
In reply to Tom Rini
Quoted 19 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +0 -0
index 61dca626311e..3ff960e3a889 100644

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"

Quoted 7 lines
meta/classes/image_types.bbclass +3 -1
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"
--

I think somewhere inherit python3native should fix it.

Quoted 7 lines

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#5 lore raw
Quoted 15 lines · Khem Raj
Quoted 14 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
Quoted 14 lines

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"

Quoted 12 lines
meta/classes/image_types.bbclass +3 -1
index 61dca626311e..3ff960e3a889 100644
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"
--

I think somewhere inherit python3native should fix it.

Yes, image_types.bbclass could also inherit python3native but that seemed heavy-handed. There's not some other place that should be doing it as the problem is saying we want to call bmaptool, and that's handled here.

Signature · 1 line
Tom
#6 lore raw
Quoted 6 lines · Tom Rini
Quoted 5 lines · Khem Raj
Quoted 4 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

Who is staging python3 native here may be that's where it could be added

Quoted 39 lines
Quoted 6 lines
Quoted 6 lines

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in

pyro

Quoted 6 lines

Review

Quoted 6 lines

as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

b/meta/classes/image_types.bbclass

Quoted 5 lines

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" · line 311

Quoted 5 lines

index 61dca626311e..3ff960e3a889 100644

meta/classes/image_types.bbclass +0 -0
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the

IMAGE_FSTYPES,

Quoted 1 line

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" · line 312

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2,

hdddirect, hddimg, iso, etc.

Quoted 4 lines

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"

Quoted 4 lines
meta/classes/image_types.bbclass +3 -0
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if

d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"

Quoted 3 lines
Quoted 1 line

--

I think somewhere inherit python3native should fix it.

Yes, image_types.bbclass could also inherit python3native but that seemed heavy-handed. There's not some other place that should be doing it as the problem is saying we want to call bmaptool, and that's handled here.

--
Tom

author
#7 lore raw
Quoted 10 lines · Khem Raj
Quoted 6 lines · Tom Rini
Quoted 5 lines · Khem Raj
Quoted 4 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

Who is staging python3 native here may be that's where it could be added

What do you mean? Adding whatever.bmap to IMAGE_FSTYPES is valid and how you get the bmap file for the whatever image type. bmap-tool-native is correctly inherit'ing python3native which is why it's staged correctly. It's just that images aren't adding the EXTRANATIVEPATH that's required because nothing is telling them that bmap requires it.

Quoted 40 lines
Quoted 40 lines
Quoted 7 lines
Quoted 7 lines

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in

pyro

Quoted 6 lines

Review

Quoted 6 lines

as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

b/meta/classes/image_types.bbclass

Quoted 5 lines

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" · line 311

Quoted 5 lines

index 61dca626311e..3ff960e3a889 100644

meta/classes/image_types.bbclass +0 -0
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the

IMAGE_FSTYPES,

Quoted 1 line

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" · line 312

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2,

hdddirect, hddimg, iso, etc.

Quoted 4 lines

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"

Quoted 4 lines
meta/classes/image_types.bbclass +3 -0
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if

d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"

Quoted 3 lines
Quoted 1 line

--

I think somewhere inherit python3native should fix it.

Yes, image_types.bbclass could also inherit python3native but that seemed heavy-handed. There's not some other place that should be doing it as the problem is saying we want to call bmaptool, and that's handled here.

--
Tom

Signature · 1 line
Tom
#8 lore raw
Quoted 10 lines · Tom Rini
Quoted 9 lines · Khem Raj
Quoted 6 lines · Tom Rini
Quoted 5 lines · Khem Raj
Quoted 4 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

Quoted 7 lines
Quoted 1 line

Who is staging python3 native here may be that's where it could be added

What do you mean? Adding whatever.bmap to IMAGE_FSTYPES is valid and how you get the bmap file for the whatever image type. bmap-tool-native is correctly inherit'ing python3native which is why it's staged correctly. It's just that images aren't adding the EXTRANATIVEPATH that's required because nothing is telling them that bmap requires it.

hmm, I see, I wonder if these paths should be added unconditionally. During image build.

#9 lore raw
In reply to Tom Rini
Quoted 5 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

Can you suggest how to reproduce the issue you're trying to fix with this patch?

Here is what I did:

1. Checked if bmaptools are available for host python3:

$ python3 -c 'import bmaptools'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'bmaptools'

2. Added cpio.bmap to my build configuration:

$ grep ^IMAGE_FSTYPES ./conf/local.conf 
IMAGE_FSTYPES = "cpio.bmap"

3. Built core-image-minimal:
[build (master)]$ rm -rf tmp/
[build (master)]$ bitbake core-image-minimal
...
NOTE: Tasks Summary: Attempted 2395 tasks of which 2186 didn't need to be rerun and all succeeded.

4. Checked if bmap file has been generated:
[build (master)]$ ls ./tmp/deploy/images/qemux86-64/ |grep cpio core-image-minimal-qemux86-64-20170928135949.rootfs.cpio.bmap core-image-minimal-qemux86-64.cpio.bmap

Hm, cpio image got removed for some reason. Looks like a bug, but not related to bmaptool. (I remember you're fixing that code some time ago).

Should I use another MACHINE or anything else that can trigger build failure?

PS. I used latest poky master. commit id: fcdfe09d9cc4e2977bd602dfd18f729cd9f6d73d

Quoted 28 lines

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +3 -0
index 61dca626311e..3ff960e3a889 100644
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
Regards,
Ed

author
#10 lore raw
Quoted 36 lines · Ed Bartosh
Quoted 5 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

Can you suggest how to reproduce the issue you're trying to fix with this patch?

Here is what I did:

1. Checked if bmaptools are available for host python3:

$ python3 -c 'import bmaptools'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'bmaptools'

2. Added cpio.bmap to my build configuration:

$ grep ^IMAGE_FSTYPES ./conf/local.conf 
IMAGE_FSTYPES = "cpio.bmap"

3. Built core-image-minimal:
[build (master)]$ rm -rf tmp/
[build (master)]$ bitbake core-image-minimal
...
NOTE: Tasks Summary: Attempted 2395 tasks of which 2186 didn't need to be rerun and all succeeded.

4. Checked if bmap file has been generated:
[build (master)]$ ls ./tmp/deploy/images/qemux86-64/ |grep cpio core-image-minimal-qemux86-64-20170928135949.rootfs.cpio.bmap core-image-minimal-qemux86-64.cpio.bmap

Quoted 7 lines

Hm, cpio image got removed for some reason. Looks like a bug, but not related to bmaptool. (I remember you're fixing that code some time ago).

Should I use another MACHINE or anything else that can trigger build failure?

PS. I used latest poky master. commit id: fcdfe09d9cc4e2977bd602dfd18f729cd9f6d73d

I'm on oe-core only, abf2e9526a11bcb51b71b90a7b76bd33af656494 and just replicated the problem again. I'm doing ext4.bmap, but that shouldn't matter.

Signature · 1 line
Tom
#11 lore raw
In reply to Tom Rini
Quoted 19 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +0 -0
index 61dca626311e..3ff960e3a889 100644

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" · line 316

Quoted 6 lines
meta/classes/image_types.bbclass +3 -0
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"

+1

Would ...find('.bmap') be a bit more safe?

--
Regards,
Ed

author
#12 lore raw
Quoted 29 lines · Ed Bartosh
Quoted 19 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +0 -0
index 61dca626311e..3ff960e3a889 100644

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" · line 316

Quoted 6 lines
meta/classes/image_types.bbclass +3 -0
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"

+1

Quoted 1 line

Would ...find('.bmap') be a bit more safe?

Could be. Do I need to v2 or can someone just fix up while applying? Thanks!

Signature · 1 line
Tom
#13 lore raw
Quoted 30 lines · Tom Rini
Quoted 29 lines · Ed Bartosh
Quoted 19 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
I played around with a few ways to try and fix this problem, and this was the best I could come up with. Once this is in we need this in pyro as well as it's broken there too.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +0 -0
index 61dca626311e..3ff960e3a889 100644

meta/classes/image_types.bbclass DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" · line 316

Quoted 6 lines
meta/classes/image_types.bbclass +3 -0
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('bmap') else ''}"

+1

Quoted 3 lines
Quoted 1 line

Would ...find('.bmap') be a bit more safe?

Could be. Do I need to v2 or can someone just fix up while applying?

Please send v2.

--
Regards,
Ed

author
#14 lore raw

PATCH v2 1/1 image_types: Fix bmaptool support for RSS

In reply to Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

---
Changes in v2:
- Switch to checking for '.bmap' not 'bmap', per Ed Bartosh.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +3 -0
index 61dca626311e..b373b217145f 100644
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('.bmap') else ''}"
Signature · 1 line
1.9.1
#15 lore raw
Quoted 5 lines · Tom Rini

With RSS we need to ensure that when making a bmap image that the python3 that we created is found via /usr/bin/env rather than the host python3. Otherwise we're relying on the build host to have bmaptool support installed.

Thank you for the patch.

+1

Quoted 27 lines

---
Changes in v2:
- Switch to checking for '.bmap' not 'bmap', per Ed Bartosh.

---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +3 -0
index 61dca626311e..b373b217145f 100644
@@ -311,3 +311,6 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
 # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
 # images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
+
+# bmap requires python3 to be in the PATH
+EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('.bmap') else ''}"
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 3 lines
--
Regards,
Ed