[oe-commits] [openembedded-core] 01/16: qemuboot.bbclass: add it for runqemu

git at git.openembedded.org git at git.openembedded.org
Sat Aug 20 15:18:51 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 51b11e8e7c49cc5e35bd644ad7a72726cc0ddf41
Author: Robert Yang <liezhi.yang at windriver.com>
AuthorDate: Mon Jul 18 01:35:55 2016 -0700

    qemuboot.bbclass: add it for runqemu
    
    It saves vars in ${DEPLOY_DIR_IMAGE}/qemuboot.py, and runqemu will
    import it.
    
    The bsp which can be boot by runqemu will inherit it.
    
    Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 meta/classes/qemuboot.bbclass | 59 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
new file mode 100644
index 0000000..6480021
--- /dev/null
+++ b/meta/classes/qemuboot.bbclass
@@ -0,0 +1,59 @@
+# Help runqemu boot target board, "QB" means Qemu Boot, the following
+# vars can be set in conf files, such as <bsp.conf> to make it can be
+# boot by runqemu:
+#
+# QB_SYSTEM_NAME: qemu name, e.g., "qemu-system-i386"
+# QB_OPT_APPEND: options to append to qemu, e.g., "-show-cursor"
+# QB_SERIAL_OPT: serial port, e.g., "-serial mon:stdio"
+# QB_DEFAULT_KERNEL: default kernel to boot, e.g., "bzImage"
+# QB_DEFAULT_FSTYPE: default FSTYPE to boot, e.g., "ext4"
+# QB_MEM: memory, e.g., "-m 512"
+# QB_MACHINE: qemu machine, e.g., "-machine virt"
+# QB_CPU: qemu cpu, e.g., "-cpu qemu32"
+# QB_CPU_KVM: the similar to QB_CPU, but used when kvm, e.g., '-cpu kvm64',
+#             set it when support kvm.
+# QB_KERNEL_CMDLINE_APPEND: options to append to kernel's -append
+#                           option, e.g., "console=ttyS0 console=tty"
+# QB_DTB: qemu dtb name
+# QB_AUDIO_DRV: qemu audio driver, e.g., "alsa", set it when support audio
+# QB_AUDIO_OPT: qemu audio option, e.g., "-soundhw ac97,es1370", used
+#               when QB_AUDIO_DRV is set.
+#
+# Not often used vars:
+# QB_ROOTFS_OPTIONS: used to replace runqemu's ROOTFS_OPTIONS
+# QB_NETWORK_CMD: used to replace runqemu's QB_NETWORK_CMD
+#
+# Usage:
+# IMAGE_CLASSES += "qemuboot"
+# See "runqemu help" for more info
+
+do_qemuboot_vars[nostamp] = "1"
+
+QB_MEM ?= "-m 256"
+QB_SERIAL_OPT ?= "-serial mon:stdio -serial null"
+QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}"
+QB_DEFAULT_FSTYPE ?= "ext4"
+QB_OPT_APPEND ?= "-show-cursor"
+
+do_qemuboot_vars[dirs] = "${DEPLOY_DIR_IMAGE}"
+python do_qemuboot_vars() {
+    build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE', \
+                'IMAGE_LINK_NAME', 'STAGING_DIR_NATIVE', \
+                'STAGING_BINDIR_NATIVE', 'STAGING_DIR_HOST']
+
+    # Vars from bsp
+    qb_vars = []
+
+    for k in d.keys():
+        if k.startswith('QB_'):
+            qb_vars.append(k)
+
+    out_file = "%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE', True), 'qemuboot.py')
+    with open(out_file, 'w') as f:
+        f.write('config_bsp = {\n')
+        for k in build_vars + qb_vars:
+            f.write("    '%s': '%s',\n" % (k, d.getVar(k, True)))
+        f.write('}\n')
+}
+
+addtask do_qemuboot_vars before do_build

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list