2007-10-04 17:07:51 +04:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# Shell script to integrate madwifi sources into a Linux
|
|
|
|
# source tree so it can be built statically. Typically this
|
|
|
|
# is done to simplify debugging with tools like kgdb.
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo "FATAL ERROR: $1" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
SRC=..
|
2008-06-19 04:33:04 +04:00
|
|
|
KERNEL_VERSION=$(uname -r)
|
2007-10-04 17:07:51 +04:00
|
|
|
|
|
|
|
if test -n "$1"; then
|
|
|
|
KERNEL_PATH="$1"
|
|
|
|
else if test -e /lib/modules/${KERNEL_VERSION}/source; then
|
|
|
|
KERNEL_PATH="/lib/modules/${KERNEL_VERSION}/source"
|
|
|
|
else if test -e /lib/modules/${KERNEL_VERSION}/build; then
|
|
|
|
KERNEL_PATH="/lib/modules/${KERNEL_VERSION}/build"
|
|
|
|
else
|
|
|
|
die "Cannot guess kernel source location"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
test -d ${KERNEL_PATH} || die "No kernel directory ${KERNEL_PATH}"
|
|
|
|
|
|
|
|
PATCH()
|
|
|
|
{
|
|
|
|
patch -N $1 < $2
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Location of various pieces. These mimic what is in Makefile.inc
|
|
|
|
# and can be overridden from the environment.
|
|
|
|
#
|
2009-04-07 05:26:53 +04:00
|
|
|
SRC_HAL=${HAL:-${SRC}/ath_hal}
|
|
|
|
test -d ${SRC_HAL} || die "No ath_hal directory ${SRC_HAL}"
|
2007-10-04 17:07:51 +04:00
|
|
|
SRC_NET80211=${WLAN:-${SRC}/net80211}
|
|
|
|
test -d ${SRC_NET80211} || die "No net80211 directory ${SRC_NET80211}"
|
|
|
|
SRC_ATH=${ATH:-${SRC}/ath}
|
|
|
|
test -d ${SRC_ATH} || die "No ath directory ${SRC_ATH}"
|
|
|
|
SRC_ATH_RATE=${SRC}/ath_rate
|
|
|
|
test -d ${SRC_ATH_RATE} ||
|
|
|
|
die "No rate control algorithm directory ${SRC_ATH_RATE}"
|
|
|
|
SRC_COMPAT=${SRC}/include
|
|
|
|
test -d ${SRC_COMPAT} || die "No compat directory ${SRC_COMPAT}"
|
|
|
|
|
|
|
|
WIRELESS=${KERNEL_PATH}/drivers/net/wireless
|
|
|
|
test -d ${WIRELESS} || die "No wireless directory ${WIRELESS}"
|
|
|
|
|
|
|
|
echo "Copying top-level files"
|
|
|
|
MADWIFI=${WIRELESS}/madwifi
|
|
|
|
rm -rf ${MADWIFI}
|
|
|
|
mkdir -p ${MADWIFI}
|
2013-11-08 20:06:54 +04:00
|
|
|
cp -f ${SRC}/BuildCaps.inc ${SRC}/release.h ${MADWIFI}
|
2007-10-04 17:07:51 +04:00
|
|
|
|
|
|
|
|
|
|
|
echo "Copying source files"
|
2009-04-07 05:26:53 +04:00
|
|
|
FILES=$(cd ${SRC} && find ath ath_hal ath_rate include net80211 -name '*.[ch]')
|
|
|
|
FILES="$FILES $(cd ${SRC} && find ath_hal -name '*.ini')"
|
2007-10-04 17:07:51 +04:00
|
|
|
for f in $FILES; do
|
|
|
|
case $f in
|
|
|
|
*.mod.c) continue;;
|
|
|
|
esac
|
2008-06-19 04:33:04 +04:00
|
|
|
mkdir -p $(dirname ${MADWIFI}/$f)
|
2007-10-04 17:07:51 +04:00
|
|
|
cp -f ${SRC}/$f ${MADWIFI}/$f
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Copying makefiles"
|
2008-06-19 04:33:04 +04:00
|
|
|
FILES=$(cd ${SRC} && find . -name Makefile.kernel)
|
2007-10-04 17:07:51 +04:00
|
|
|
for f in $FILES; do
|
2008-06-19 04:33:04 +04:00
|
|
|
cp -f ${SRC}/$f $(dirname ${MADWIFI}/$f)/Makefile
|
2007-10-04 17:07:51 +04:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
echo "Patching the build system"
|
|
|
|
cp -f Kconfig ${MADWIFI}
|
|
|
|
sed -i '/madwifi/d;/^endmenu/i\
|
|
|
|
source "drivers/net/wireless/madwifi/Kconfig"' ${WIRELESS}/Kconfig
|
|
|
|
sed -i '$a\
|
|
|
|
obj-$(CONFIG_ATHEROS) += madwifi/
|
|
|
|
/madwifi/d;' ${WIRELESS}/Makefile
|
|
|
|
|
|
|
|
echo "Done"
|