summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/builder.py
diff options
context:
space:
mode:
authorMirela Rabulea <mirela.rabulea@nxp.com>2016-01-19 16:31:38 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-18 07:41:15 +0000
commit5a87d8c477ea829012785f2b284307c56f42787c (patch)
treede73af1a2b4b488ad992471b8207dfa95f6c8e84 /bitbake/lib/bb/ui/crumbs/builder.py
parent7fc38ead6819e83e7e1bcc46b708067adf2ff2b5 (diff)
downloadpoky-5a87d8c477ea829012785f2b284307c56f42787c.tar.gz
bitbake: Allow Hob to run images on a custom simulator, other than qemu
The current behavior of Hob is that there is a "Run Image" button which becomes visible only for qemu images. My suggested change is: - if an image is selected and it is qemu-compatible, let the "Run image" button be named "Run qemu image" - if an image is selected and it is not qemu-compatible, let the same button show up with the name "Run custom image", and besides that, an option shows-up to allow the selection of the custom script (by default it points out to runqemu script) to be used for launching this custom image 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] (Bitbake rev: cc4cfc2370297b8feb2dc39d4262e73adf06c09a) Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/builder.py')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index dcc4104262..457cadc77a 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -1359,6 +1359,25 @@ class Builder(gtk.Window):
1359 1359
1360 return kernel_path 1360 return kernel_path
1361 1361
1362 def show_load_run_script_dialog(self):
1363 dialog = gtk.FileChooserDialog("Select Run Script", self,
1364 gtk.FILE_CHOOSER_ACTION_OPEN)
1365 button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
1366 HobAltButton.style_button(button)
1367 button = dialog.add_button("Select", gtk.RESPONSE_YES)
1368 HobButton.style_button(button)
1369
1370 dialog.set_current_folder(self.parameters.image_addr)
1371
1372 response = dialog.run()
1373 run_script_path = ""
1374 if response == gtk.RESPONSE_YES:
1375 run_script_path = dialog.get_filename()
1376
1377 dialog.destroy()
1378
1379 return run_script_path
1380
1362 def runqemu_image(self, image_name, kernel_name): 1381 def runqemu_image(self, image_name, kernel_name):
1363 if not image_name or not kernel_name: 1382 if not image_name or not kernel_name:
1364 lbl = "<b>Please select %s to launch in QEMU.</b>" % ("a kernel" if image_name else "an image") 1383 lbl = "<b>Please select %s to launch in QEMU.</b>" % ("a kernel" if image_name else "an image")
@@ -1397,6 +1416,46 @@ class Builder(gtk.Window):
1397 dialog.run() 1416 dialog.run()
1398 dialog.destroy() 1417 dialog.destroy()
1399 1418
1419 def run_custom_image(self, image_name, custom_sim_path):
1420 if not image_name or not custom_sim_path:
1421 if not image_name:
1422 lbl = "<b>Please select an image to launch in the custom simulator.</b>"
1423 else:
1424 lbl = "<b>Please select a custom simulator for launching the selected image.</b>"
1425 dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO)
1426 button = dialog.add_button("Close", gtk.RESPONSE_OK)
1427 HobButton.style_button(button)
1428 dialog.run()
1429 dialog.destroy()
1430 return
1431
1432 image_path = os.path.join(self.parameters.image_addr, image_name)
1433
1434 source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env")
1435 tmp_path = self.parameters.tmpdir
1436 cmdline = bb.ui.crumbs.utils.which_terminal()
1437 if os.path.exists(image_path) and os.path.exists(custom_sim_path) \
1438 and os.path.exists(source_env_path) and os.path.exists(tmp_path) \
1439 and cmdline:
1440 cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; "
1441 cmdline += "source " + source_env_path + " " + os.getcwd() + "; "
1442 cmdline += custom_sim_path + " " + image_path + "\"\'"
1443 subprocess.Popen(shlex.split(cmdline))
1444 else:
1445 lbl = "<b>Path error</b>"
1446 msg = "One of your paths is wrong,"
1447 msg = msg + " please make sure the following paths exist:\n"
1448 msg = msg + "image path:" + image_path + "\n"
1449 msg = msg + "custom simulator path:" + custom_sim_path + "\n"
1450 msg = msg + "source environment path:" + source_env_path + "\n"
1451 msg = msg + "tmp path: " + tmp_path + "."
1452 msg = msg + "You may be missing either xterm or vte for terminal services."
1453 dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg)
1454 button = dialog.add_button("Close", gtk.RESPONSE_OK)
1455 HobButton.style_button(button)
1456 dialog.run()
1457 dialog.destroy()
1458
1400 def show_packages(self): 1459 def show_packages(self):
1401 self.package_details_page.refresh_tables() 1460 self.package_details_page.refresh_tables()
1402 self.switch_page(self.PACKAGE_SELECTION) 1461 self.switch_page(self.PACKAGE_SELECTION)