| 1 | #!/bin/bash |
| 2 | # Stop immediately if any executed command has exit status different from 0. |
| 3 | set -e |
| 4 | |
| 5 | script_name="$(basename "$0")" |
| 6 | script_dir="$( |
| 7 | cd "$(dirname "$0")" |
| 8 | echo "${PWD}" |
| 9 | )" |
| 10 | |
| 11 | fatal() { |
| 12 | echo "${script_name}: $*" >&2 |
| 13 | exit 1 |
| 14 | } |
| 15 | |
| 16 | usage() { |
| 17 | fatal "Usage: ${script_name}" |
| 18 | } |
| 19 | |
| 20 | if [ $# -ne 1 ]; then |
| 21 | usage |
| 22 | exit 1 |
| 23 | fi |
| 24 | |
| 25 | export XEN_TARGET_ARCH |
| 26 | |
| 27 | if [ "$1" = "X86_64" ]; then |
| 28 | CONFIG_FILE="${script_dir}/xen_x86_config" |
| 29 | XEN_TARGET_ARCH=x86_64 |
| 30 | elif [ "$1" = "ARM64" ]; then |
| 31 | CONFIG_FILE="${script_dir}/xen_arm_config" |
| 32 | XEN_TARGET_ARCH=arm64 |
| 33 | else |
| 34 | fatal "Unknown configuration: $1" |
| 35 | fi |
| 36 | |
| 37 | ( |
| 38 | ./configure |
| 39 | cp "${CONFIG_FILE}" xen/.config |
| 40 | make clean |
| 41 | find . -type f -name "*.safparse" -print -delete |
| 42 | "${script_dir}/build.sh" "$1" |
| 43 | # Generate additional configuration files |
| 44 | "${script_dir}/ECLAIR/generate_ecl.sh" |
| 45 | make clean |
| 46 | cd xen |
| 47 | make -f "${script_dir}/Makefile.prepare" prepare |
| 48 | # Translate the /* SAF-n-safe */ comments into ECLAIR CBTs |
| 49 | scripts/xen-analysis.py --run-eclair --no-build --no-clean |
| 50 | # Translate function-properties.json into ECLAIR properties |
| 51 | python3 "${script_dir}/propertyparser.py" |
| 52 | ) |