[bitbake-devel] [PATCH] Fix bug 8940 - Alow Hob to run images on a custom simulator, other than qemu

Mirela Rabulea mirela.rabulea at nxp.com
Fri Feb 12 22:43:57 UTC 2016


Hi Joshua,
I got my own core-image-minimal for non-qemu machine (genericx86-64) and I can reproduce the same behavior you saw, please see more explaining below.
I have made a v3 patch to fix this, only v3 changes at the end of email, for easier review.
The squashed version of the patch is attached (initial changes+v2+v3), with updated comment:
	"Note: in case there is more than one toggled image (qemu runnable or deployable), when the user clicks the "Run custom image" button, a dialog will be presented, allowing to choose between any of the existing images."

> -----Original Message-----
> From: bitbake-devel-bounces at lists.openembedded.org [mailto:bitbake-
> devel-bounces at lists.openembedded.org] On Behalf Of Mirela Rabulea
> Sent: Thursday, February 11, 2016 1:19 PM
> To: Joshua G Lock <joshua.g.lock at linux.intel.com>; bitbake-
> devel at lists.openembedded.org
> Cc: Nicolae Manescu <nicu.manescu at nxp.com>; Alexandru Purice
> <alexandru.purice at nxp.com>; Roman, Alexandru CostinX
> <alexandru.costinx.roman at intel.com>; Voiculescu, BogdanX A
> <bogdanx.a.voiculescu at intel.com>
> Subject: Re: [bitbake-devel] [PATCH] Fix bug 8940 - Alow Hob to run images
> on a custom simulator, other than qemu
> 
> 
> > but when I click 'Run custom image' I get a dialogue asking to 'Select
> > the image file you want to run:' with 'Cancel' and 'Run image' buttons
> > but nothing listing selectable images (I even tried resizing the
> > dialogue, to no avail). If I proceed to click 'Run image' button the 'Usb
> image maker'
> > dialogue is presented.
> >
> 
> That must come from poky\bitbake\lib\bb\ui\crumbs\imagedetailspage.py,
> show_builded_images_dialog(). I'm not sure how I can reproduce this
> without waiting a day to build another image, and without some tens of GB
> which I don't know if I have. I will try it but it will take a while. In the
> meantime, if you still have the environment, could you add this print in your
> imagedetailspage.py, it will let us see how many toggled images you have (I
> suspect is more than 1), and which ones (it shows up in the terminal where
> hob was started):
>             self.image_store.append({'name': image_name,
>                                     'type': image_type,
>                                     'size': image_size,
>                                     'is_toggled': is_toggled,
>                                     'action_attr': image_attr,})
> 
>             print "image_store.append(image_name=", image_name, "
> image_type=", image_type, " image_size=", image_size, " is_toggled=",
> is_toggled, " image_attr=", image_attr, ")"
> 

So this was happening not only after the image build is done, but also after the same image was loaded. It depends on what types of files are created for the image. In the case of  core-image-minimal/genericx86-64, 4 files were created, 2 of them with the attribute "deploy" and the other 2 nor runnable (qemu way) or deployable. The 2 deployable files got marked as toggled, but since no runnable image was toggled, when the "Run custom image" button was pressed, no available file was presented. This issue was manifesting only when there was more than one toggled image, and I did not see this case with the images I had built so far, so thanks a lot for this testcase. The v3 patch that I made is fixing show_builded_images_dialog(), allowing the user to choose for custom run any of the existing files.


And here's the v3 patch:
>From b6534c8b9166c4ba6f005df252cdb7c491fd1ee3 Mon Sep 17 00:00:00 2001
From: Mirela Rabulea <mirela.rabulea at nxp.com>
Date: Fri, 12 Feb 2016 23:37:28 +0200
Subject: [PATCH] Allow Hob to run images on a custom simulator, other than
 qemu - review feedback no. 2 Note: in case there is more than one toggled
 image (qemu runnable or deployable), when the user clicks the "Run custom
 image" button, a dialog will be presented, allowing to choose between any of
 the existing images.

[YOCTO #8940]

Signed-off-by: Mirela Rabulea <mirela.rabulea at nxp.com>
---
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 6cce8a1..b22cf80 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -284,8 +284,6 @@ class ImageDetailsPage (HobPage):
             if not self.toggled_image:
                 if i == (len(image_names) - 1):
                     is_toggled = True
-                    # if there was no qemu runable image, let one image be custom run
-                    image_attr = "run_custom"
                 if is_toggled:
                     default_image_size = image_size
                     self.toggled_image = image_name
@@ -501,7 +499,9 @@ class ImageDetailsPage (HobPage):
             if  (action_attr == 'run' and primary_action == "Run image") \
              or (action_attr == 'deploy' and primary_action == "Deploy image"):
                 action_images.append(fileitem)
-
+        if  (len(action_images) == 0 and primary_action == "Run image"):
+            # if there are no qemu runnable images, let the user choose any of the existing images for custom run
+            action_images = self.image_store
         # pack the corresponding 'runnable' or 'deploy' radio_buttons, if there has no more than one file.
         # assume that there does not both have 'deploy' and 'runnable' files in the same building result
         # in possible as design.
@@ -516,7 +516,8 @@ class ImageDetailsPage (HobPage):
         for fileitem in action_images:
             sel_btn = gtk.RadioButton(sel_parent_btn, fileitem['type'])
             sel_parent_btn = sel_btn if not sel_parent_btn else sel_parent_btn
-            sel_btn.set_active(fileitem['is_toggled'])
+            if fileitem['name'] == self.toggled_image:
+                sel_btn.set_active(True)
             sel_btn.connect('toggled', self.table_selected_cb, fileitem)
             if curr_row < 10:
                 table.attach(sel_btn, 0, 4, curr_row, curr_row + 1, xpadding=24)
@@ -540,15 +541,15 @@ class ImageDetailsPage (HobPage):
 
         if response != gtk.RESPONSE_YES:
             return
-
+        # perform the primary action on the image selected by the user
         for fileitem in self.image_store:
-            if fileitem['is_toggled']:
-                if fileitem['action_attr'] == 'run':
+            if fileitem['name'] == self.toggled_image:
+                if (fileitem['action_attr'] == 'run' and primary_action == "Run image"):
                     self.builder.runqemu_image(fileitem['name'], self.sel_kernel)
-                elif fileitem['action_attr'] == 'run_custom':
-                    self.builder.run_custom_image(fileitem['name'], self.run_script_path)
-                elif fileitem['action_attr'] == 'deploy':
+                elif (fileitem['action_attr'] == 'deploy' and primary_action == "Deploy image"):
                     self.builder.deploy_image(fileitem['name'])
+                elif (primary_action == "Run image"):
+                    self.builder.run_custom_image(fileitem['name'], self.run_script_path)
 
     def table_selected_cb(self, tbutton, image):
         image['is_toggled'] = tbutton.get_active()
-- 
1.9.1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_8940_squashed_v3.patch
Type: application/octet-stream
Size: 13089 bytes
Desc: bug_8940_squashed_v3.patch
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20160212/e5eefaa4/attachment-0002.obj>


More information about the bitbake-devel mailing list