3 # Shell script to integrate madwifi sources into a Linux
4 # source tree so it can be built statically. Typically this
5 # is done to simplify debugging with tools like kgdb.
12 echo "FATAL ERROR: $1" >&2
17 KERNEL_VERSION=$(uname -r)
21 else if test -e /lib/modules/${KERNEL_VERSION}/source; then
22 KERNEL_PATH="/lib/modules/${KERNEL_VERSION}/source"
23 else if test -e /lib/modules/${KERNEL_VERSION}/build; then
24 KERNEL_PATH="/lib/modules/${KERNEL_VERSION}/build"
26 die "Cannot guess kernel source location"
31 test -d ${KERNEL_PATH} || die "No kernel directory ${KERNEL_PATH}"
39 # Location of various pieces. These mimic what is in Makefile.inc
40 # and can be overridden from the environment.
42 SRC_HAL=${HAL:-${SRC}/ath_hal}
43 test -d ${SRC_HAL} || die "No ath_hal directory ${SRC_HAL}"
44 SRC_NET80211=${WLAN:-${SRC}/net80211}
45 test -d ${SRC_NET80211} || die "No net80211 directory ${SRC_NET80211}"
46 SRC_ATH=${ATH:-${SRC}/ath}
47 test -d ${SRC_ATH} || die "No ath directory ${SRC_ATH}"
48 SRC_ATH_RATE=${SRC}/ath_rate
49 test -d ${SRC_ATH_RATE} ||
50 die "No rate control algorithm directory ${SRC_ATH_RATE}"
51 SRC_COMPAT=${SRC}/include
52 test -d ${SRC_COMPAT} || die "No compat directory ${SRC_COMPAT}"
54 WIRELESS=${KERNEL_PATH}/drivers/net/wireless
55 test -d ${WIRELESS} || die "No wireless directory ${WIRELESS}"
57 echo "Copying top-level files"
58 MADWIFI=${WIRELESS}/madwifi
61 cp -f ${SRC}/BuildCaps.inc ${SRC}/release.h ${MADWIFI}
64 echo "Copying source files"
65 FILES=$(cd ${SRC} && find ath ath_hal ath_rate include net80211 -name '*.[ch]')
66 FILES="$FILES $(cd ${SRC} && find ath_hal -name '*.ini')"
71 mkdir -p $(dirname ${MADWIFI}/$f)
72 cp -f ${SRC}/$f ${MADWIFI}/$f
75 echo "Copying makefiles"
76 FILES=$(cd ${SRC} && find . -name Makefile.kernel)
78 cp -f ${SRC}/$f $(dirname ${MADWIFI}/$f)/Makefile
82 echo "Patching the build system"
83 cp -f Kconfig ${MADWIFI}
84 sed -i '/madwifi/d;/^endmenu/i\
85 source "drivers/net/wireless/madwifi/Kconfig"' ${WIRELESS}/Kconfig
87 obj-$(CONFIG_ATHEROS) += madwifi/
88 /madwifi/d;' ${WIRELESS}/Makefile