acrn-config: generate console=ttyS0 for PRE Launched VM

Remove pre-launched VM console setting in scenario xml and leave it
configured in bootargs directly.

Tracked-On: #4808
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu 2020-05-14 16:27:18 +08:00 committed by wenlingz
parent 65c0cc7362
commit fca8750ba6
14 changed files with 43 additions and 64 deletions

View File

@ -381,19 +381,6 @@ def os_kern_args_check(id_kern_args_dic, prime_item, item):
ERR_LIST[key] = "VM os config kernel service os should be SOS_VM_BOOTARGS"
def os_kern_console_check(tty_console, prime_item, item):
"""
Check os kernel console
:param prime_item: the prime item in xml file
:param item: vm os config console item in xml
:return: None
"""
if tty_console and "ttyS" not in tty_console:
key = "hv:{},{}".format(prime_item, item)
ERR_LIST[key] = "VM os config kernel console should be ttyS[0..3]"
def os_kern_load_addr_check(id_kern_load_addr_dic, prime_item, item):
"""
Check os kernel load address

View File

@ -73,7 +73,6 @@ class CfgOsKern:
kern_type = {}
kern_mod = {}
kern_args = {}
kern_console = {}
kern_load_addr = {}
kern_entry_addr = {}
ramdisk_mod = {}
@ -93,8 +92,6 @@ class CfgOsKern:
self.scenario_info, "os_config", "kern_mod")
self.kern_args = common.get_leaf_tag_map(
self.scenario_info, "os_config", "bootargs")
self.kern_console = common.get_hv_item_tag(
self.scenario_info, "DEBUG_OPTIONS", "SERIAL_CONSOLE")
self.kern_load_addr = common.get_leaf_tag_map(
self.scenario_info, "os_config", "kern_load_addr")
self.kern_entry_addr = common.get_leaf_tag_map(
@ -111,7 +108,6 @@ class CfgOsKern:
scenario_cfg_lib.os_kern_type_check(self.kern_type, "os_config", "kern_type")
scenario_cfg_lib.os_kern_mod_check(self.kern_mod, "os_config", "kern_mod")
scenario_cfg_lib.os_kern_args_check(self.kern_args, "os_config", "kern_args")
scenario_cfg_lib.os_kern_console_check(self.kern_console, "DEBUG_OPTIONS", "SERIAL_CONSOLE")
scenario_cfg_lib.os_kern_load_addr_check(self.kern_load_addr, "os_config", "kern_load_addr")
scenario_cfg_lib.os_kern_entry_addr_check(self.kern_entry_addr, "os_config", "kern_entry_addr")

View File

@ -136,6 +136,29 @@ def vuart_output(vm_type, i, vm_info, config):
print("\t\t},", file=config)
def split_cmdline(cmd_str, config):
cmd_list = [i for i in cmd_str.strip('"').split() if i != '']
if cmd_list:
cmd_len = len(cmd_list)
i = 0
for cmd_arg in cmd_list:
if not cmd_arg.strip():
continue
if i == 0:
print('"', end="", file=config)
if i % 4 == 0 and i != 0:
print("\\\n\t\t\t\t", end="", file=config)
print('{} '.format(cmd_arg), end="", file=config)
i += 1
if i == cmd_len:
print('"', file=config)
def is_need_epc(epc_section, i, config):
"""
Check if it is need epc section
@ -306,8 +329,7 @@ def gen_pre_launch_vm(vm_type, vm_i, vm_info, config):
print("\t\t\t.kernel_entry_addr = {0},".format(vm_info.os_cfg.kern_entry_addr[vm_i]), file=config)
if vm_i in vm_info.os_cfg.kern_args.keys() and vm_info.os_cfg.kern_args[vm_i]:
print("\t\t\t.bootargs = VM{0}_CONFIG_OS_BOOTARG_CONSOLE\t\\".format(vm_i), file=config)
print("\t\t\t\tVM{0}_CONFIG_OS_BOOTARG_MAXCPUS\t\t\\".format(vm_i), file=config)
print("\t\t\t.bootargs = ", end="", file=config)
split_cmdline(vm_info.os_cfg.kern_args[vm_i].strip(), config)
print("\t\t},", file=config)
# VUART
@ -337,29 +359,6 @@ def gen_post_launch_vm(vm_type, vm_i, vm_info, config):
print("\t},", file=config)
def split_cmdline(cmd_str, config):
cmd_list = [i for i in cmd_str.split() if i != '']
if cmd_list:
cmd_len = len(cmd_list)
i = 0
for cmd_arg in cmd_list:
if not cmd_arg.strip():
continue
if i == 0:
print('\\\n\t\t\t\t"', end="", file=config)
if i % 4 == 0 and i != 0:
print("\\\n\t\t\t\t", end="", file=config)
print('{} '.format(cmd_arg), end="", file=config)
i += 1
if i == cmd_len:
print('"', file=config)
def pre_launch_definiation(vm_info, config):
for vm_i,vm_type in common.VM_TYPES.items():

View File

@ -86,9 +86,6 @@ def gen_pre_launch_vm(vm_info, config):
print("#define VM{0}_CONFIG_MEM_SIZE_HPA2\t\t{1}UL".format(
vm_i, vm_info.mem_info.mem_size_hpa2[vm_i]), file=config)
print('#define VM{0}_CONFIG_OS_BOOTARG_MAXCPUS\t\t"maxcpus={1} "'.format(vm_i, cpu_bits['cpu_num']), file=config)
if vm_info.os_cfg.kern_console:
print('#define VM{0}_CONFIG_OS_BOOTARG_CONSOLE\t\t"console={1} "'.format(vm_i, vm_info.os_cfg.kern_console.strip('/dev/')), file=config)
print("", file=config)
vm_i += 1

View File

@ -77,7 +77,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw root=/dev/mmcblk1p1 rootwait noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw root=/dev/mmcblk1p1 rootwait console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -127,7 +127,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -77,7 +77,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -126,7 +126,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -78,7 +78,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -128,7 +128,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -71,7 +71,7 @@
<kern_type desc="Specify the kernel image type so that hypervisor could load it correctly. Currently support KERNEL_BZIMAGE and KERNEL_ZEPHYR.">KERNEL_ZEPHYR</kern_type>
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Zephyr_RawImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline." />
<bootargs desc="Specify kernel boot arguments" />
<bootargs desc="Specify kernel boot arguments"></bootargs>
<kern_load_addr desc="The loading address in host memory for the VM kernel">0x100000</kern_load_addr>
<kern_entry_addr desc="The entry address in host memory for the VM kernel">0x100000</kern_entry_addr>
</os_config>

View File

@ -75,7 +75,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline." />
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -126,7 +126,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline." />
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -79,7 +79,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -130,7 +130,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -78,7 +78,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -128,7 +128,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -78,7 +78,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -129,7 +129,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -78,7 +78,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -128,7 +128,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>

View File

@ -78,7 +78,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable
</bootargs>
</os_config>
<vuart id="0">
@ -128,7 +128,7 @@
<kern_mod desc="The tag for kernel image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline.">Linux_bzImage</kern_mod>
<ramdisk_mod desc="The tag for ramdisk image which act as multiboot module, it must exactly match the module tag in GRUB multiboot cmdline."></ramdisk_mod>
<bootargs desc="Specify kernel boot arguments">
rw rootwait root=/dev/sda3 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M
consoleblank=0 tsc=reliable
</bootargs>
</os_config>