blob: 0387a8b41c5f3ab438bd95ec9ea04f8b441637e1 [file] [log] [blame]
#!/usr/bin/env bash
# Copyright 2020 The Android KVM Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
ROOT_DIR="$(dirname "${SCRIPT_DIR}")"
SCRIPT_RUN_QEMU="${SCRIPT_DIR}/aarch64/run_qemu.sh"
SCRIPT_RUN_KUT="${SCRIPT_DIR}/kvm-unit-tests/run_test.sh"
PREBUILTS_DIR="${ROOT_DIR}/prebuilts"
PREBUILTS_IMG_DIR="${PREBUILTS_DIR}/linux-aarch64/images"
PREBUILTS_QEMU_BIN="${PREBUILTS_DIR}/linux-x86/qemu/bin/qemu-system-aarch64"
PREBUILTS_QEMU_ROM_DIR="${PREBUILTS_IMG_DIR}"
PREBUILTS_KUT_ROOTFS="${PREBUILTS_IMG_DIR}/rootfs.ext4"
PREBUILTS_CROSVM_FS="${PREBUILTS_IMG_DIR}/crosvm.ext4"
TOOLCHAINS_DIR="${ROOT_DIR}/toolchains"
TOOLCHAINS_GDB_BIN="${TOOLCHAINS_DIR}/linux-x86/gdb/bin/gdb"
OUT_DIR="${ROOT_DIR}/out"
LINUX_OUT="${OUT_DIR}/linux"
LINUX_OUT_IMAGE="${LINUX_OUT}/arch/arm64/boot/Image.gz"
LINUX_OUT_ELF="${LINUX_OUT}/vmlinux"
KUT_OUT="${OUT_DIR}/kvm-unit-tests"
KUT_TEST_DIR="${KUT_OUT}/tests"
DTC="${OUT_DIR}/u-boot/scripts/dtc/dtc"
# Define a variable with a given default value. Also defines
# variable DEFAULT_<name> with the default value.
# Args:
# 1) variable name to be defined
# 2) default value of the variable
function default_var {
local var_name="$1"
local value="$2"
local default_var_name="DEFAULT_${var_name}"
declare -g ${var_name}="${value}"
declare -g "${default_var_name}=${value}"
}