git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Second Extended Filesystem (ext2) and other improvements (#33)
[lunaix-os.git]
/
lunaix-os
/
scripts
/
qemu.py
diff --git
a/lunaix-os/scripts/qemu.py
b/lunaix-os/scripts/qemu.py
index ce843da3312625477a31d04d603bace64f777670..f2808e53d2911e44d25e3bed3d8956ecf1066943 100755
(executable)
--- a/
lunaix-os/scripts/qemu.py
+++ b/
lunaix-os/scripts/qemu.py
@@
-2,6
+2,9
@@
import subprocess, time, os, re, argparse, json
from pathlib import PurePosixPath
import subprocess, time, os, re, argparse, json
from pathlib import PurePosixPath
+import logging
+
+logger = logging.getLogger("auto_qemu")
g_lookup = {}
g_lookup = {}
@@
-109,6
+112,10
@@
class AHCIBus(QEMUPeripherals):
d_ro = get_config(disk, "ro", default=False)
d_fmt = get_config(disk, "format", default="raw")
d_id = f"disk_{i}"
d_ro = get_config(disk, "ro", default=False)
d_fmt = get_config(disk, "format", default="raw")
d_id = f"disk_{i}"
+
+ if not os.path.exists(d_img):
+ logger.warning(f"AHCI bus: {d_img} not exists, disk skipped")
+ continue
cmds += [
"-drive", join_attrs([
cmds += [
"-drive", join_attrs([
@@
-204,7
+211,7
@@
class QEMUExec:
def get_qemu_general_opts(self):
return [
"-m", get_config(self._opt, "memory", required=True),
def get_qemu_general_opts(self):
return [
"-m", get_config(self._opt, "memory", required=True),
- "-smp",
get_config(self._opt, "ncpu", default=1
)
+ "-smp",
str(get_config(self._opt, "ncpu", default=1)
)
]
def add_peripheral(self, peripheral):
]
def add_peripheral(self, peripheral):
@@
-215,6
+222,7
@@
class QEMUExec:
qemu_path = os.path.join(qemu_dir_override, qemu_path)
cmds = [
qemu_path,
qemu_path = os.path.join(qemu_dir_override, qemu_path)
cmds = [
qemu_path,
+ *self.get_qemu_general_opts(),
*self.get_qemu_arch_opts(),
*self.get_qemu_debug_opts()
]
*self.get_qemu_arch_opts(),
*self.get_qemu_debug_opts()
]
@@
-272,7
+280,4
@@
def main():
q.start(arg_opt.qemu_dir)
if __name__ == "__main__":
q.start(arg_opt.qemu_dir)
if __name__ == "__main__":
- try:
- main()
- except Exception as e:
- print(e)
\ No newline at end of file
+ main()
\ No newline at end of file