mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
wscript change to dynamically detect KVM support for QEMU
This commit is contained in:
44
wscript
44
wscript
@@ -142,6 +142,20 @@ def configure(ctx):
|
|||||||
'-nostartfiles',
|
'-nostartfiles',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
ctx.env.append_value('QEMUOPTS', [
|
||||||
|
'-smp', '1',
|
||||||
|
'-m', '512',
|
||||||
|
'-d', 'mmu,int,guest_errors',
|
||||||
|
'-D', 'popcorn.log',
|
||||||
|
'-cpu', 'Broadwell',
|
||||||
|
'-M', 'q35',
|
||||||
|
'-no-reboot',
|
||||||
|
'-nographic',
|
||||||
|
])
|
||||||
|
|
||||||
|
if os.path.exists('/dev/kvm'):
|
||||||
|
ctx.env.append_value('QEMUOPTS', ['--enable-kvm'])
|
||||||
|
|
||||||
env = ctx.env
|
env = ctx.env
|
||||||
ctx.setenv('boot', env=env)
|
ctx.setenv('boot', env=env)
|
||||||
ctx.recurse(join("src", "boot"))
|
ctx.recurse(join("src", "boot"))
|
||||||
@@ -269,6 +283,14 @@ def build(bld):
|
|||||||
bld.recurse(join("src", "tests"))
|
bld.recurse(join("src", "tests"))
|
||||||
|
|
||||||
|
|
||||||
|
class QemuContext(BuildContext):
|
||||||
|
cmd = 'qemu'
|
||||||
|
fun = 'qemu'
|
||||||
|
|
||||||
|
class DebugQemuContext(QemuContext):
|
||||||
|
cmd = 'debug'
|
||||||
|
fun = 'qemu'
|
||||||
|
|
||||||
def qemu(ctx):
|
def qemu(ctx):
|
||||||
import subprocess
|
import subprocess
|
||||||
subprocess.call("rm popcorn.log", shell=True)
|
subprocess.call("rm popcorn.log", shell=True)
|
||||||
@@ -276,16 +298,7 @@ def qemu(ctx):
|
|||||||
'qemu-system-x86_64',
|
'qemu-system-x86_64',
|
||||||
'-drive', 'if=pflash,format=raw,file={}/flash.img'.format(out),
|
'-drive', 'if=pflash,format=raw,file={}/flash.img'.format(out),
|
||||||
'-drive', 'format=raw,file={}/popcorn.img'.format(out),
|
'-drive', 'format=raw,file={}/popcorn.img'.format(out),
|
||||||
'-smp', '1',
|
] + ctx.env.QEMUOPTS)
|
||||||
'-m', '512',
|
|
||||||
'-d', 'mmu,int,guest_errors',
|
|
||||||
'-D', 'popcorn.log',
|
|
||||||
'-cpu', 'Broadwell',
|
|
||||||
'-M', 'q35',
|
|
||||||
'-no-reboot',
|
|
||||||
'-nographic',
|
|
||||||
'-enable-kvm',
|
|
||||||
])
|
|
||||||
|
|
||||||
def debug(ctx):
|
def debug(ctx):
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -294,17 +307,8 @@ def debug(ctx):
|
|||||||
'qemu-system-x86_64',
|
'qemu-system-x86_64',
|
||||||
'-drive', 'if=pflash,format=raw,file={}/flash.img'.format(out),
|
'-drive', 'if=pflash,format=raw,file={}/flash.img'.format(out),
|
||||||
'-drive', 'format=raw,file={}/popcorn.img'.format(out),
|
'-drive', 'format=raw,file={}/popcorn.img'.format(out),
|
||||||
'-smp', '1',
|
|
||||||
'-m', '512',
|
|
||||||
'-d', 'mmu,int,guest_errors',
|
|
||||||
'-D', 'popcorn.log',
|
|
||||||
'-cpu', 'Broadwell',
|
|
||||||
'-M', 'q35',
|
|
||||||
'-no-reboot',
|
|
||||||
'-nographic',
|
|
||||||
'-enable-kvm',
|
|
||||||
'-s',
|
'-s',
|
||||||
])
|
] + ctx.env.QEMUOPTS)
|
||||||
|
|
||||||
|
|
||||||
def vbox(ctx):
|
def vbox(ctx):
|
||||||
|
|||||||
Reference in New Issue
Block a user