mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 20:22:46 +00:00
acrn-config: define VMx_BOOT_ARGS macros in misc_cfg_h.py
so that vm_configurations.h/vm_configurations.c are consistent for different boards Debugged and refactored the split_cmdline() function Tracked-On: #5229 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
This commit is contained in:
parent
0e92ecf35d
commit
9f43d200d6
@ -153,10 +153,10 @@ def cpu_affinity_output(cpu_bits, i, config):
|
||||
|
||||
if "SOS_VM" == common.VM_TYPES[i]:
|
||||
print("", file=config)
|
||||
print("#define SOS_VM_CONFIG_CPU_AFFINITY {0}".format(
|
||||
print("#define SOS_VM_CONFIG_CPU_AFFINITY\t{0}".format(
|
||||
cpu_bits['cpu_map']), file=config)
|
||||
else:
|
||||
print("#define VM{0}_CONFIG_CPU_AFFINITY {1}".format(
|
||||
print("#define VM{0}_CONFIG_CPU_AFFINITY\t{1}".format(
|
||||
i, cpu_bits['cpu_map']), file=config)
|
||||
|
||||
|
||||
@ -190,12 +190,43 @@ def pci_dev_num_per_vm_gen(config):
|
||||
for vm_i,vm_type in common.VM_TYPES.items():
|
||||
if "POST_LAUNCHED_VM" == scenario_cfg_lib.VM_DB[vm_type]['load_type']:
|
||||
if shmem_enabled == 'y' and vm_i in shmem_num.keys():
|
||||
print("#define VM{}_CONFIG_PCI_DEV_NUM {}U".format(vm_i, shmem_num[vm_i]), file=config)
|
||||
print("#define VM{}_CONFIG_PCI_DEV_NUM\t{}U".format(vm_i, shmem_num[vm_i]), file=config)
|
||||
elif "PRE_LAUNCHED_VM" == scenario_cfg_lib.VM_DB[vm_type]['load_type']:
|
||||
shmem_num_i = 0
|
||||
if shmem_enabled == 'y' and vm_i in shmem_num.keys():
|
||||
shmem_num_i = shmem_num[vm_i]
|
||||
print("#define VM{}_CONFIG_PCI_DEV_NUM {}U".format(vm_i, pci_dev_num[vm_i] + shmem_num_i), file=config)
|
||||
print("#define VM{}_CONFIG_PCI_DEV_NUM\t{}U".format(vm_i, pci_dev_num[vm_i] + shmem_num_i), file=config)
|
||||
|
||||
print("", file=config)
|
||||
|
||||
|
||||
def split_cmdline(cmd_str, config):
|
||||
|
||||
cmd_list = [i for i in cmd_str.strip('"').split()]
|
||||
if not cmd_list: return
|
||||
|
||||
last_idx = len(cmd_list) - 1
|
||||
for idx, cmd_arg in enumerate(cmd_list):
|
||||
if idx == 0:
|
||||
print('"', end="", file=config)
|
||||
elif idx % 4 == 0:
|
||||
print("\\\n", end="", file=config)
|
||||
|
||||
if idx == last_idx:
|
||||
print('{}"'.format(cmd_arg), file=config)
|
||||
else:
|
||||
print('{} '.format(cmd_arg), end="", file=config)
|
||||
|
||||
|
||||
def boot_args_per_vm_gen(config):
|
||||
kern_args = common.get_leaf_tag_map(common.SCENARIO_INFO_FILE, "os_config", "bootargs")
|
||||
|
||||
for vm_i,vm_type in common.VM_TYPES.items():
|
||||
if "PRE_LAUNCHED_VM" == scenario_cfg_lib.VM_DB[vm_type]['load_type']:
|
||||
if vm_i in kern_args.keys() and kern_args[vm_i]:
|
||||
print("#define VM{}_BOOT_ARGS\t".format(vm_i), end="", file=config)
|
||||
split_cmdline(kern_args[vm_i].strip(), config)
|
||||
print("", file=config)
|
||||
|
||||
print("", file=config)
|
||||
|
||||
@ -365,6 +396,8 @@ def generate_file(config):
|
||||
|
||||
pci_dev_num_per_vm_gen(config)
|
||||
|
||||
boot_args_per_vm_gen(config)
|
||||
|
||||
print("{}".format(MISC_CFG_END), file=config)
|
||||
|
||||
return err_dic
|
||||
|
@ -139,29 +139,6 @@ 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
|
||||
@ -334,8 +311,8 @@ def gen_pre_launch_vm(vm_type, vm_i, scenario_items, 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 = ", end="", file=config)
|
||||
split_cmdline(vm_info.os_cfg.kern_args[vm_i].strip(), config)
|
||||
print("\t\t\t.bootargs = VM{0}_BOOT_ARGS,".format(vm_i), file=config)
|
||||
|
||||
print("\t\t},", file=config)
|
||||
print("\t\t.acpi_config = {", file=config)
|
||||
print('\t\t\t.acpi_mod_tag = "ACPI_VM{}",'.format(vm_i), file=config)
|
||||
|
Loading…
Reference in New Issue
Block a user