1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
|
#!/bin/bash
#
# Configure
#
# linux-wlan Open Sourc Project
#
# Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
# -------------------------------------------------------------------------
#
# Inquiries regarding the linux-wlan Open Source Project can be
# made directly to:
#
# AbsoluteValue Systems Inc.
# info@linux-wlan.com
# http://www.linux-wlan.com
#
# -------------------------------------------------------------------------
# TODO: Since we're dependent on configured pcmcia source, we should change
# this such that it will ask for the pcmcia source dir and then read
# all our stuff from pcmcia/config.mk. Would simplify alot of things.
# -------------------------------------------------------------------------
#
# This script adapted from the pcmcia-cs/Configure file, license statement below:
#
# pcmcia-cs/Configure 1.110 1999/06/24 17:37:36
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and
# limitations under the License.
#
# The initial developer of the Configure code is David A. Hinds
# <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
# are Copyright (C) 1998 David A. Hinds. All Rights Reserved.
#-------------------------------------------------------------------------
ECHO="/bin/echo -e "
fail ()
{
$ECHO ""
$ECHO "Configuration failed"
$ECHO ""
exit 1
}
usage () {
$ECHO "usage: Configure [-h|help|-d [filename]|-f <filename>]"
$ECHO ""
$ECHO " -h|help - display usage info"
$ECHO " -d [filename] - automated configuration with option to specify input file"
$ECHO " -f <filename> - read configuration data from file and prompt user"
exit 1
}
if [ ! -r config.in ]; then
$ECHO "config.in does not exist!"
fail
fi
. ./config.in
if [ -r config.out ]; then
. ./config.out 2>/dev/null
fi
PROMPT=y
if [ $# -gt 0 ] ; then
if [ "$1" = "-h" -o "$1" = "help" ] ; then
usage
fi
if [ "$1" = "-d" -o "$1" = "-f" ] ; then
if [ $# -gt 1 ] ; then
if [ -r $2 ]; then
. $2
else
$ECHO "$2 does not exist"
fail
fi
else
if [ "$1" = "-f" ] ; then
usage
fi
fi
if [ "$1" = "-d" ] ; then
PROMPT=n
fi
fi
fi
#=======================================================================
CONFIG=config.new
CONFIG_MK=config.mk
rm -f $CONFIG $CONFIG_MK $MODVER
cat << 'EOF' > $CONFIG
#
# Automatically generated by 'make config' -- don't edit!
#
EOF
write_bool() {
value=`eval $ECHO '$'$1`
if [ "$value" = "y" ] ; then
$ECHO "$1=y" >> $CONFIG
$ECHO "$1=y" >> $CONFIG_MK
else
$ECHO "$1=n" >> $CONFIG
$ECHO "# $1 is not defined" >> $CONFIG_MK
fi
}
write_str () {
value=`eval $ECHO '$'$1`
$ECHO "$1"=\"$value\" >> $CONFIG
$ECHO "$1=$value" >> $CONFIG_MK
}
dump_str () {
$ECHO "$1" >> $CONFIG
$ECHO "$1" >> $CONFIG_MK
}
prompt () {
eval $3=\"$2\"
if [ "$PROMPT" = "y" ] ; then
$ECHO "$1 [$2]: \c"
read tmp
if [ -n "$tmp" ] ; then eval $3=\"$tmp\" ; fi
else
$ECHO "$1 [$2]"
fi
}
ask_bool () {
default=`eval $ECHO '$'$2`
if [ ! "$default" ] ; then default=n ; fi
answer=""
while [ "$answer" != "n" -a "$answer" != "y" ] ; do
prompt "$1 (y/n)" "$default" answer
done
eval "$2=$answer"
write_bool $2
}
ask_str () {
default=`eval $ECHO '$'$2`
prompt "$1" "`$ECHO $default`" answer
eval $2=\"$answer\"
write_str $2
}
mkversionh () {
versionh=src/include/wlan/version.h
cp src/version.h.in $versionh
DATE=`date`
printf '#define WLAN_RELEASE\t"%d.%d.%d%s"\n' \
${WLAN_VERSION} \
${WLAN_PATCHLEVEL} \
${WLAN_SUBLEVEL} \
${WLAN_EXTRAVERSION} >> $versionh
printf '#define WLAN_RELEASE_CODE 0x%02x%02x%02x\n' \
${WLAN_VERSION} \
${WLAN_PATCHLEVEL} \
${WLAN_SUBLEVEL} >> $versionh
echo "#define WLAN_BUILD_DATE \"$DATE\" " >> $versionh
printf '\n' >> $versionh
printf '#endif\n' >> $versionh
}
#=======================================================================
# If the src/include/wlan/version.h file needs a touchup, fix or create it
if [ -r src/include/wlan/version.h ]; then
WLAN_RELEASE="${WLAN_VERSION}.${WLAN_PATCHLEVEL}.${WLAN_SUBLEVEL}${WLAN_EXTRAVERSION}"
OLD_RELEASE=`sed --quiet -e '/#define.*WLAN_RELEASE[^_].*\"\(.*\)\"/s//\1/p' < src/include/wlan/version.h`
if [ "${WLAN_RELEASE}" != "${OLD_RELEASE}" ]; then
# Overwrite the file
mkversionh
fi
else
# File doesn't exist, create it
mkversionh
fi
$ECHO ""
$ECHO "-------------- Linux WLAN Configuration Script -------------"
$ECHO ""
$ECHO "The default responses are correct for most users."
$ECHO ""
#=======================================================================
# Should we build for PCMCIA Card Services?
ask_bool "Build Prism2.x PCMCIA Card Services (_cs) driver?" PRISM2_PCMCIA
#=======================================================================
# Should we build for PLX9052 based PCI adapters?
ask_bool "Build Prism2 PLX9052 based PCI (_plx) adapter driver?" PRISM2_PLX
#=======================================================================
# Should we build for Prism2 native PCI?
ask_bool "Build Prism2.5 native PCI (_pci) driver?" PRISM2_PCI
#=======================================================================
# Should we build for Prism2.5 USB?
ask_bool "Build Prism2.5 USB (_usb) driver?" PRISM2_USB
$ECHO ""
#=======================================================================
# Collect the kernel source tree and test for sanity
CUR_RELEASE=`uname -r`
if [ "$LINUX_SRC" = "" ] ; then
LINUX_SRC=/lib/modules/$CUR_RELEASE/build
fi
ask_str "Linux source directory" LINUX_SRC
if [ ! -f $LINUX_SRC/include/linux/version.h ] ; then
$ECHO "Linux source tree $LINUX_SRC is incomplete or missing!"
if [ -d $LINUX_SRC/include/linux ] ; then
$ECHO " The kernel header files are present, but not " \
"the full source code."
fi
$ECHO " See the HOWTO for a list of FTP sites for current" \
"kernel sources."
fail
fi
KERNEL_SOURCE=$LINUX_SRC make -Cscripts 2>&1 > /dev/null
. scripts/make.opts
# What kernel are we compiling for?
version () {
expr $1 \* 65536 + $2 \* 256 + $3
}
$ECHO ""
SRC_RELEASE="$KERNEL_RELEASE"
VERSION_CODE=`grep LINUX_VERSION_CODE $LINUX_SRC/include/linux/version.h | \
sed -e 's/[^0-9]//g'`
$ECHO "The kernel source tree is version $SRC_RELEASE."
if [ $VERSION_CODE -lt `version 2 4 0` ] ; then
$ECHO "This package requires at least a 2.4.x series kernel."
fail
fi
if [ $VERSION_CODE -gt `version 2 5 0` ] ; then
KERN_25=y
write_bool KERN_25
fi
if [ $VERSION_CODE -ge `version 2 6 5` ] ; then
KERN_2_6_5=y
fi
write_bool KERN_2_6_5
if [ $VERSION_CODE -ge `version 2 6 17` ] ; then
KERN_2_6_17=y
fi
write_bool KERN_2_6_17
if [ $VERSION_CODE -gt `version 2 6 24` ] ; then
$ECHO "******* WARNING WARNING WARNING *******"
$ECHO "Kernels newer than 2.6.24.x are not supported."
$ECHO "******* WARNING WARNING WARNING *******"
fi
if [ "$SRC_RELEASE" != "$CUR_RELEASE" ] ; then
$ECHO "WARNING: the current running kernel is actually version $CUR_RELEASE."
fi
if [ ! -f $LINUX_SRC/.config ] ; then
$ECHO "WARNING: .config not present in kernel source tree. This will"
$ECHO " screw up modversions detection and build optimizations."
$ECHO " Is this a RedHat kernel? Workarounds enabled."
if [ -f $LINUX_SRC/include/linux/modversions.h ] ; then
KERNEL_MODFLAGS="-DMODULE -DMODVERSIONS -include $LINUX_SRC/include/linux/modversions.h"
fi
$ECHO " For an optimized build, copy over the relevent file from"
$ECHO " $LINUX_SRC/configs/ to $LINUX_SRC/.config"
fi
# Check for consistent kernel build dates
CUR_D=`uname -v | sed -e 's/^#[0-9]* //;s/SMP //;s/PREEMPT //;'`
CUR_D=`$ECHO $CUR_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'`
$ECHO "The current kernel build date is $CUR_D."
UTS_VERSION="unknown";
if [ -f $LINUX_SRC/include/linux/compile.h ] ; then
UTS_VERSION=`grep UTS_VERSION $LINUX_SRC/include/linux/compile.h |
sed -e 's/.*"\(.*\)"/\1/'`
SRC_D=`$ECHO $UTS_VERSION | sed -e 's/^#[0-9]* //;s/SMP //;s/PREEMPT //;'`
SRC_D=`$ECHO $SRC_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'`
if [ $SRC_RELEASE = $CUR_RELEASE -a "$SRC_D" != "$CUR_D" ] ; then
$ECHO "WARNING: the source tree has a build date of $SRC_D."
if [ `date -d "$SRC_D" +%s` -gt `date -d "$CUR_D" +%s` ] ; then
$ECHO " Did you forget to install your new kernel?!?"
fi
fi
fi
$ECHO ""
# Test for netlink availability in the kernel
if grep -sq "#define.*CONFIG_NETLINK.*1" ${LINUX_SRC}/include/linux/autoconf.h; then
CONFIG_NETLINK=y
else
CONFIG_NETLINK=n
fi
write_bool CONFIG_NETLINK
# Test for pf_packet availability in the kernel
if grep -sq "#define.*CONFIG_PACKET.*1" ${LINUX_SRC}/include/linux/autoconf.h; then
CONFIG_PACKET=y
else
CONFIG_PACKET=n
fi
write_bool CONFIG_PACKET
# Test for pf_packet availability in the kernel
if grep -sq "#define.*CONFIG_HOTPLUG.*1" ${LINUX_SRC}/include/linux/autoconf.h; then
CONFIG_HOTPLUG=y
else
CONFIG_HOTPLUG=n
fi
write_bool CONFIG_HOTPLUG
# test to see if __KERNEL__ is defined in KERNEL_CFLAGS
# if not, $KERNEL_CFLAGS += __KERNEL__
grep __KERNEL__ < scripts/make.opts > /dev/null
if [ $? = 1 ] ; then
KERNEL_CFLAGS="-D__KERNEL__ -I$LINUX_SRC/include $KERNEL_CFLAGS"
fi
dump_str "KERNEL_CFLAGS=$KERNEL_CFLAGS"
dump_str "KERNEL_MODFLAGS=$KERNEL_MODFLAGS"
#=======================================================================
# If compiling for pcmcia-cs, find the PCMCIA source tree
if [ $PRISM2_PCMCIA = "y" ] ; then
# Should we build for Kernel based PCMCIA?
WLAN_KERN_PCMCIA=y
grep 'define CONFIG_PCMCIA' < $LINUX_SRC/include/linux/autoconf.h > /dev/null
if [ $? = 1 ] ; then
WLAN_KERN_PCMCIA=n
fi
write_bool WLAN_KERN_PCMCIA
# We only need the pcmcia source directory if we're NOT building for
# kernel PCMCIA.
if [ $WLAN_KERN_PCMCIA != "y" ] ; then
if [ ! "$PCMCIA_SRC" ] ; then
if [ -f /sbin/cardctl ] ; then
PCMCIA_SRC=`/sbin/cardctl -V 2>&1 | sed -e 's/cardctl version //'`
PCMCIA_SRC=/usr/src/pcmcia-cs-$PCMCIA_SRC
fi
fi
ask_str "pcmcia-cs source dir" PCMCIA_SRC
if [ ! -f $PCMCIA_SRC/Makefile ] ; then
$ECHO "pcmcia-cs source tree $PCMCIA_SRC is incomplete or missing!"
$ECHO "The wlan driver for pcmcia cannot be built without "
$ECHO "the pcmcia-cs source tree present and configured."
fail
fi
if [ ! -f $PCMCIA_SRC/include/pcmcia/config.h ] ; then
$ECHO "The pcmcia-cs source tree does not appear to be configured."
$ECHO "The wlan driver for pcmcia cannot be built without "\
$ECHO "the pcmcia-cs source tree present and configured."
fail
fi
$ECHO ""
# Now we need to generate the module options flags.
# It's only relevant if modversions is turned on.
grep CONFIG_MODVERSIONS=y < $PCMCIA_SRC/config.mk > /dev/null
if [ $? = 0 ] ; then
PCMCIA_MODFLAGS="-DMODULE -DMODVERSIONS -include $PCMCIA_SRC/include/linux/modversions.h"
else
PCMCIA_MODFLAGS="-DMODULE"
fi
# new versions of pcmcia-cs don't generate their own modversion.h
# if they don't have it, use the kernel module flags instead.
if [ ! -f $PCMCIA_SRC/include/linux/modversions.h ] ; then
PCMCIA_MODFLAGS="$KERNEL_MODFLAGS"
fi
dump_str "PCMCIA_MODFLAGS=$PCMCIA_MODFLAGS"
fi
fi
#=======================================================================
# Alternate target install root dir - the value of this variable
# will prefix other variables, such as modules and pcmcia directories
ask_str "Alternate target install root directory on host" TARGET_ROOT_ON_HOST
if [ $PRISM2_PCMCIA = "y" ] ; then
# PCMCIA script dir
ask_str "PCMCIA script directory" PCMCIA_DIR
TARGET_PCMCIA_DIR=$TARGET_ROOT_ON_HOST$PCMCIA_DIR
write_str TARGET_PCMCIA_DIR
fi
MODDIR=/lib/modules/$SRC_RELEASE
ask_str " Module install directory" MODDIR
TARGET_MODDIR=$TARGET_ROOT_ON_HOST$MODDIR/linux-wlan-ng
write_str TARGET_MODDIR
$ECHO ""
# Just write some out (we're not prompting right now)
write_str INST_EXEDIR
TARGET_INST_EXEDIR=$TARGET_ROOT_ON_HOST$INST_EXEDIR
write_str TARGET_INST_EXEDIR
#=======================================================================
# How should the startup scripts be configured?
SYSV_INIT=n
if [ "$PREFIX" = "" ] ; then
if [ -d /etc/rc.d/init.d -o -d /etc/init.d -o -d /sbin/init.d ] ; then
$ECHO "It looks like you have a System V init file setup."
SYSV_INIT=y
if [ -d /etc/rc.d/init.d ] ; then
$ECHO "RC_DIR=/etc/rc.d" >> $CONFIG
$ECHO "RC_DIR=/etc/rc.d" >> $CONFIG_MK
elif [ -d /sbin/init.d ] ; then
$ECHO "RC_DIR=/sbin" >> $CONFIG
$ECHO "RC_DIR=/sbin" >> $CONFIG_MK
else
$ECHO "RC_DIR=/etc" >> $CONFIG
$ECHO "RC_DIR=/etc" >> $CONFIG_MK
fi
else
$ECHO "It looks like you have a BSD-ish init file setup."
if ! grep rc.wlan /etc/rc.d/rc.S >/dev/null ; then
$ECHO " You'll need to edit /etc/rc.d/rc.S to invoke" \
"/etc/rc.d/rc.wlan (for ISA/PCMCIA cards)"
$ECHO " so that wlan cards will be started at boot time."
fi
SYSV_INIT=n
fi
write_bool SYSV_INIT
else
ask_bool "System V init script layout" SYSV_INIT
if [ "$SYSV_INIT" = "y" ] ; then
ask_str "Top-level directory for RC scripts" RC_DIR
fi
fi
if [ ! -x $TARGET_ROOT_ON_HOST/sbin/depmod ] ; then INSTALL_DEPMOD=n ; fi
write_bool INSTALL_DEPMOD
$ECHO ""
#=======================================================================
# Make sure our target architecture is correct
$ECHO ""
ask_str "Prefix for build host compiler? (rarely needed)" HOST_COMPILE
dump_str "HOST_CFLAGS=$HOST_CFLAGS"
$ECHO ""
dump_str 'HOST_AS=$(HOST_COMPILE)as'
dump_str 'HOST_LD=$(HOST_COMPILE)ld'
dump_str 'HOST_CC=$(HOST_COMPILE)gcc'
dump_str 'HOST_CPP=$(HOST_CC) -E'
dump_str 'HOST_AR=$(HOST_COMPILE)ar'
dump_str 'HOST_NM=$(HOST_COMPILE)nm'
dump_str 'HOST_STRIP=$(HOST_COMPILE)strip'
dump_str 'HOST_OBJCOPY=$(HOST_COMPILE)objcopy'
dump_str 'HOST_OBJDUMP=$(HOST_COMPILE)objdump'
dump_str 'HOST_RANLIB=$(HOST_COMPILE)ranlib'
dump_str 'HOST_MAKE=make'
CROSS_COMPILE_ENABLED=y
if [ "_$CROSS_COMPILE" = "_" ] ; then
CROSS_COMPILE_ENABLED=n
fi
write_str CROSS_COMPILE
write_bool CROSS_COMPILE_ENABLED
#dump_str 'CFLAGS=-O2 -Wall -Wstrict-prototypes -pipe'
if [ "_$CROSS_COMPILE" = "_" ] ; then
dump_str 'AS=$(HOST_COMPILE)as'
dump_str 'LD=$(HOST_COMPILE)ld'
dump_str 'CC=$(HOST_COMPILE)gcc'
dump_str 'CPP=$(HOST_CC) -E'
dump_str 'AR=$(HOST_COMPILE)ar'
dump_str 'NM=$(HOST_COMPILE)nm'
dump_str 'STRIP=$(HOST_COMPILE)strip'
dump_str 'OBJCOPY=$(HOST_COMPILE)objcopy'
dump_str 'OBJDUMP=$(HOST_COMPILE)objdump'
dump_str 'RANLIB=$(HOST_COMPILE)ranlib'
dump_str 'MAKE=make'
else
dump_str "AS=$CROSS_COMPILE"as
dump_str "LD=$CROSS_COMPILE"ld
dump_str "CC=$CROSS_COMPILE"gcc
CC="$CROSS_COMPILE"gcc
dump_str "CPP=$CC -E"
dump_str "AR=$CROSS_COMPILE"ar
dump_str "NM=$CROSS_COMPILE"nm
dump_str "STRIP=$CROSS_COMPILE"strip
dump_str "OBJCOPY=$CROSS_COMPILE"objcopy
dump_str "OBJDUMP=$CROSS_COMPILE"objdump
dump_str "RANLIB=$CROSS_COMPILE"ranlib
dump_str "MAKE=make"
fi
#=======================================================================
# Should we build for debugging?
ask_bool "Build for debugging (see doc/config.debug)" WLAN_DEBUG
$ECHO ""
FIRMWARE_DIR="/etc/wlan/"
write_str FIRMWARE_DIR
WLAN_SRC=`pwd`/src/
write_str WLAN_SRC
mv $CONFIG config.out
$ECHO ""
$ECHO "Configuration successful. Now type 'make' and pray."
$ECHO ""
|