acrn-config: add a script to generate config sources from XMLs

In order for a unified interface for generating configuration sources from
board and scenario XMLs, this patch introduces a script named genconf.sh
which takes XML files as inputs and generate sources under the specified
directory. Once used in Makefiles, this script helps to minimize the
impacts on the Makefiles when we refine the configuration source generation
process in the future.

This patch also adds a non-zero return value to board_cfg_gen.py and
scenario_cfg_gen.py so that we do not need to inspect the logs to determine
if the generation succeeds.

Tracked-On: #5644
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2021-01-06 10:12:45 +08:00 committed by wenlingz
parent 6c6fa5f340
commit 9cff2bbdc0
3 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,17 @@
#!/bin/sh
# Copyright (C) 2021 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
base_dir=$1
board_xml=$2
scenario_xml=$3
out=$4
tool_dir=${base_dir}/../misc/acrn-config
python3 ${tool_dir}/board_config/board_cfg_gen.py --board ${board_xml} --scenario ${scenario_xml} --out ${out} &&
python3 ${tool_dir}/scenario_config/scenario_cfg_gen.py --board ${board_xml} --scenario ${scenario_xml} --out ${out}
if [ $? -ne 0 ]; then
exit $?
fi

View File

@ -145,3 +145,4 @@ if __name__ == '__main__':
if err_dic:
for err_k, err_v in err_dic.items():
common.print_red("{}: {}".format(err_k, err_v), err=True)
sys.exit(1 if err_dic else 0)

View File

@ -245,4 +245,4 @@ if __name__ == '__main__':
if err_dic:
for err_k, err_v in err_dic.items():
common.print_red("{}: {}".format(err_k, err_v), err=True)
sys.exit(1 if err_dic else 0)