X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/50b4ecfb1b28e9b1dfc57b6a876fcdf938092152..14e6f9f2f8899e072eccab23389c7c65eaf926ed:/lunaix-os/scripts/qemu.py diff --git a/lunaix-os/scripts/qemu.py b/lunaix-os/scripts/qemu.py index f12881a..592bdf8 100755 --- a/lunaix-os/scripts/qemu.py +++ b/lunaix-os/scripts/qemu.py @@ -311,11 +311,24 @@ class QEMUExec: return cmds def get_qemu_general_opts(self): - return [ + opts = [ "-m", get_config(self._opt, "memory", required=True), "-smp", str(get_config(self._opt, "ncpu", default=1)) ] + kopts = get_config(self._opt, "kernel") + if kopts: + opts += [ + "-kernel", get_config(kopts, "bin", required=True), + "-append", get_config(kopts, "cmd", required=True) + ] + + dtb = get_config(kopts, "dtb") + if dtb: + opts += [ "-dtb", dtb ] + + return opts + def add_peripheral(self, peripheral): self._devices.append(peripheral) @@ -324,6 +337,7 @@ class QEMUExec: qemu_path = os.path.join(qemu_dir_override, qemu_path) cmds = [ qemu_path, + *extras, *self.get_qemu_general_opts(), *self.get_qemu_arch_opts(), *self.get_qemu_debug_opts() @@ -332,14 +346,14 @@ class QEMUExec: for dev in self._devices: cmds += dev.get_qemu_opts() - cmds += extras - print(" ".join(cmds), "\n") + logger.info(" ".join(cmds)) if dryrun: logger.info("[DRY RUN] QEMU not invoked") return handle = subprocess.Popen(cmds) + logger.info(f"QEMU launched (pid={handle.pid})") while True: ret_code = handle.poll() @@ -374,7 +388,8 @@ def main(): opts.update(json.loads(f.read())) for kv in arg_opt.values: - [k, v] = kv.split('=') + splits = kv.split('=') + k, v = splits[0], "=".join(splits[1:]) g_lookup[k] = v arch = get_config(opts, "arch")