cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

build.sh (2099B)


      1#!/bin/bash
      2
      3# Build script that determines the edk2 toolchain to use, invokes the edk2
      4# "build" utility, and copies the built UEFI binary to the requested location.
      5#
      6# Copyright (C) 2019, Red Hat, Inc.
      7#
      8# This program and the accompanying materials are licensed and made available
      9# under the terms and conditions of the BSD License that accompanies this
     10# distribution. The full text of the license may be found at
     11# <http://opensource.org/licenses/bsd-license.php>.
     12#
     13# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
     14# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     15
     16set -e -u -C
     17
     18# Save the command line arguments. We need to reset $# to 0 before sourcing
     19# "edksetup.sh", as it will inherit $@.
     20program_name=$(basename -- "$0")
     21edk2_dir=$1
     22dsc_component=$2
     23emulation_target=$3
     24uefi_binary=$4
     25shift 4
     26
     27# Set up the environment for edk2 building.
     28export PACKAGES_PATH=$(realpath -- "$edk2_dir")
     29export WORKSPACE=$PWD
     30mkdir -p Conf
     31
     32export PYTHON_COMMAND=${EDK2_PYTHON_COMMAND:-python3}
     33
     34# Source "edksetup.sh" carefully.
     35set +e +u +C
     36source "$PACKAGES_PATH/edksetup.sh"
     37ret=$?
     38set -e -u -C
     39if [ $ret -ne 0 ]; then
     40  exit $ret
     41fi
     42
     43# Fetch some option arguments, and set the cross-compilation environment (if
     44# any), for the edk2 "build" utility.
     45source "$edk2_dir/../edk2-funcs.sh"
     46edk2_arch=$(qemu_edk2_get_arch "$emulation_target")
     47edk2_toolchain=$(qemu_edk2_get_toolchain "$emulation_target")
     48MAKEFLAGS=$(qemu_edk2_quirk_tianocore_1607 "$MAKEFLAGS")
     49edk2_thread_count=$(qemu_edk2_get_thread_count "$MAKEFLAGS")
     50qemu_edk2_set_cross_env "$emulation_target"
     51
     52# Build the UEFI binary
     53mkdir -p log
     54build \
     55  --arch="$edk2_arch" \
     56  -n "$edk2_thread_count" \
     57  --buildtarget=DEBUG \
     58  --platform=UefiTestToolsPkg/UefiTestToolsPkg.dsc \
     59  --tagname="$edk2_toolchain" \
     60  --module="UefiTestToolsPkg/$dsc_component/$dsc_component.inf" \
     61  --log="log/$dsc_component.$edk2_arch.log" \
     62  --report-file="log/$dsc_component.$edk2_arch.report"
     63cp -a -- \
     64  "Build/UefiTestTools/DEBUG_${edk2_toolchain}/$edk2_arch/$dsc_component.efi" \
     65  "$uefi_binary"