Skip to content

Commit

Permalink
Merge pull request #349 from rianquinn/opensus_support
Browse files Browse the repository at this point in the history
OpenSUSE Support
  • Loading branch information
rianquinn authored Nov 24, 2016
2 parents 890f974 + 9da166b commit 6c5846f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 311 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ COMMON_FLAGS=""
COMMON_FLAGS="$COMMON_FLAGS -g"
COMMON_FLAGS="$COMMON_FLAGS -fpic"
COMMON_FLAGS="$COMMON_FLAGS -fexceptions"
COMMON_FLAGS="$COMMON_FLAGS -fstack-protector-strong"
COMMON_FLAGS="$COMMON_FLAGS -mstackrealign"
COMMON_FLAGS="$COMMON_FLAGS -mmmx"
COMMON_FLAGS="$COMMON_FLAGS -msse"
Expand All @@ -53,6 +52,7 @@ COMMON_FLAGS="$COMMON_FLAGS -maes"

CROSS_COMMON_FLAGS="$COMMON_FLAGS"
CROSS_COMMON_FLAGS="$CROSS_COMMON_FLAGS -ffreestanding"
CROSS_COMMON_FLAGS="$CROSS_COMMON_FLAGS -fstack-protector-strong"
CROSS_COMMON_FLAGS="$CROSS_COMMON_FLAGS -mno-red-zone"
CROSS_COMMON_FLAGS="$CROSS_COMMON_FLAGS -D_HAVE_LONG_DOUBLE"
CROSS_COMMON_FLAGS="$CROSS_COMMON_FLAGS -D_LDBL_EQ_DBL"
Expand Down
4 changes: 4 additions & 0 deletions include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@

#include <types.h>

#ifdef CROSS_COMPILED

#if defined(__GNUC__) || defined(__clang__)
#if __has_include("user_constants.h")
#include "user_constants.h"
#endif
#endif

#endif

/*
* Hypervisor Version
*
Expand Down
111 changes: 10 additions & 101 deletions tools/scripts/setup_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,21 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

source $(dirname $0)/setup_common.sh

# ------------------------------------------------------------------------------
# Checks
# ------------------------------------------------------------------------------

case $(lsb_release -si) in
Debian)
;;
*)
echo "This script can only be used with: Debian"
exit 1
esac

if [[ ! -d "bfelf_loader" ]]; then
echo "This script must be run from bareflank root directory"
exit 1
fi

if ! grep -q 'avx' /proc/cpuinfo; then
echo "Hardware unsupported. AVX is required"
exit 1
fi
check_distro debian
check_folder
check_hardware

# ------------------------------------------------------------------------------
# Help
# Parse Arguments
# ------------------------------------------------------------------------------

option_help() {
echo -e "Usage: setup_debian.sh [OPTION]"
echo -e "Sets up the system to compile / use Bareflank"
echo -e ""
echo -e " -h, --help show this help menu"
echo -e " -l, --local_compilers setup local cross compilers"
echo -e " -n, --no-configure skip the configure step"
echo -e " -g, --compiler <dirname> directory of cross compiler"
echo -e " -o, --out_of_tree <dirname> setup out of tree build"
echo -e ""
}
parse_arguments $@

# ------------------------------------------------------------------------------
# Functions
Expand Down Expand Up @@ -96,50 +74,11 @@ prepare_docker() {
sudo service docker restart
}

# ------------------------------------------------------------------------------
# Arguments
# ------------------------------------------------------------------------------

while [[ $# -ne 0 ]]; do

if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
option_help
exit 0
fi

if [[ $1 == "-l" ]] || [[ $1 == "--local_compilers" ]]; then
local="true"
fi

if [[ $1 == "--compiler" ]]; then
shift
compiler="--compiler $1"
fi

if [[ $1 == "--use_llvm_clang" ]]; then
use_llvm_clang="--use_llvm_clang"
fi

if [[ $1 == "-n" ]] || [[ $1 == "--no-configure" ]]; then
noconfigure="true"
fi

if [[ $1 == "-o" ]] || [[ $1 == "--out_of_tree" ]]; then
shift
out_of_tree="true"
build_dir=$1
hypervisor_dir=$PWD
fi

shift

done

# ------------------------------------------------------------------------------
# Setup System
# ------------------------------------------------------------------------------

case $(lsb_release -sr) in
case $( grep ^VERSION_ID= /etc/os-release | cut -d'=' -f 2 | tr -d '"' ) in
testing)
install_apt_tools
add_docker_repositories
Expand All @@ -148,7 +87,7 @@ testing)
;;

*)
echo "This version of Debian is not supported"
echo "This version of Ubuntu is not supported"
exit 1

esac
Expand All @@ -157,34 +96,4 @@ esac
# Setup Build Environment
# ------------------------------------------------------------------------------

if [[ ! $noconfigure == "true" ]]; then
if [[ $out_of_tree == "true" ]]; then
mkdir -p $build_dir
pushd $build_dir
$hypervisor_dir/configure
popd
else
./configure $compiler $use_llvm_clang
fi
fi

if [[ $local == "true" ]]; then
CROSS_COMPILER=clang_38 ./tools/scripts/create_cross_compiler.sh
fi

# ------------------------------------------------------------------------------
# Done
# ------------------------------------------------------------------------------

echo ""

echo "WARNING: If you are using ssh, or are logged into a GUI you "
echo " might need to exit and log back in to compile!!!"
echo ""

if [[ $out_of_tree == "true" ]]; then
echo "To build, run:"
echo " cd $build_dir"
echo " make -j<# cores>"
echo ""
fi
setup_build_environment
117 changes: 15 additions & 102 deletions tools/scripts/setup_fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,21 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

sudo dnf install -y redhat-lsb-core
source $(dirname $0)/setup_common.sh

# ------------------------------------------------------------------------------
# Checks
# ------------------------------------------------------------------------------

case $(lsb_release -si) in
Fedora)
;;
*)
echo "This script can only be used with: Fedora"
exit 1
esac

if [[ ! -d "bfelf_loader" ]]; then
echo "This script must be run from bareflank root directory"
exit 1
fi

if ! grep -q 'avx' /proc/cpuinfo; then
echo "Hardware unsupported. AVX is required"
exit 1
fi
check_distro fedora
check_folder
check_hardware

# ------------------------------------------------------------------------------
# Help
# Parse Arguments
# ------------------------------------------------------------------------------

option_help() {
echo -e "Usage: setup_fedora.sh [OPTION]"
echo -e "Sets up the system to compile / use Bareflank"
echo -e ""
echo -e " -h, --help show this help menu"
echo -e " -l, --local_compilers setup local cross compilers"
echo -e " -n, --no-configure skip the configure step"
echo -e " -g, --compiler <dirname> directory of cross compiler"
echo -e " -o, --out_of_tree <dirname> setup out of tree build"
echo -e ""
}
parse_arguments $@

# ------------------------------------------------------------------------------
# Functions
Expand Down Expand Up @@ -88,57 +64,23 @@ prepare_docker() {
sudo systemctl enable docker
}

# ------------------------------------------------------------------------------
# Arguments
# ------------------------------------------------------------------------------

while [[ $# -ne 0 ]]; do

if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
option_help
exit 0
fi

if [[ $1 == "-l" ]] || [[ $1 == "--local_compilers" ]]; then
local="true"
fi

if [[ $1 == "--compiler" ]]; then
shift
compiler="--compiler $1"
fi

if [[ $1 == "--use_llvm_clang" ]]; then
use_llvm_clang="--use_llvm_clang"
fi

if [[ $1 == "-n" ]] || [[ $1 == "--no-configure" ]]; then
noconfigure="true"
fi

if [[ $1 == "-o" ]] || [[ $1 == "--out_of_tree" ]]; then
shift
out_of_tree="true"
build_dir=$1
hypervisor_dir=$PWD
fi

shift

done

# ------------------------------------------------------------------------------
# Setup System
# ------------------------------------------------------------------------------

case $(lsb_release -sr) in
23)
case $( grep ^VERSION_ID= /etc/os-release | cut -d'=' -f 2 | tr -d '"' ) in
25)
install_common_packages
prepare_docker
;;

24)
install_common_packages
prepare_docker
;;

*)
echo "This version of Fedora is not supported"
echo "This version of Ubuntu is not supported"
exit 1

esac
Expand All @@ -147,33 +89,4 @@ esac
# Setup Build Environment
# ------------------------------------------------------------------------------

if [[ ! $noconfigure == "true" ]]; then
if [[ $out_of_tree == "true" ]]; then
mkdir -p $build_dir
pushd $build_dir
$hypervisor_dir/configure
popd
else
./configure $compiler $use_llvm_clang
fi
fi

if [[ $local == "true" ]]; then
CROSS_COMPILER=clang_38 ./tools/scripts/create_cross_compiler.sh
fi

# ------------------------------------------------------------------------------
# Done
# ------------------------------------------------------------------------------

echo ""

echo "WARNING: A reboot is required to build!!!"
echo ""

if [[ $out_of_tree == "true" ]]; then
echo "To build, run:"
echo " cd $build_dir"
echo " make -j<# cores>"
echo ""
fi
setup_build_environment
Loading

0 comments on commit 6c5846f

Please sign in to comment.