run: add --quit-after-boot, handle rdinit= vs init= there

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-01-22 00:00:00 +00:00
parent 54ef7d52f9
commit d2cd2d6100
5 changed files with 28 additions and 13 deletions

15
run
View File

@@ -130,6 +130,13 @@ Set the memory size of the guest. E.g.: `-m 512M`. We try to keep the default
at the minimal ammount amount that boots all archs. Anything lower could lead
some arch to fail to boot.
Default: %(default)s
'''
)
self.add_argument(
'--quit-after-boot',
default=False,
help='''\
Setup a kernel init parameter that makes the emulator quit immediately after boot.
'''
)
self.add_argument(
@@ -212,6 +219,8 @@ Run QEMU with VNC instead of the default SDL. Connect to it with:
kernel_cli = 'console_msg_format=syslog nokaslr norandmaps panic=-1 printk.devkmsg=on printk.time=y rw'
if self.env['kernel_cli'] is not None:
kernel_cli += ' {}'.format(self.env['kernel_cli'])
if self.env['quit_after_boot']:
kernel_cli += ' {}'.format(self.env['quit_init'])
kernel_cli_after_dash = ''
extra_emulator_args = []
extra_qemu_args = []
@@ -232,11 +241,7 @@ Run QEMU with VNC instead of the default SDL. Connect to it with:
else:
vnc = []
if self.env['eval'] is not None:
if self.env['ramfs']:
initarg = 'rdinit'
else:
initarg = 'init'
kernel_cli += ' {}=/eval_base64.sh'.format(initarg)
kernel_cli += ' {}=/eval_base64.sh'.format(self.env['initarg'])
kernel_cli_after_dash += ' lkmc_eval="{}"'.format(self.base64_encode(self.env['eval']))
if not self.env['graphic']:
extra_qemu_args.extend(['-nographic', LF])