diff options
author | Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> | 2008-01-14 18:40:53 -0500 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> | 2008-01-14 18:40:53 -0500 |
commit | 0270147348de690f4a37b8db7715af950bca7b30 (patch) | |
tree | 15acda763a386311fb1884c1e1a4c32c3afdb7de | |
parent | cc48d61514617dbd62039b8d6bac5e51ed831044 (diff) | |
download | compat-wireless-2.6-old-0270147348de690f4a37b8db7715af950bca7b30.tar.gz |
Some users were reporting problems with the compat package where the shell
exceeded the number of arguments possible. This was caused by the way were
were handling CONFIG_* options -- we were just adding defines on the command
line.
To correct this we now embrace our own autoconf header file, just as the kernel
has its own, with defines of the options specified in config.mk. Our header file
is self-generated by scripts/gen-compat-autoconf.sh which parses any
kernel-like config file and outputs a header file with proper defines.
The compat wireless autoconf file is include/linux/compat_autoconf.h and
should not be edited by hand.
The compat-wireless top Makefile makes uses of gen-compat-autoconf.sh through
scripts/check_config.sh. This script and the top level makefile
also check for updates to config.mk and if changes were made it forces
a regeneration for the compat autoconf file. To check for changes we are using
md5sum, which may be overkill, but should work well for now.
Additionally the top level makefile checks for the version of compat-wireless, if
it detects a new release has been pulled it will force a regeneration of the
compat autoconf as well.
This new build scheme been tested on 2.6.22 and 2.6.23.
External build has also been tested with 2.6.23:
make KLIB=/home/mcgrof/devel/kernels/linux-2.6.23.12 \
KLIB_BUILD=/home/mcgrof/devel/kernels/linux-2.6.23.12
Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
-rw-r--r-- | Makefile | 38 | ||||
-rw-r--r-- | compat/compat.h | 1 | ||||
-rw-r--r-- | config.mk | 234 | ||||
-rwxr-xr-x | scripts/check_config.sh | 33 | ||||
-rwxr-xr-x | scripts/gen-compat-autoconf.sh | 72 |
5 files changed, 138 insertions, 240 deletions
@@ -8,12 +8,19 @@ endif KLIB_BUILD ?= $(KLIB)/build MADWIFI=$(shell modprobe -l ath_pci) -ifneq ($(KERNELRELEASE),) +# These exported as they are used by the scripts +# to check config and compat autoconf +export COMPAT_CONFIG=config.mk +export CONFIG_CHECK=.$(COMPAT_CONFIG)_md5sum.txt +export COMPAT_AUTOCONF=include/linux/compat_autoconf.h +export CREL=$(shell cat $(PWD)/compat-release) +export CREL_CHECK:=.compat_autoconf_$(CREL) + +include $(PWD)/$(COMPAT_CONFIG) -include $(src)/config.mk -export $(COPTS) +ifneq ($(KERNELRELEASE),) -NOSTDINC_FLAGS := -I$(PWD)/include/ -include $(M)/include/net/compat.h $(COPTS) $(CFLAGS) +NOSTDINC_FLAGS := -I$(PWD)/include/ -include $(M)/include/net/compat.h $(CFLAGS) obj-y := net/wireless/ net/mac80211/ net/ieee80211/ \ drivers/ssb/ \ @@ -25,14 +32,19 @@ export PWD := $(shell pwd) all: modules -modules: +modules: $(CREL_CHECK) + @./scripts/check_config.sh $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules -clean: - @if [ -d net -a -d $(KLIB_BUILD) ]; then \ - $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\ - fi - @rm -f *.symvers +# With the above and this we make sure we generate a new compat autoconf per +# new relase of compat-wireless-2.6 OR when the user updates the +# $(COMPAT_CONFIG) file +$(CREL_CHECK): + @# Force to regenerate compat autoconf + @rm -f $(CONFIG_CHECK) + @./scripts/check_config.sh + @touch $@ + @md5sum $(COMPAT_CONFIG) > $(CONFIG_CHECK) install: modules @$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \ @@ -144,6 +156,10 @@ uninstall: @ @echo +clean: + @if [ -d net -a -d $(KLIB_BUILD) ]; then \ + $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\ + fi unload: @./scripts/unload.sh @@ -153,3 +169,5 @@ load: unload .PHONY: all clean install uninstall unload load endif + +clean-files += Module.symvers $(CREL_CHECK) $(CONFIG_CHECK) diff --git a/compat/compat.h b/compat/compat.h index f9a1243..58fe809 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -9,6 +9,7 @@ #include <linux/version.h> #include <linux/scatterlist.h> #include <linux/usb.h> +#include <linux/compat_autoconf.h> /* Compat work for 2.6.22 and 2.6.23 */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) @@ -1,273 +1,82 @@ -# COPTs are so all *.[ch] can pick up the options as if defined -# by the kernel's .config. */ -# -# XXX: move to a C dialog, also, there's gotta be a quicker, shorter -# way to do this too... meh? -# -# Only enable defines we really need. export +# XXX: add a make menuconfig option to generate this # Wireless subsystem stuff CONFIG_MAC80211=m -ifeq ($(CONFIG_MAC80211),m) -COPTS+= -DCONFIG_MAC80211=1 -endif CONFIG_MAC80211_RC_DEFAULT=simple - -ifeq ($(CONFIG_MAC80211_RC_DEFAULT),pid) -COPTS+= -DCONFIG_MAC80211_RC_DEFAULT=\"pid\" -CONFIG_MAC80211_RC_DEFAULT_PID=y -COPTS+= -DCONFIG_MAC80211_RC_DEFAULT_PID=1 -else -COPTS+= -DCONFIG_MAC80211_RC_DEFAULT=\"simple\" CONFIG_MAC80211_RC_SIMPLE=y -COPTS+= -DCONFIG_MAC80211_RC_SIMPLE=1 -endif - -CONFIG_MAC80211_RC_PID=y -ifeq ($(CONFIG_MAC80211_RC_PID),y) -COPTS+= -DCONFIG_MAC80211_RC_PID=1 -endif +# Comment above and uncomment below to use rate pid +#CONFIG_MAC80211_RC_DEFAULT=pid +#CONFIG_MAC80211_RC_PID=y CONFIG_CFG80211=m -ifeq ($(CONFIG_CFG80211),m) -COPTS+= -DCONFIG_CFG80211=1 -endif - CONFIG_NL80211=y -ifeq ($(CONFIG_NL80211),y) -COPTS+= -DCONFIG_NL80211=1 -endif # Drivers CONFIG_ATH5K=m -ifeq ($(CONFIG_ATH5K),m) -#COPTS+= -DCONFIG_ATH5K=1 -endif - CONFIG_IWL3945=m -ifeq ($(CONFIG_IWL3945),m) -#COPTS+= -DCONFIG_IWL3945=1 -endif - CONFIG_IWL4965=m -ifeq ($(CONFIG_IWL4965),m) -#COPTS+= -DCONFIG_IWL4965=1 -endif - CONFIG_ZD1211RW=m -ifeq ($(CONFIG_ZD1211RW),m) -#COPTS+= -DCONFIG_ZD1211RW=1 -endif -# CONFIG_ZD1211RW_MAC80211_DEBUG is not set - CONFIG_B43=m -ifeq ($(CONFIG_B43),m) -#COPTS+= -DCONFIG_B43=1 -endif - # B43 uses PCMCIA only for Compact Flash. The Cardbus cards uses PCI # Example, bcm4318: # http://www.multicap.biz/wireless-lan/indoor-wlan-hardware/sdc-cf10g-80211g-compact-flash-module CONFIG_B43_PCMCIA=y -ifeq ($(CONFIG_B43_PCMCIA),y) -COPTS+= -DCONFIG_B43_PCMCIA=1 -endif - CONFIG_B43_DMA=y -ifeq ($(CONFIG_B43_DMA),y) -COPTS+= -DCONFIG_B43_DMA=1 -endif - CONFIG_B43_PIO=y -ifeq ($(CONFIG_B43_PIO),y) -COPTS+= -DCONFIG_B43_PIO=1 -endif - CONFIG_B43_DMA_AND_PIO_MODE=y -ifeq ($(CONFIG_B43_DMA_AND_PIO_MODE),y) -COPTS+= -DCONFIG_B43_DMA_AND_PIO_MODE=1 -endif - CONFIG_B43_PCI_AUTOSELECT=y -ifeq ($(CONFIG_B43_PCI_AUTOSELECT),y) -COPTS+= -DCONFIG_B43_PCI_AUTOSELECT=1 -endif - CONFIG_B43_PCICORE_AUTOSELECT=y -ifeq ($(CONFIG_B43_PCICORE_AUTOSELECT),y) -COPTS+= -DCONFIG_B43_PCICORE_AUTOSELECT=1 -endif - #CONFIG_B43_RFKILL=n #CONFIG_B43_LEDS=n # CONFIG_B43_DEBUG is not set CONFIG_B43LEGACY=m -ifeq ($(CONFIG_B43LEGACY),m) -#COPTS+= -DCONFIG_B43LEGACY=1 -endif - CONFIG_B43LEGACY_PCI_AUTOSELECT=y -ifeq ($(CONFIG_B43LEGACY_PCI_AUTOSELECT),y) -COPTS+= -DCONFIG_B43LEGACY_PCI_AUTOSELECT=1 -endif - CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y -ifeq ($(CONFIG_B43LEGACY_PCICORE_AUTOSELECT),y) -COPTS+= -DCONFIG_B43LEGACY_PCICORE_AUTOSELECT=1 -endif - CONFIG_B43LEGACY_DMA=y -ifeq ($(CONFIG_B43LEGACY_DMA),y) -COPTS+= -DCONFIG_B43LEGACY_DMA=1 -endif - CONFIG_B43LEGACY_PIO=y -ifeq ($(CONFIG_B43LEGACY_PIO),y) -COPTS+= -DCONFIG_B43LEGACY_PIO=1 -endif - CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y -ifeq ($(CONFIG_B43LEGACY_DMA_AND_PIO_MODE),y) -COPTS+= -DCONFIG_B43LEGACY_DMA_AND_PIO_MODE=1 -endif # This is required for some cards CONFIG_EEPROM_93CX6=m -ifeq ($(CONFIG_EEPROM_93CX6),m) -#COPTS+= -DCONFIG_EEPROM_93CX6=1 -endif # Realtek CONFIG_RTL8180=m -ifeq ($(CONFIG_RTL8180),m) -#COPTS+= -DCONFIG_RTL8180=1 -endif - CONFIG_RTL8187=m -ifeq ($(CONFIG_RTL8187),m) -#COPTS+= -DCONFIG_RTL8187=1 -endif - CONFIG_ADM8211=m -ifeq ($(CONFIG_ADM8211),m) -#COPTS+= -DCONFIG_ADM8211=1 -endif # rt2x00 CONFIG_RT2X00=m -ifeq ($(CONFIG_RT2X00),m) -#COPTS+= -DCONFIG_RT2X00=1 -endif - CONFIG_RT2X00_LIB=m -ifeq ($(CONFIG_RT2X00_LIB),m) -#COPTS+= -DCONFIG_RT2X00_LIB=1 -endif - CONFIG_RT2X00_LIB_PCI=m -ifeq ($(CONFIG_RT2X00_LIB_PCI),m) -#COPTS+= -DCONFIG_RT2X00_LIB_PCI=1 -endif - CONFIG_RT2X00_LIB_USB=m -ifeq ($(CONFIG_RT2X00_LIB_USB),m) -#COPTS+= -DCONFIG_RT2X00_LIB_USB=1 -endif - CONFIG_RT2X00_LIB_FIRMWARE=y -ifeq ($(CONFIG_RT2X00_LIB_FIRMWARE),y) -COPTS+= -DCONFIG_RT2X00_LIB_FIRMWARE=1 -endif - CONFIG_RT2400PCI=m -ifeq ($(CONFIG_RT2400PCI),m) -#COPTS+= -DCONFIG_RT2400PCI=1 -endif - # CONFIG_RT2400PCI_RFKILL is not set CONFIG_RT2500PCI=m -ifeq ($(CONFIG_RT2500PCI),m) -#COPTS+= -DCONFIG_RT2500PCI=1 -endif - # CONFIG_RT2500PCI_RFKILL is not set CONFIG_RT61PCI=m -ifeq ($(CONFIG_RT61PCI),m) -#COPTS+= -DCONFIG_RT61PCI=1 -endif - # CONFIG_RT61PCI_RFKILL is not set CONFIG_RT2500USB=m -ifeq ($(CONFIG_RT2500USB),m) -#COPTS+= -DCONFIG_RT2500USB=1 -endif - CONFIG_RT73USB=m -ifeq ($(CONFIG_RT73USB),m) -#COPTS+= -DCONFIG_RT73USB=1 -endif # CONFIG_RT2X00_LIB_DEBUGFS is not set # CONFIG_RT2X00_DEBUG is not se # p54 CONFIG_P54_COMMON=m -ifeq ($(CONFIG_P54_COMMON),m) -#COPTS+= -DCONFIG_P54_COMMON=1 -endif - CONFIG_P54_USB=m -ifeq ($(CONFIG_P54_USB),m) -#COPTS+= -DCONFIG_P54_USB=1 -endif - CONFIG_P54_PCI=m -ifeq ($(CONFIG_P54_PCI),m) -#COPTS+= -DCONFIG_P54_PCI=1 -endif # Sonics Silicon Backplane CONFIG_SSB_POSSIBLE=y -ifeq ($(CONFIG_SSB_POSSIBLE),y) -#COPTS+= -DCONFIG_SSB_POSSIBLE=1 -endif - CONFIG_SSB=m -ifeq ($(CONFIG_SSB),m) -#COPTS+= -DCONFIG_SSB=1 -endif - CONFIG_SSB_PCIHOST_POSSIBLE=y -ifeq ($(CONFIG_SSB_PCIHOST_POSSIBLE),y) -COPTS+= -DCONFIG_SSB_PCIHOST_POSSIBLE=1 -endif - CONFIG_SSB_PCIHOST=y -ifeq ($(CONFIG_SSB_PCIHOST),y) -COPTS+= -DCONFIG_SSB_PCIHOST=1 -endif - CONFIG_SSB_PCMCIAHOST=y -ifeq ($(CONFIG_SSB_PCMCIAHOST),y) -COPTS+= -DCONFIG_SSB_PCMCIAHOST=1 -endif - CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -ifeq ($(CONFIG_SSB_DRIVER_PCICORE_POSSIBLE),y) -#COPTS+= -DCONFIG_SSB_DRIVER_PCICORE_POSSIBLE=1 -endif - CONFIG_SSB_DRIVER_PCICORE=y -ifeq ($(CONFIG_SSB_DRIVER_PCICORE),y) -COPTS+= -DCONFIG_SSB_DRIVER_PCICORE=1 -endif - -ifeq ($(CONFIG_SSB_PCIHOST),y) -COPTS+= -DCONFIG_SSB_PCIHOST=1 -endif - # These two are for mips CONFIG_SSB_DRIVER_MIPS=n CONFIG_SSB_PCICORE_HOSTMODE=n @@ -278,52 +87,17 @@ CONFIG_SSB_PCICORE_HOSTMODE=n # Note: old softmac is scheduled for removal so we # ignore that stuff CONFIG_IEEE80211=m -ifeq ($(CONFIG_IEEE80211),m) -#COPTS+= -DCONFIG_IEEE80211=1 -endif - CONFIG_IEEE80211_CRYPT_CCMP=m -ifeq ($(CONFIG_IEEE80211_CRYPT_CCMP),m) -#COPTS+= -DCONFIG_IEEE80211_CRYPT_CCMP=1 -endif - CONFIG_IEEE80211_CRYPT_TKIP=m -ifeq ($(CONFIG_IEEE80211_CRYPT_TKIP),m) -#COPTS+= -DCONFIG_IEEE80211_CRYPT_TKIP=1 -endif - CONFIG_IEEE80211_CRYPT_WEP=m -ifeq ($(CONFIG_IEEE80211_CRYPT_WEP),m) -#COPTS+= -DCONFIG_IEEE80211_CRYPT_WEP=1 -endif - CONFIG_IEEE80211_SOFTMAC=n # Old drivers which use the old stack # The Intel ipws CONFIG_IPW2100=m -ifeq ($(CONFIG_IPW2100),m) -#COPTS+= -DCONFIG_IPW2100=1 -endif - CONFIG_IPW2200=m -ifeq ($(CONFIG_IPW2200),m) -#COPTS+= -DCONFIG_IPW2200=1 -endif - # Libertas uses the old stack but not fully, it will soon # be cleaned. CONFIG_LIBERTAS=m -ifeq ($(CONFIG_LIBERTAS),m) -#COPTS+= -DCONFIG_LIBERTAS=1 -endif - CONFIG_LIBERTAS_USB=m -ifeq ($(CONFIG_LIBERTAS_USB),m) -#COPTS+= -DCONFIG_LIBERTAS_USB=1 -endif - CONFIG_LIBERTAS_CS=m -ifeq ($(CONFIG_LIBERTAS_CS),m) -#COPTS+= -DCONFIG_LIBERTAS_CS=1 -endif diff --git a/scripts/check_config.sh b/scripts/check_config.sh new file mode 100755 index 0000000..1ac9620 --- /dev/null +++ b/scripts/check_config.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# This script checks the compat-wireless configuration file and if changes were made +# regenerates the compat_autoconf header. + +# These variables are expected to be exported: +#COMPAT_CONFIG="config" +#CONFIG_CHECK=".${COMPAT_CONFIG}.md5" +#COMPAT_AUTOCONF="include/linux/compat_autoconf.h" + +function gen_compat_autoconf { + echo "./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG > $COMPAT_AUTOCONF" + ./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG > $COMPAT_AUTOCONF + md5sum $COMPAT_CONFIG > $CONFIG_CHECK +} + +which md5sum 2>&1 > /dev/null +if [ $? -ne 0 ]; then + echo "md5sum required to detect changes on config file" + exit -1 +fi + +if [ ! -f $CONFIG_CHECK ]; then + gen_compat_autoconf + exit +fi + +md5sum -c $CONFIG_CHECK 2> /dev/null 1>/dev/null + +if [ $? -ne 0 ]; then + echo "Changes to compat-wireless's configuration was detected, regenerating autoconf..." + gen_compat_autoconf +fi + diff --git a/scripts/gen-compat-autoconf.sh b/scripts/gen-compat-autoconf.sh new file mode 100755 index 0000000..e362978 --- /dev/null +++ b/scripts/gen-compat-autoconf.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> +# +# Use this to parse a small .config equivalent looking file to generate +# our own autoconf.h. This file has defines for each config option +# just like the kernels include/linux/autoconf.h +# +# XXX: consider using scripts/kconfig/confdata.c instead. +# On the downside this would require the user to have libc though. + +COMPAT_RELEASE="compat-release" +KERNEL_RELEASE="git-describe" + +if [ $# -ne 1 ]; then + echo "Usage $0 config-file" + exit +fi + +COMPAT_CONFIG="$1" + +if [ ! -f $COMPAT_CONFIG ]; then + echo "File $1 is not a file" + exit +fi + +if [ ! -f $COMPAT_RELEASE -o ! -f $KERNEL_RELEASE ]; then + echo "Error: $COMPAT_RELEASE or $KERNEL_RELEASE file is missing" + exit +fi + +CREL=$(cat $COMPAT_RELEASE) +KREL=$(cat $KERNEL_RELEASE) +DATE=$(date) + +cat <<EOF +#ifndef COMPAT_AUTOCONF_INCLUDED +#define COMPAT_AUTOCONF_INCLUDED +/* + * Automatically generated C config: don't edit + * $DATE + * compat-wireless-2.6: $CREL + * linux-2.6: $KREL + */ +#define COMPAT_RELEASE "$CREL" +#define COMPAT_KERNEL_RELEASE "$KREL" +EOF + +# For each CONFIG_FOO=x option +for i in $(grep -v ^# $COMPAT_CONFIG | grep ^CONFIG_); do + # Get the element on the left of the "=" + VAR=$(echo $i | cut -d"=" -f 1) + # Get the element on the right of the "=" + VALUE=$(echo $i | cut -d"=" -f 2) + case $VALUE in + n) # Do nothing + ;; + y) + echo "#define $VAR 1" + ;; + m) + echo "#define $VAR 1" + ;; + *) # Assume string + # XXX: add better checks to make sure what was on + # the right was indeed a string + echo "#define $VAR \"$VALUE\"" + ;; + esac +done + +echo "#endif /* COMPAT_AUTOCONF_INCLUDED */" |