@@ -14,7 +14,7 @@ usage()
1414 echo " options:"
1515 echo " -help Print this usage"
1616 echo " -aarch Architecture <aarch32/aarch64>"
17- echo " -sysroot Absolute path to sysroot of target architecture"
17+ echo " -sysroot Path to sysroot of target architecture"
1818 echo " -compiler [optional] Path to 'gcc' cross compiler"
1919 echo " If not specified default paths in host will be searched"
2020 echo " -clean, clean Remove build directories"
@@ -30,15 +30,16 @@ usage_and_exit()
3030SAVED_OPTIONS=$( set +o)
3131# Don't print all commands
3232set +x
33- # Get real script by read symbol link
33+ # Get the canonical file name of the current script
3434THIS_SCRIPT=` readlink -f ${BASH_SOURCE[0]} `
3535
3636PROGRAM=` basename $0 `
3737
3838BUILDDIR=$( readlink -f $( dirname ${BASH_SOURCE[0]} ) )
3939CORE=` grep -c ^processor /proc/cpuinfo`
4040CMAKE=cmake
41- OS_HOST=` grep ' ^ID=' /etc/os-release | awk -F= ' {print $2}' | tr -d ' "' `
41+ source /etc/os-release
42+ OS_HOST=$ID
4243
4344if [[ $OS_HOST == " centos" ]] || [[ $OS_HOST == " rhel" ]]; then
4445 CMAKE=cmake3
@@ -67,10 +68,10 @@ while [ $# -gt 0 ]; do
6768 -clean | clean )
6869 clean=1
6970 ;;
70- -compiler )
71- shift
72- COMPILER=$1
73- ;;
71+ -compiler )
72+ shift
73+ COMPILER=$1
74+ ;;
7475 --* | -* )
7576 error " Unregognized option: $1 "
7677 ;;
@@ -100,6 +101,7 @@ if [ -z $AARCH ] || [ -z $SYSROOT ] ; then
100101 error " Please provide the required options 'aarch', 'sysroot'"
101102fi
102103
104+ SYSROOT=` readlink -f $SYSROOT `
103105if [ ! -d $SYSROOT ]; then
104106 error " SYSROOT is not accessible"
105107fi
@@ -142,10 +144,11 @@ if [ ! -f ${SYSROOT}/etc/os-release ]; then
142144 OS_TARGET=" CentOS"
143145 echo " INFO: Cross Compiling XRT for $AARCH "
144146else
145- OS_TARGET=` grep ' ^ID=' ${SYSROOT} /etc/os-release | awk -F= ' {print $2}' | tr -d ' "' `
146- if [ $OS_TARGET == " ubuntu" ]; then
147- OS_TARGET=" Ubuntu"
148- VERSION=` grep ' ^VERSION_ID=' ${SYSROOT} /etc/os-release | awk -F= ' {print $2}' | tr -d ' "' `
147+ source ${SYSROOT} /etc/os-release
148+ OS_TARGET=$ID
149+ if [ $OS_TARGET == " ubuntu" ] || [ $OS_TARGET == " debian" ]; then
150+ OS_TARGET=${OS_TARGET^}
151+ VERSION=$VERSION_ID
149152 else
150153 OS_TARGET=` cat ${SYSROOT} /etc/redhat-release | awk ' {print $1}' | tr -d ' "' `
151154 VERSION=` cat ${SYSROOT} /etc/redhat-release | awk ' {print $4}' | tr -d ' "' `
0 commit comments