2008-03-04 01:40:49 +01:00
|
|
|
#!/bin/bash
|
2007-02-18 00:21:28 +01:00
|
|
|
# configure.sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
|
|
|
# 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.
|
|
|
|
# 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
|
|
|
# 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 03:25:54 +01:00
|
|
|
BOARD=$1
|
2007-02-18 00:21:28 +01:00
|
|
|
WD=`pwd`
|
2008-01-08 00:13:12 +01:00
|
|
|
TOPDIR="${WD}/.."
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
function show_usage ()
|
|
|
|
{
|
2007-03-23 03:25:54 +01:00
|
|
|
echo "${0} <board-name>"
|
2007-02-18 00:21:28 +01:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2007-03-23 03:25:54 +01:00
|
|
|
if [ "${BOARD}X" = "X" ]; then
|
2007-02-18 00:21:28 +01:00
|
|
|
echo "Missing argument"
|
|
|
|
show_usage
|
|
|
|
fi
|
|
|
|
|
2007-03-23 03:25:54 +01:00
|
|
|
BOARDDIR=${TOPDIR}/configs/${BOARD}
|
2008-01-08 00:13:12 +01:00
|
|
|
if [ ! -d "${BOARDDIR}" ]; then
|
2007-04-29 23:50:53 +02:00
|
|
|
echo "Directory ${BOARDDIR} does not exist. Options are:"
|
|
|
|
echo ""
|
|
|
|
echo `cd ${TOPDIR}/configs ; ls -1 | grep -v CVS | grep -v README.txt`
|
|
|
|
echo ""
|
2007-02-18 00:21:28 +01:00
|
|
|
show_usage
|
|
|
|
fi
|
|
|
|
|
2008-01-08 00:13:12 +01:00
|
|
|
if [ ! -r "${BOARDDIR}/Make.defs" ]; then
|
2007-03-23 03:25:54 +01:00
|
|
|
echo "File ${BOARDDIR}/Make.defs does not exist"
|
2007-02-18 00:21:28 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2008-01-08 00:13:12 +01:00
|
|
|
if [ ! -r "${BOARDDIR}/setenv.sh" ]; then
|
2007-03-23 03:25:54 +01:00
|
|
|
echo "File ${BOARDDIR}/setenv.sh does not exist"
|
2007-02-18 00:21:28 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2008-01-08 00:13:12 +01:00
|
|
|
if [ ! -r "${BOARDDIR}/defconfig" ]; then
|
2007-03-23 03:25:54 +01:00
|
|
|
echo "File ${BOARDDIR}/defconfig does not exist"
|
2007-02-18 00:21:28 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2008-01-08 00:13:12 +01:00
|
|
|
cp -f "${BOARDDIR}/Make.defs" "${TOPDIR}/." || \
|
2007-03-23 03:25:54 +01:00
|
|
|
{ echo "Failed to copy ${BOARDDIR}/Make.defs" ; exit 1 ; }
|
2008-01-08 00:13:12 +01:00
|
|
|
cp -f "${BOARDDIR}/setenv.sh" "${TOPDIR}/." || \
|
2007-03-23 03:25:54 +01:00
|
|
|
{ echo "Failed to copy ${BOARDDIR}/setenv.sh" ; exit 1 ; }
|
2008-01-08 00:13:12 +01:00
|
|
|
chmod 755 "${TOPDIR}/setenv.sh"
|
|
|
|
cp -f "${BOARDDIR}/defconfig" "${TOPDIR}/.config" || \
|
2007-03-23 03:25:54 +01:00
|
|
|
{ echo "Failed to copy ${BOARDDIR}/defconfig" ; exit 1 ; }
|
2007-02-18 00:21:28 +01:00
|
|
|
|