runqemu: Fixes for QB_MEM and qemuparams
PATCH 1/2 runqemu: Let qemuparams override default settings
In reply to Robert YangFixed:
In meta/conf/machine/include/qemuboot-x86.inc:
QB_CPU_x86-64 = "-cpu core2duo"
$ runqemu qemux86-64 qemuparams="-cpu coreduo" Check /proc/cpuinfo, it should use coreduo rather than core2duo since user specifies it, but it doesn't, append qemuparams to the last can fix the problem.
[YOCTO #11773]
--- scripts/runqemu | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
scripts/runqemu +11 -2
@@ -189,6 +189,7 @@ class BaseConfig(object): self.qemu_opt = '' self.qemu_opt_script = '' + self.qemuparams = '' self.clean_nfs_dir = False self.nfs_server = '' self.rootfs = ''
@@ -460,7 +461,7 @@ class BaseConfig(object): elif arg.startswith('biosfilename='): self.qemu_opt_script += ' -bios %s' % arg[len('biosfilename='):] elif arg.startswith('qemuparams='): - self.qemu_opt_script += ' %s' % arg[len('qemuparams='):] + self.qemuparams = ' %s' % arg[len('qemuparams='):] elif arg.startswith('bootparams='): self.bootparams = arg[len('bootparams='):] elif os.path.exists(arg) or (re.search(':', arg) and re.search('/', arg)):
@@ -667,7 +668,11 @@ class BaseConfig(object): raise RunQemuError("Invalid custombiosdir: %s" % self.custombiosdir) def check_mem(self): - s = re.search('-m +([0-9]+)', self.qemu_opt_script) + """ + Both qemu and kernel needs memory settings, so check QB_MEM and set it + for both. + """ + s = re.search('-m +([0-9]+)', self.qemuparams) if s: self.set('QB_MEM', '-m %s' % s.group(1)) elif not self.get('QB_MEM'):
@@ -1169,6 +1174,10 @@ class BaseConfig(object): self.qemu_opt += ' ' + self.qemu_opt_script + # Append qemuparams to override previous settings + if self.qemuparams: + self.qemu_opt += ' ' + self.qemuparams + if self.snapshot: self.qemu_opt += " -snapshot"
Signature · 1 line
2.7.4
PATCH 2/2 runqemu: Make QB_MEM easier to set
In reply to Robert YangIt only could be set as the following in the past:QB_MEM = "-m 256"
Now it also can be set as:QB_MEM = "-m 256M (or m)"QB_MEM = "256M (or m)"
[YOCTO #11522]
--- scripts/runqemu | 11 +++++++++++ 1 file changed, 11 insertions(+)
scripts/runqemu +11 -0
@@ -679,6 +679,17 @@ class BaseConfig(object): logger.info('QB_MEM is not set, use 512M by default') self.set('QB_MEM', '-m 512') + # Check and remove M or m suffix + qb_mem = self.get('QB_MEM') + if qb_mem.endswith('M') or qb_mem.endswith('m'): + qb_mem = qb_mem[:-1] + + # Add -m prefix it not present + if not qb_mem.startswith('-m'): + qb_mem = '-m %s' % qb_mem + + self.set('QB_MEM', qb_mem) + mach = self.get('MACHINE') if not mach.startswith('qemumips'): self.kernel_cmdline_script += ' mem=%s' % self.get('QB_MEM').replace('-m','').strip() + 'M'
Signature · 1 line
2.7.4
cover runqemu: Fixes for QB_MEM and qemuparams
The following changes since commit a88bcbae850a2e6d182291d3f8e167aabdbe4842:
wic/engine.py: Load paths from PATH environment variable (2019-02-14 11:20:06 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib rbt/qemu
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/qemu
Robert Yang (2):
runqemu: Let qemuparams override default settings
runqemu: Make QB_MEM easier to set
scripts/runqemu | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4