[yocto] [meta-zephyr][morty][PATCH 7/7] zephyr-qemuboot.bbclass
Juro Bystricky
juro.bystricky at intel.com
Sat Feb 4 10:36:50 PST 2017
A bbclass used to generate qemuboot.conf and various symbolic
links needed to properly run "runqemu".
Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
classes/zephyr-qemuboot.bbclass | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 classes/zephyr-qemuboot.bbclass
diff --git a/classes/zephyr-qemuboot.bbclass b/classes/zephyr-qemuboot.bbclass
new file mode 100644
index 0000000..2f9c4f1
--- /dev/null
+++ b/classes/zephyr-qemuboot.bbclass
@@ -0,0 +1,39 @@
+inherit qemuboot
+
+KERNEL_IMAGETYPE = "${PN}.elf"
+QB_DEFAULT_FSTYPE = "elf"
+QB_NETWORK_DEVICE = "none"
+QB_NET = "none"
+
+IMAGE_LINK_NAME = "${PN}-image-${MACHINE}"
+
+# Create a link with "-image-" in the name just to keep runqemu happy
+QEMU_IMAGE_LINK = "${DEPLOY_DIR_IMAGE}/${PN}-image-${MACHINE}.elf"
+
+# qemuboot writes into IMGDEPLOYDIR, force to write to DEPLOY_DIR_IMAGE
+IMGDEPLOYDIR = "${DEPLOY_DIR_IMAGE}"
+
+CLEANFUNCS += "bootconf_clean"
+
+python bootconf_clean() {
+ import glob
+ files = glob.glob(d.getVar('IMGDEPLOYDIR', True)+'/'+ d.getVar('PN', True) + '*.qemuboot.conf')
+ for f in files:
+ os.remove(f)
+
+ qemuimage_link = d.getVar('QEMU_IMAGE_LINK', True)
+ if os.path.lexists(qemuimage_link):
+ os.remove(qemuimage_link)
+}
+
+python do_bootconf_write() {
+ bb.build.exec_func("write_qemuboot_conf", d)
+
+ qemuimage = "%s/%s.elf" % (d.getVar('DEPLOY_DIR_IMAGE', True), d.getVar('PN', True))
+ qemuimage_link = d.getVar('QEMU_IMAGE_LINK', True)
+ if os.path.lexists(qemuimage_link):
+ os.remove(qemuimage_link)
+ os.symlink(os.path.basename(qemuimage), qemuimage_link)
+}
+
+addtask do_bootconf_write before do_build after do_deploy
--
2.7.4
More information about the yocto
mailing list