runqemu: Make QB_MEM easier to set

It 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]

(From OE-Core rev: ad246f5ce0652bd917d85884176baa746e1379ff)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang
2019-02-15 16:14:52 +08:00
committed by Richard Purdie
parent ad522ea6a6
commit cc283a9028

View File

@@ -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'