2008-03-04 08:40:49 +08:00
|
|
|
#!/bin/bash
|
2007-02-18 07:21:28 +08:00
|
|
|
# configure.sh
|
|
|
|
#
|
2008-08-29 23:36:02 +08:00
|
|
|
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
2007-02-18 07:21:28 +08:00
|
|
|
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
2008-08-29 23:36:02 +08:00
|
|
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
2007-02-18 07:21:28 +08:00
|
|
|
# used to endorse or promote products derived from this software
|
|
|
|
# without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
#set -x
|
|
|
|
|
2007-03-23 10:25:54 +08:00
|
|
|
BOARD=$1
|
2007-02-18 07:21:28 +08:00
|
|
|
WD=`pwd`
|
2008-01-08 07:13:12 +08:00
|
|
|
TOPDIR="${WD}/.."
|
2007-02-18 07:21:28 +08:00
|
|
|
|
|
|
|
function show_usage ()
|
|
|
|
{
|
2007-03-23 10:25:54 +08:00
|
|
|
echo "${0} <board-name>"
|
2007-02-18 07:21:28 +08:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2007-03-23 10:25:54 +08:00
|
|
|
if [ "${BOARD}X" = "X" ]; then
|
2007-02-18 07:21:28 +08:00
|
|
|
echo "Missing argument"
|
|
|
|
show_usage
|
|
|
|
fi
|
|
|
|
|
2007-03-23 10:25:54 +08:00
|
|
|
BOARDDIR=${TOPDIR}/configs/${BOARD}
|
2008-01-08 07:13:12 +08:00
|
|
|
if [ ! -d "${BOARDDIR}" ]; then
|
2007-04-30 05:50:53 +08:00
|
|
|
echo "Directory ${BOARDDIR} does not exist. Options are:"
|
|
|
|
echo ""
|
2008-08-29 23:36:02 +08:00
|
|
|
echo "Select one of the following options for <board-name>:"
|
|
|
|
configlist=`find ${TOPDIR}/configs -name defconfig`
|
|
|
|
for defconfig in $configlist; do
|
|
|
|
config=`dirname $defconfig | sed -e "s,${TOPDIR}/configs/,,g"`
|
|
|
|
echo " $config"
|
|
|
|
done
|
2007-04-30 05:50:53 +08:00
|
|
|
echo ""
|
2007-02-18 07:21:28 +08:00
|
|
|
show_usage
|
|
|
|
fi
|
|
|
|
|
2008-01-08 07:13:12 +08:00
|
|
|
if [ ! -r "${BOARDDIR}/Make.defs" ]; then
|
2007-03-23 10:25:54 +08:00
|
|
|
echo "File ${BOARDDIR}/Make.defs does not exist"
|
2007-02-18 07:21:28 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2008-01-08 07:13:12 +08:00
|
|
|
if [ ! -r "${BOARDDIR}/setenv.sh" ]; then
|
2007-03-23 10:25:54 +08:00
|
|
|
echo "File ${BOARDDIR}/setenv.sh does not exist"
|
2007-02-18 07:21:28 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2008-01-08 07:13:12 +08:00
|
|
|
if [ ! -r "${BOARDDIR}/defconfig" ]; then
|
2007-03-23 10:25:54 +08:00
|
|
|
echo "File ${BOARDDIR}/defconfig does not exist"
|
2007-02-18 07:21:28 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2008-01-08 07:13:12 +08:00
|
|
|
cp -f "${BOARDDIR}/Make.defs" "${TOPDIR}/." || \
|
2007-03-23 10:25:54 +08:00
|
|
|
{ echo "Failed to copy ${BOARDDIR}/Make.defs" ; exit 1 ; }
|
2008-01-08 07:13:12 +08:00
|
|
|
cp -f "${BOARDDIR}/setenv.sh" "${TOPDIR}/." || \
|
2007-03-23 10:25:54 +08:00
|
|
|
{ echo "Failed to copy ${BOARDDIR}/setenv.sh" ; exit 1 ; }
|
2008-01-08 07:13:12 +08:00
|
|
|
chmod 755 "${TOPDIR}/setenv.sh"
|
|
|
|
cp -f "${BOARDDIR}/defconfig" "${TOPDIR}/.config" || \
|
2007-03-23 10:25:54 +08:00
|
|
|
{ echo "Failed to copy ${BOARDDIR}/defconfig" ; exit 1 ; }
|
2007-02-18 07:21:28 +08:00
|
|
|
|