acrn-config: refine board name with undline_name api

Sometimes character '-' or space need to be converted to '_' to make string format uniformed.
Add this common api to satisfy such requirment and refine the code for board name generating.

Tracked-On: #3852
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
2019-10-17 10:23:56 +08:00
committed by wenlingz
parent 95b9ba36b0
commit a2430f1313
6 changed files with 43 additions and 38 deletions

View File

@@ -21,6 +21,7 @@ def tap_uos_net(names, vmid, config):
uos_type = names['uos_types'][vmid]
board_name = names['board_name']
vm_name = launch_cfg_lib.undline_name(uos_type).lower()
if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS"):
if board_name in ("apl-mrb", "apl-up2"):
print('if [ ! -f "/data/$3/$3.img" ]; then', file=config)
@@ -35,7 +36,7 @@ def tap_uos_net(names, vmid, config):
print("", file=config)
if uos_type in ("VXWORKS", "ZEPHYR", "WINDOWS"):
print("vm_name={}_vm$1".format(uos_type), file=config)
print("vm_name={}_vm$1".format(vm_name), file=config)
if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS"):
if board_name in ("apl-mrb", "apl-up2"):
@@ -231,7 +232,7 @@ def log_level_set(uos_type, config):
def launch_begin(board_name, uos_type, config):
launch_uos = '_'.join(uos_type.lower().split())
launch_uos = launch_cfg_lib.undline_name(board_name).lower()
run_container(board_name, uos_type, config)
print("function launch_{}()".format(launch_uos), file=config)
print("{", file=config)
@@ -274,7 +275,7 @@ def uos_launch(names, args, vmid, config):
board_name = names['board_name']
gvt_args = args['gvt_args'][vmid]
uos_type = names['uos_types'][vmid]
launch_uos = '_'.join(uos_type.lower().split())
launch_uos = launch_cfg_lib.undline_name(board_name).lower()
if uos_type in ("CLEARLINUX", "ANDROID", "ALIOS") and not is_nuc_clr(names, vmid):