blob: 22cbd9c857524b03e4c06bf4f197a8deb87cfe04 [file] [log] [blame]
# /bin/sh
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
#
# Helper script to setup compat-wireless configuration.
#
S=${1:?No kernel source directory specified}
COMPAT_WIRELESS="${S}"/chromeos/compat-wireless
COMPAT_VERSION=`cat ${COMPAT_WIRELESS}/compat_version`
COMPAT_RELEASE=`cat ${COMPAT_WIRELESS}/compat_version`
COMPAT_BASE_TREE=`cat ${COMPAT_WIRELESS}/compat_base_tree`
COMPAT_BASE_TREE_VERSION=`cat ${COMPAT_WIRELESS}/compat_base_tree_version`
# TODO(sleffler) calculate CONFIG_COMPAT_KERNEL version
COMPAT_CONFIG='
CONFIG_COMPAT_KERNEL_33=y
CONFIG_COMPAT_FIRMWARE_CLASS=m
CONFIG_COMPAT_RFKILL=y
CONFIG_RFKILL_BACKPORT=y
CONFIG_RFKILL_BACKPORT_INPUT=y
CONFIG_COMPAT_WIRELESS=m
CONFIG_COMPAT_WIRELESS_MODULES=m
CONFIG_MAC80211=m
CONFIG_MAC80211_LEDS=y
CONFIG_MAC80211_DEBUGFS=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel"
CONFIG_COMPAT_MAC80211_RC_DEFAULT="minstrel"
CONFIG_CFG80211=m
CONFIG_CFG80211_DEBUGFS=y
CONFIG_CFG80211_DEFAULT_PS=y
CONFIG_CFG80211_WEXT=y
CONFIG_ATH=y
CONFIG_ATH_COMMON=m
CONFIG_ATH_DEBUG=y
CONFIG_ATH5K=m
CONFIG_ATH9K=m
CONFIG_ATH9K_HW=m
CONFIG_ATH9K_COMMON=m
CONFIG_ATH9K_DEBUGFS=y
CONFIG_IWLWIFI=m
CONFIG_IWLWIFI_SPECTRUM_MANAGEMENT=y
CONFIG_IWLAGN=m
CONFIG_COMPAT_IWL4965=y
CONFIG_IWL5000=y
CONFIG_IWL3945=m
CONFIG_IWL3945_SPECTRUM_MANAGEMENT=y
CONFIG_IWLWIFI_DEBUG=y
CONFIG_IWLWIFI_DEBUGFS=y
CONFIG_USB_NET_COMPAT_CDCETHER=m
CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
CONFIG_USB_COMPAT_USBNET=m
'
echo "Configure compat-wireless: ${COMPAT_CONFIG}"
#
# Edit Makefiles to reflect configuration knobs
#
SED_ARGS=
for c in $COMPAT_CONFIG; do
a=`echo $c | sed s/=.*//`
b=`echo $c | sed s/.*=//`
SED_ARGS="$SED_ARGS -e s/[\$]("$a")/"$b"/"
done
Makefiles=`find -L "${COMPAT_WIRELESS}" -name Makefile`
for m in $Makefiles; do
sed $SED_ARGS -i $m
done
# Construct include/linux/compat_autoconf.h
(cat<<EOF
#ifndef COMPAT_AUTOCONF_INCLUDED
#define COMPAT_AUTOCONF_INCLUDED
/*
* Automatically generated by chromeos-base/kernel/kernel-*.ebuild
* compat-wireless-2.6: $COMPAT_VERSION
* linux-2.6: v2.6.32
*/
#define COMPAT_BASE_TREE "$COMPAT_BASE_TREE"
#define COMPAT_BASE_TREE_VERSION "$COMPAT_BASE_TREE_VERSION"
#define COMPAT_PROJECT "Compat-wireless"
#define COMPAT_VERSION "$COMPAT_VERSION"
#ifndef CONFIG_WIRELESS_EXT
#error Compat-wireless requirement: CONFIG_WIRELESS_EXT must be enabled in your kernel
#endif /* CONFIG_WIRELESS_EXT */
EOF
for c in $COMPAT_CONFIG; do
a=`echo $c | sed s/=.*//`
b=`echo $c | sed s/.*=//`
case $b in
m|y)
echo "#define $a 1";;
*)
echo "#define $a $b";;
esac
done
cat<<'EOF'
#ifdef CONFIG_NET_SCHED
#ifdef CONFIG_NETDEVICES_MULTIQUEUE
#ifndef CONFIG_MAC80211_QOS
#define CONFIG_MAC80211_QOS 1
#endif /* CONFIG_MAC80211_QOS */
#endif
#endif
#endif /* COMPAT_AUTOCONF_INCLUDED */
EOF
)>"${COMPAT_WIRELESS}"/include/linux/compat_autoconf.h