
Magic instrumentation is now performed on all system services if the system is built with MKMAGIC=yes, which implies MKBITCODE=yes. Change-Id: I9d1233650188b7532a9356b720fb68d5f8248939
112 lines
2.7 KiB
Bash
Executable File
112 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
############################
|
|
#
|
|
# Author: Koustubha Bhat
|
|
# Date : 3-April-2014
|
|
# VU University, Amsterdam.
|
|
#
|
|
############################
|
|
|
|
##################
|
|
# Initialization
|
|
##################
|
|
|
|
set -o errexit
|
|
|
|
MYPWD="`pwd`"
|
|
ARCH=i386
|
|
MINIX_ROOT=
|
|
MINIX_LLVM_DIR=
|
|
GOLD_DEST_DIR=
|
|
EXITCODE=0
|
|
|
|
function check_current_dir()
|
|
{
|
|
#Make sure we are running from the root dir of the Minix sources
|
|
if [ -d ./minix/drivers ] && [ -d ./minix/servers ] ; then
|
|
MINIX_ROOT="${MYPWD}"
|
|
elif [ -d ../../minix/drivers ] && [ -d ../../minix/servers ]; then
|
|
MINIX_ROOT="${MYPWD}/../.."
|
|
else
|
|
echo "Please run the script from either of the following locations:"
|
|
echo "> Root of the Minix sources."
|
|
echo " OR"
|
|
echo "> minix/llvm directory of the Minix sources."
|
|
exit 1
|
|
fi
|
|
|
|
MINIX_LLVM_DIR="${MINIX_ROOT}/minix/llvm"
|
|
GOLD_DEST_DIR="${MINIX_ROOT}/minix/llvm/bin"
|
|
|
|
MINIX_ROOT_1=`readlink -f ${MINIX_ROOT}`
|
|
MINIX_DEST_DIR=`readlink -f ${MINIX_ROOT}/../obj.${ARCH}`
|
|
MINIX_TOOLS_DIR="${MINIX_DEST_DIR}/tooldir.`uname -s`-`uname -r`-`uname -m`"
|
|
}
|
|
|
|
# Make sure we are running from the right directory
|
|
check_current_dir
|
|
|
|
# Create common.inc
|
|
if [ ! -f ${MINIX_LLVM_DIR}/common.inc ]; then
|
|
echo "# This file was automatically generated by configure.llvm" > ${MINIX_LLVM_DIR}/common.inc
|
|
echo "DESTDIR=\"${MINIX_DEST_DIR}\"" >> ${MINIX_LLVM_DIR}/common.inc
|
|
echo "TOOLDIR=\"${MINIX_TOOLS_DIR}/bin\"" >> ${MINIX_LLVM_DIR}/common.inc
|
|
fi
|
|
|
|
. ${MINIX_LLVM_DIR}/minix.inc
|
|
|
|
# Set default values for essential variables
|
|
: ${JOBS=1}
|
|
: ${GEN_GOLD_PLUGIN="yes"}
|
|
: ${REBUILD_MINIX="yes"}
|
|
|
|
########################
|
|
# Generate Gold Plugin
|
|
########################
|
|
|
|
if [ "${GEN_GOLD_PLUGIN}" == "yes" ] && [ -f "${MYPWD}/.gold_generated" ]; then
|
|
GEN_GOLD_PLUGIN="no"
|
|
fi
|
|
|
|
if [ "${GEN_GOLD_PLUGIN}" == "yes" ]; then
|
|
${MINIX_LLVM_DIR}/generate_gold_plugin.sh
|
|
if [ ! -f "${GOLD_DEST_DIR}/libLTO.so" ] || [ ! -f "${GOLD_DEST_DIR}/LLVMgold.so" ]; then
|
|
echo "Failure: generate_gold_plugin.sh"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Finished generating gold plugin."
|
|
touch "${MYPWD}/.gold_generated"
|
|
else
|
|
echo "Gold plugin generation: NO"
|
|
fi
|
|
|
|
########################
|
|
# Build Minix
|
|
########################
|
|
export BUILDVARS
|
|
|
|
if [ "${REBUILD_MINIX}" == "yes" ]; then
|
|
|
|
echo "Building Minix..."
|
|
echo "CC:$CC"
|
|
echo "CXX:$CXX"
|
|
echo "JOBS:$JOBS"
|
|
echo "BUILDVARS:$BUILDVARS"
|
|
echo
|
|
cd ${MINIX_ROOT}
|
|
./releasetools/x86_hdimage.sh -b || EXITCODE=1
|
|
cd ${MYPWD}
|
|
if [ "$EXITCODE" != "0" ]; then
|
|
echo "Error: Failed building Minix source code."
|
|
exit $EXITCODE
|
|
else
|
|
echo "Completed building Minix source code."
|
|
fi
|
|
else
|
|
echo "Building Minix: NO"
|
|
fi
|
|
|
|
exit $EXITCODE
|