From bd60f07b99deb0ec675103c4383289334369a822 Mon Sep 17 00:00:00 2001 From: Brijesh Singh Date: Wed, 22 Apr 2020 11:48:39 -0500 Subject: Add initial build script --- build.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 build.sh (limited to 'build.sh') 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 -- cgit v1.2.3-71-gd317