Commit 5409bf4a authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'fede-review' into v3-rc2

parents fc50e177 14254b30
[submodule "userspace/ptp-noposix"]
path = userspace/ptp-noposix
url = git://gnudd.com/ptp-noposix.git
url = git://ohwr.org/white-rabbit/ppsi/ptp-noposix.git
[submodule "userspace/mini-rpc"]
path = userspace/mini-rpc
url = git://github.com/a-rubini/mini-rpc.git
......@@ -27,7 +27,7 @@ showhelp()
printf " -e \t\t Completely erase the memory (Can erase your configuration)\n"
printf " -b|--build\t Use file that you have build in the WRS_OUTPUT_DIR\n"
printf " --test\t Use file for testing the switch (not available)\n"
printf " --skip\t Don't ask MAC or S/N and use default 02:0B:AD:C0:FF:EE\n\n"
printf " --silent\t Don't ask MAC or S/N and use default 02:0B:AD:C0:FF:EE\n\n"
exit 0
}
......@@ -36,10 +36,10 @@ checkExit()
{
err=0;
if [ $1 ]; then
if [ -f $1 ]; then
return 0;
else
echo "Can't find $1" >& 2;
if [ -f $1 ]; then
return 0;
else
echo "Can't find $1" >& 2;
fi
else
echo "varname not set"
......@@ -62,28 +62,14 @@ modifyMAC()
new=$2
cp $origin $new
# check & change mac address
X="[0-9a-fA-F][0-9a-fA-F]"
while true; do
if echo $MAC | grep "^${X}:${X}:${X}:${X}:${X}:${X}\$" > /dev/null; then
sed -i "s/02:0B:AD:C0:FF:EE/$MAC/" $new
echo "MAC is now: $MAC"
return 0
else
if [ "x$MAC" != "x" ]; then
echo "$0: Invalid MAC address \"$MAC\"" >&2;
fi
if [ $skip ]; then
return 1;
fi
read -p "Enter MAC (XX:XX:XX:XX:XX:XX) or press S (Skip): " MAC
if ( [ "x$MAC" = "xS" ] || [ "x$MAC" = "xs" ] ); then
MAC=""
return 1;
fi
fi
done
# MAC address doesn't need any modification
if [ $silent ]; then
return 1;
fi
# Modify MAC address
sed -i "s/02:0B:AD:C0:FF:EE/$MAC/" $new
echo "MAC is now: $MAC"
return 0
}
# Go to the top directory
......@@ -136,12 +122,12 @@ while [ $# -ge 1 ]; do
fi
memmode="$2"
shift; shift;;
--skip)
--silent)
# set default the MAC address if user didn't set a MAC address
if [ "x$MAC" = "x" ]; then
MAC="02:0B:AD:C0:FF:EE"
fi
skip=1;
silent=1;
shift;;
/* ) DEV="-s $1"; shift ;;
*:* ) MAC="$1"; shift ;;
......@@ -169,7 +155,7 @@ if [ "x$memmode" = "xdf" ]; then
df=1
elif [ "x$memmode" = "xnf" ]; then
nf=1
elif [ "x$memmode" = "xtest" ]; then
elif [ "x$memmode" = "xddr" ]; then
test=1
else
df=1
......
......@@ -4,11 +4,7 @@
# Base dir is forcibly the dirname of this script, as an absolute pathname
dir=$(dirname $0)
if echo $dir | grep -q '^/'; then
WRS_BASE_DIR="$dir";
else
WRS_BASE_DIR="$(echo $(/bin/pwd)/$dir | sed 's-/.$--')";
fi
WRS_BASE_DIR=$(cd $dir && /bin/pwd)
export WRS_BASE_DIR
. ${WRS_BASE_DIR}/scripts/wrs_functions
......@@ -18,20 +14,26 @@ export WRS_BASE_DIR
wrs_setenv_default WRS_OUTPUT_DIR $(/bin/pwd)
wrs_setenv_default WRS_DOWNLOAD_DIR ${WRS_OUTPUT_DIR}/downloads
# Refuse to build within the directory itself
if [ "$WRS_OUTPUT_DIR" = "$WRS_BASE_DIR" ]; then
wrs_die "Please run $(basename $0) from a different directory"
# Allow only absolute path for WRS_OUTPUT_DIR and WRS_DOWNLOAD_DIR
if [ "${WRS_OUTPUT_DIR:0:1}" != "/" ]; then
wrs_die "Invalid WRS_OUTPUT_DIR, only absolute paths are allowed"
fi
if [ "${WRS_DOWNLOAD_DIR:0:1}" != "/" ]; then
wrs_die "Invalid WRS_DOWNLOAD_DIR, only absolute paths are allowed"
fi
#project is WRS_BASE_DIR path without build directory at the end
project=${WRS_BASE_DIR:0:(${#WRS_BASE_DIR}-6)}
# Refuse to build within the wr-switch-sw directory
if echo $WRS_BASE_DIR | grep "^$WRS_OUTPUT_DIR/./build\$" > /dev/null; then
wrs_die "Please run $(basename $0) from a different directory"
if echo $WRS_OUTPUT_DIR | grep "^$project.*\$" > /dev/null; then
wrs_die "Please run $(basename $0) from a different directory outside the wr-switch-sw project"
fi
# Check the tools
WRS_TOOLS="curl svn git gcc g++ ar as m4 libtool gettext md5sum make"
WRS_TOOLS="$WRS_TOOLS awk unzip patch bison flex ncursesw5-config"
WRS_TOOLS="$WRS_TOOLS lua fakeroot gettext"
WRS_TOOLS="$WRS_TOOLS lua fakeroot gettext mkfs.jffs2 makeinfo"
wrs_check_tools $WRS_TOOLS
......
......@@ -194,18 +194,20 @@ have a similar prefix for the same reason).
@table @code
@item WRS_BASE_DIR
The pathname of the build directory (i.e., the @code{build/}
The absolute pathname of the build directory (i.e., the @code{build/}
subdirectory of @code{wr-switch-sw}).
The variable is internally set to the directory
name of the main script. Note that the script cannot
be run from the same directory (i.e.: @code{./wrs_build-all}
is not allowed), you must call it from your output directory
be run from the same directory or from the wr-switch-sw project
directory (i.e.: @code{./wrs_build-all} @code{./build/wrs_build-all}
are not allowed), you must call it from your output directory
using a pathname to invoke it. This variable cannot be
overridden in the main script, but must be pre-set if you run
a sub-script to rebuild only part of the software suite.
@item WRS_OUTPUT_DIR
The pathname of the directory where output is placed. It defaults
The absolute pathname of the directory where output is placed. It
defaults
to the current directory whence you invoke the script (i.e., you
can invoke @code{/path/to/wrs_build-all} to have all output
in the current directory). Compilation
......@@ -214,7 +216,8 @@ have a similar prefix for the same reason).
and final images are placed in a @i{images} subdirectory.
@item WRS_DOWNLOAD_DIR
The directory where downloaded files are placed. If unset
The absolute pathname of the directory where downloaded files
are placed. If unset
it defaults to @code{$WRS_OUTPUT_DIR/downloads}, which is
created if needed. By pre-setting this variable you can
simply recursively delete
......@@ -345,7 +348,7 @@ to generate the terse output shown above:
@example
/path/to/wr-switch-sw/build/wrs_build-all 2>&1 | tee logfile \
| grep '^20..-..-.. ..:'
| grep "^20..-..-.. ..:"
@end example
If you are lucky, everything completes by itself. The time taken
......@@ -1467,6 +1470,14 @@ that should be renamed to @code{g45memtest}.
@c ##########################################################################
@node Schematics
@appendix Schematics
The switch schematics version: 3.0, 3.1 and 3.2 are available on the
OpenHardware repository of the white-rabbit project at the following link:
@uref{http://www.ohwr.org/documents/180}
@c ##########################################################################
@bye
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment