Commit d460c6a8 authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'fede-review' into v3

parents d0be3bc6 cac71a78
......@@ -83,7 +83,7 @@ lua-5.1.4.tar.gz d0870f2de55d59c1c8419f36e8fac150 \
http://www.lua.org/ftp/lua-5.1.4.tar.gz
lzo-2.06.tar.gz 95380bd4081f85ef08c5209f4107e9f8 \
http://www.lzop.org/download/lzo-2.06.tar.gz
http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz
m4-1.4.15.tar.bz2 c7c32540bc3842d5550f88d47ef551d8 \
http://ftp.gnu.org/pub/gnu/m4/m4-1.4.15.tar.bz2
......
......@@ -22,12 +22,12 @@ showhelp()
printf "<firmware>.tar.gz: Use the file in the firmware to flash the device\n"
printf "DEV:\t The usb device (by default it is /dev/ttyACM0)\n"
printf "Options: \n"
printf "\t-h|--help\t\t Show this help message\n"
printf "\t-m|--mode\t\t can be: default, df (dataflash), nf (nandflash), test.\n"
printf "\t-e \t\t\t Completely erase the memory (Can erase your configuration)\n"
printf "\t--build\t\t\t Use file that you have build in the WRS_OUTPUT_DIR\n"
printf "\t--test\t\t\t Use file for testing the switch (not available)\n"
printf "\t--skip\t\t Don't ask MAC or S/N and use default 02:0B:AD:C0:FF:EE\n\n"
printf " -h|--help\t Show this help message\n"
printf " -m|--mode\t can be: default (df and nf), df (dataflash),\n\t\t nf (nandflash), ddr (ddr memories).\n"
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"
exit 0
}
......@@ -47,6 +47,15 @@ checkExit()
exit 1
}
checkMAC()
{
X="[0-9a-fA-F][0-9a-fA-F]"
if echo $1 | grep "^${X}:${X}:${X}:${X}:${X}:${X}\$" > /dev/null; then
return 0
fi
return 1
}
modifyMAC()
{
origin=$1
......@@ -118,8 +127,22 @@ while [ $# -ge 1 ]; do
rootfs=/tmp/wrs-image.jffs2.img
shift;;
-h|--help) showhelp; shift;;
-m|--memmode) memmode="$2"; shift; shift;;
--skip) skip=1; shift;;
-m|--memmode)
# verify memory mode
if [ "$2" != "nf" ] && [ "$2" != "df" ] && [ "$2" != "ddr" ] && [ "$2" != "default" ]; then
echo "Error: Invalid memory mode"
showhelp
exit 1
fi
memmode="$2"
shift; shift;;
--skip)
# 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;
shift;;
/* ) DEV="-s $1"; shift ;;
*:* ) MAC="$1"; shift ;;
......@@ -128,6 +151,19 @@ while [ $# -ge 1 ]; do
esac
done
#MAC address is a mandatory field
if [ "x$MAC" = "x" ]; then
echo "Error: MAC address is mandatory"
showhelp
exit 1
else
checkMAC $MAC
if [ $? -eq 1 ];then
echo "Error: MAC address is invalid ($MAC)"
exit 1
fi
fi
## Selecting the running memmode
if [ "x$memmode" = "xdf" ]; then
df=1
......
......@@ -23,6 +23,11 @@ if [ "$WRS_OUTPUT_DIR" = "$WRS_BASE_DIR" ]; then
wrs_die "Please run $(basename $0) from a different directory"
fi
# 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"
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"
......@@ -47,10 +52,9 @@ showhelp() {
echo ""
echo "Options:"
echo " --help Show this little message"
echo " --pack Create a tar.gz package with the files"
echo " --clean Remove all the previous configuration"
echo " --fetch Force fetching the new download files"
echo " --list List the different building steps"
echo " --pack Create a tar.gz package with the files in ${WRS_OUTPUT_DIR}/images/"
echo " --step=[00-09] Perform one specific step"
echo ""
exit 0;
......@@ -93,7 +97,6 @@ if [ -n "$1" ]; then
case "$1" in
--help) showhelp;;
--clean) clean;;
--fetch) echo "To be done";;
--list) cd $WRS_DONE_DIR; ls 0*; exit 0;;
--pack) pack; exit 0;;
--step=0[0-9]) num=`echo $1 | sed -e 's/--step=//'`; rm -vf $WRS_DONE_DIR/${num}-*;;
......@@ -152,4 +155,3 @@ if $failed_step; then
wrs_die "One or more build steps failed"
fi
wrs_echo "Complete build succeeded, apparently"
This diff is collapsed.
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