#
# Setup script for PetaLinux development environment.
# Run using 'source ./settings.sh'
#
# Copyright (c) 2006 PetaLogix
#
script_name='settings.sh'
#
# Make sure our current working directory represents
# a valid PetaLinux environment.
#
if [ ! -f $script_name ]; then
echo
echo Please change to the root directory of your PetaLinux
echo environment and type \'source ./$script_name\'.
echo
#
# And check that we are being run using 'source ./file' rather
# than 'sh ./file'.
#
elif [ `basename $0` == $script_name ]; then
echo
echo Please use \'source ./$script_name\'.
echo
else
PETALINUX=`pwd`
export PETALINUX
# Figure out host system architecture
# for now, only linux-i386 supported
HOSTARCH=linux-i386
#
# Add required binary tools to the user's search path
#
PATH=$PETALINUX/tools/common/petalogix/bin:$PATH
PATH=$PETALINUX/tools/${HOSTARCH}/petalogix/bin:$PATH
PATH=$PETALINUX/tools/${HOSTARCH}/microblaze-uclinux-tools/bin:$PATH
#
# Check for "." or ".\" in the path - it's broken
#
echo $PATH | tr ":" "\n" | grep '^\./*$' > /dev/null &&
echo "WARNING: '.' detected in PATH - fixing it." 1>&2
PATH=`echo ${PATH} | tr ":" "\n" | grep -v '^\./*$' | tr "\n" ":"`
export PATH
echo PetaLinux environment set to \'$PETALINUX\'
fi