diff options
Diffstat (limited to 'poky/scripts/runqemu')
-rwxr-xr-x | poky/scripts/runqemu | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/poky/scripts/runqemu b/poky/scripts/runqemu index 55cdd414e..1c96b29a4 100755 --- a/poky/scripts/runqemu +++ b/poky/scripts/runqemu @@ -188,6 +188,7 @@ class BaseConfig(object): self.qemu_opt = '' self.qemu_opt_script = '' + self.qemuparams = '' self.clean_nfs_dir = False self.nfs_server = '' self.rootfs = '' @@ -455,7 +456,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)): @@ -662,13 +663,28 @@ 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'): 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' @@ -1164,6 +1180,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" |