All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH V3 1/8] qemuboot.bbclass: add it for runqemu
Date: Thu, 18 Aug 2016 23:55:22 -0700	[thread overview]
Message-ID: <6a8bf355b9d0dc51867f58a885b1da8fd050d234.1471589537.git.liezhi.yang@windriver.com> (raw)
In-Reply-To: <cover.1471589537.git.liezhi.yang@windriver.com>

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@windriver.com>
---
 meta/classes/qemuboot.bbclass | 59 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 meta/classes/qemuboot.bbclass

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
-- 
2.9.0



  reply	other threads:[~2016-08-19  6:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19  6:55 [PATCH V3 0/8] runqemu: refactor it and remove machine knowledge Robert Yang
2016-08-19  6:55 ` Robert Yang [this message]
2016-08-19  6:55 ` [PATCH V3 2/8] qemuarm.conf: set vars for runqemu Robert Yang
2016-08-19  6:55 ` [PATCH V3 3/8] qemuarm64.conf: " Robert Yang
2016-08-19  6:55 ` [PATCH V3 4/8] qemux86.conf/qemux86-64.conf: " Robert Yang
2016-08-19  6:55 ` [PATCH V3 5/8] qemumips/qemumips64.conf: " Robert Yang
2016-08-19  6:55 ` [PATCH V3 6/8] qemuppc.conf: " Robert Yang
2016-08-19  6:55 ` [PATCH V3 7/8] qemu.inc: inherit qemuboot.bbclass Robert Yang
2016-08-19  6:55 ` [PATCH V3 8/8] runqemu: refactor it and remove machine knowledge Robert Yang
2016-08-19  7:52   ` Nathan Rossi
2016-08-19  8:20     ` Robert Yang
2016-08-19  8:52       ` Nathan Rossi
2016-08-19  9:34         ` Robert Yang
2016-08-20 20:09 ` [PATCH V3 0/8] " Richard Purdie
2016-08-22  5:49   ` Robert Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a8bf355b9d0dc51867f58a885b1da8fd050d234.1471589537.git.liezhi.yang@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.