acrn-hypervisor/hypervisor/scripts/genconf.sh
Xie, nanlin 97c9b24030 acrn-config: Reorg config tool folder
Remove vm_configs folder and move all the XML files and generic code example into config_tools/data

Tracked-On: #5644
Signed-off-by: Xie, nanlin <nanlin.xie@intel.com>
2021-01-27 11:08:28 +08:00

44 lines
1.1 KiB
Bash

#!/bin/sh
# Copyright (C) 2021 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
base_dir=$1
board_xml=$2
scenario_xml=$3
out=$4
apply_patch () {
echo "Applying patch ${1}:"
patch -p1 < ${1}
if [ $? -ne 0 ]; then
echo "Applying patch ${1} failed."
exit 1
fi
}
tool_dir=${base_dir}/../misc/config_tools
diffconfig_list=${out}/.diffconfig
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
if [ -f ${diffconfig_list} ]; then
cd ${out} &&
cat ${diffconfig_list} | while read line; do
if [ -f ${line} ]; then
apply_patch ${line}
elif [ -d ${line} ]; then
find ${line} -maxdepth 1 -name '*.patch' | while read f; do
apply_patch ${f}
done
else
echo "${line}: No such file or directory"
exit 1
fi
done
fi