diff options
| author | Brijesh Singh <brijesh.singh@amd.com> | 2020-04-22 11:48:39 -0500 |
|---|---|---|
| committer | Brijesh Singh <brijesh.singh@amd.com> | 2020-04-22 11:48:39 -0500 |
| commit | bd60f07b99deb0ec675103c4383289334369a822 (patch) | |
| tree | 68a422fc72185d8ec0329bbb17ff89e500eafbfd /build.sh | |
| parent | ac6555995f1c693053583b2798f9805b0f9fe80d (diff) | |
| download | cachepc-amdsev-bd60f07b99deb0ec675103c4383289334369a822.tar.gz cachepc-amdsev-bd60f07b99deb0ec675103c4383289334369a822.zip | |
Add initial build script
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..cb9f907 --- /dev/null +++ b/build.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +SCRIPT_DIR="$(dirname $0)" +. ${SCRIPT_DIR}/common.sh +. ${SCRIPT_DIR}/stable-commits +[ -e /etc/os-release ] && . /etc/os-release + +function usage() +{ + echo "Usage: $0 [OPTIONS] [COMPONENT]" + echo " where COMPONENT is an individual component to build:" + echo " qemu, ovmf, kernel" + echo " where OPTIONS are:" + echo " --install PATH Installation path (default $INSTALL_DIR)" + echo " -h|--help Usage information" + + exit 1 +} + +INSTALL_DIR="`pwd`/usr/local" + +while [ -n "$1" ]; do + case "$1" in + --install) + [ -z "$2" ] && usage + INSTALL_DIR="$2" + shift; shift + ;; + -h|--help) + usage + ;; + -*|--*) + echo "Unsupported option: [$1]" + usage + ;; + *) + break + ;; + esac +done + +mkdir -p $INSTALL_DIR +IDIR=$INSTALL_DIR +INSTALL_DIR=$(readlink -e $INSTALL_DIR) +[ -n "$INSTALL_DIR" -a -d "$INSTALL_DIR" ] || { + echo "Installation directory [$IDIR] does not exist, exiting" + exit 1 +} + +if [ -z "$1" ]; then + build_install_qemu "$INSTALL_DIR" + build_install_ovmf "$INSTALL_DIR/share/qemu" + build_kernel +else + case "$1" in + qemu) + build_install_qemu "$INSTALL_DIR" + ;; + ovmf) + build_install_ovmf "$INSTALL_DIR/share/qemu" + ;; + kernel) + build_kernel + ;; + esac +fi |
