mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 05:57:33 +00:00
acrn-config: add serial config in new $(board).config
Enhance the $(board).config for new board. Serial config should be set in $(board).config for new board. Tracked-On: #3854 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
9ddf27669b
commit
c0e1a5d7df
@ -22,6 +22,16 @@ ACRN_DEFAULT_PLATFORM = ACRN_PATH + "hypervisor/include/arch/x86/default_acpi_in
|
|||||||
GEN_FILE = ["pci_devices.h", "board.c", "_acpi_info.h", "misc_cfg.h", "ve820.c", ".config"]
|
GEN_FILE = ["pci_devices.h", "board.c", "_acpi_info.h", "misc_cfg.h", "ve820.c", ".config"]
|
||||||
|
|
||||||
|
|
||||||
|
def need_gen_new_board_config(board_name):
|
||||||
|
|
||||||
|
# 1. if it is old board, they are already have the $(board_name).config, return and no need to generate it.
|
||||||
|
|
||||||
|
if board_name in board_cfg_lib.BOARD_NAMES:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
"""
|
"""
|
||||||
This is main function to start generate source code related with board
|
This is main function to start generate source code related with board
|
||||||
@ -103,7 +113,7 @@ def main(args):
|
|||||||
return err_dic
|
return err_dic
|
||||||
|
|
||||||
# generate new board_name.config
|
# generate new board_name.config
|
||||||
if board not in board_cfg_lib.BOARD_NAMES:
|
if need_gen_new_board_config(board):
|
||||||
with open(config_board_kconfig, 'w+') as config:
|
with open(config_board_kconfig, 'w+') as config:
|
||||||
err_dic = new_board_kconfig.generate_file(config)
|
err_dic = new_board_kconfig.generate_file(config)
|
||||||
if err_dic:
|
if err_dic:
|
||||||
|
@ -64,6 +64,34 @@ def get_ram_range():
|
|||||||
return ram_range
|
return ram_range
|
||||||
|
|
||||||
|
|
||||||
|
def get_serial_type():
|
||||||
|
""" Get the serial type of consle which set by user """
|
||||||
|
ttys_type = ''
|
||||||
|
|
||||||
|
# Get ttySx information from board config file
|
||||||
|
ttys_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "<TTYS_INFO>", "</TTYS_INFO>")
|
||||||
|
|
||||||
|
scenario_name = board_cfg_lib.get_scenario_name()
|
||||||
|
if scenario_name == "logical_partition":
|
||||||
|
ttyn = 'ttyS0'
|
||||||
|
else:
|
||||||
|
# Get ttySx from scenario config file which selected by user
|
||||||
|
(err_dic, ttyn) = board_cfg_lib.parser_vuart_console()
|
||||||
|
if err_dic:
|
||||||
|
board_cfg_lib.ERR_LIST.update(err_dic)
|
||||||
|
|
||||||
|
# query the serial type from board config file
|
||||||
|
for line in ttys_lines:
|
||||||
|
if ttyn in line:
|
||||||
|
# line format:
|
||||||
|
# seri:/dev/ttyS0 type:portio base:0x3F8 irq:4
|
||||||
|
# seri:/dev/ttyS0 type:mmio base:0xB3640000 irq:4
|
||||||
|
ttys_type = line.split()[1].split(':')[1]
|
||||||
|
break
|
||||||
|
|
||||||
|
return ttys_type
|
||||||
|
|
||||||
|
|
||||||
def generate_file(config):
|
def generate_file(config):
|
||||||
"""Start to generate board.c
|
"""Start to generate board.c
|
||||||
:param config: it is a file pointer of board information for writing to
|
:param config: it is a file pointer of board information for writing to
|
||||||
@ -87,11 +115,17 @@ def generate_file(config):
|
|||||||
avl_start_addr = find_avl_memory(ram_range, str(total_size))
|
avl_start_addr = find_avl_memory(ram_range, str(total_size))
|
||||||
hv_start_addr = int(avl_start_addr, 16) + int(hex(reserved_ram), 16)
|
hv_start_addr = int(avl_start_addr, 16) + int(hex(reserved_ram), 16)
|
||||||
|
|
||||||
print('CONFIG_BOARD="{}"'.format(board_cfg_lib.BOARD_NAME), file=config)
|
|
||||||
print("{}".format(DESC), file=config)
|
print("{}".format(DESC), file=config)
|
||||||
|
print('CONFIG_BOARD="{}"'.format(board_cfg_lib.BOARD_NAME), file=config)
|
||||||
|
|
||||||
|
serial_type = get_serial_type()
|
||||||
|
|
||||||
|
if serial_type == "portio":
|
||||||
|
print("CONFIG_SERIAL_LEGACY=y", file=config)
|
||||||
|
if serial_type == "mmio":
|
||||||
|
print("CONFIG_SERIAL_PCI=y", file=config)
|
||||||
|
|
||||||
print("CONFIG_HV_RAM_START={}".format(hex(hv_start_addr)), file=config)
|
print("CONFIG_HV_RAM_START={}".format(hex(hv_start_addr)), file=config)
|
||||||
|
|
||||||
print("CONFIG_HV_RAM_SIZE={}".format(hex(hv_ram_size)), file=config)
|
print("CONFIG_HV_RAM_SIZE={}".format(hex(hv_ram_size)), file=config)
|
||||||
|
|
||||||
return err_dic
|
return err_dic
|
||||||
|
@ -71,8 +71,8 @@ def get_scenario_name():
|
|||||||
Get scenario name from scenario.xml at fist line
|
Get scenario name from scenario.xml at fist line
|
||||||
:param scenario_info: it is a file what contains board information for script to read from
|
:param scenario_info: it is a file what contains board information for script to read from
|
||||||
"""
|
"""
|
||||||
(err_dic, board) = common.get_xml_attrib(SCENARIO_INFO_FILE, "scenario")
|
(err_dic, scenario) = common.get_xml_attrib(SCENARIO_INFO_FILE, "scenario")
|
||||||
return (err_dic, board)
|
return (err_dic, scenario)
|
||||||
|
|
||||||
|
|
||||||
def is_config_file_match():
|
def is_config_file_match():
|
||||||
|
Loading…
Reference in New Issue
Block a user