Search Linux Wireless

[PATCH 4/5] compat-wireless: start using CONFIG_COMPAT_KERNEL_ in code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxx>

This lets use the defined CONFIG_COMPAT_KERNEL_* in C code and
header files. Next step is to remove the Makefile hackery to
defines CONFIG_COMPAT_KERNEL_* stuff as we have a generated
file for us now.

Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxx>
---
 Makefile                       |   14 +++++++++-----
 scripts/check_config.sh        |    9 +++++----
 scripts/gen-compat-autoconf.sh |   13 +++++++------
 3 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 4149d8d..b5423ee 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ endif
 export KLIB_BUILD ?=	$(KLIB)/build
 # Sometimes not available in the path
 MODPROBE := /sbin/modprobe
+export MAKE
 
 ifneq ($(wildcard $(MODPROBE)),)
 MADWIFI=$(shell $(MODPROBE) -l ath_pci)
@@ -66,14 +67,16 @@ CFLAGS += \
 
 # 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_CONFIG_CW=config.mk
+export COMPAT_CONFIG=.config
+export CONFIG_CHECK=.$(COMPAT_CONFIG_CW)_md5sum.txt
 export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
 export CREL=$(shell cat $(PWD)/compat_version)
 export CREL_PRE:=.compat_autoconf_
 export CREL_CHECK:=$(CREL_PRE)$(CREL)
 
-include $(PWD)/$(COMPAT_CONFIG)
+include $(PWD)/$(COMPAT_CONFIG_CW)
+-include $(PWD)/$(COMPAT_CONFIG)
 
 all: modules
 
@@ -92,10 +95,11 @@ bt: $(CREL_CHECK)
 # $(COMPAT_CONFIG) file
 $(CREL_CHECK):
 	@# Force to regenerate compat autoconf
+	@./compat/scripts/gen-compat-config.sh > $(PWD)/$(COMPAT_CONFIG)
 	@rm -f $(CONFIG_CHECK)
 	@./scripts/check_config.sh
 	@touch $@
-	@md5sum $(COMPAT_CONFIG) > $(CONFIG_CHECK)
+	@md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK)
 
 btinstall: btuninstall bt-install-modules
 
@@ -234,4 +238,4 @@ wlunload:
 endif
 
 clean-files += Module.symvers Module.markers modules modules.order
-clean-files += $(CREL_CHECK) $(CONFIG_CHECK)
+clean-files += $(CREL_CHECK) $(CONFIG_CHECK) $(COMPAT_CONFIG)
diff --git a/scripts/check_config.sh b/scripts/check_config.sh
index 1ac9620..1804976 100755
--- a/scripts/check_config.sh
+++ b/scripts/check_config.sh
@@ -3,14 +3,15 @@
 # regenerates the compat_autoconf header.
 
 # These variables are expected to be exported:
-#COMPAT_CONFIG="config"
+#COMPAT_CONFIG=".config"
+#COMPAT_CONFIG_CW="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
+	echo "./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG $COMPAT_CONFIG_CW > $COMPAT_AUTOCONF"
+	./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG $COMPAT_CONFIG_CW > $COMPAT_AUTOCONF
+	md5sum $COMPAT_CONFIG $COMPAT_CONFIG_CW > $CONFIG_CHECK
 }
 
 which md5sum 2>&1 > /dev/null
diff --git a/scripts/gen-compat-autoconf.sh b/scripts/gen-compat-autoconf.sh
index 28ed25a..58a1c51 100755
--- a/scripts/gen-compat-autoconf.sh
+++ b/scripts/gen-compat-autoconf.sh
@@ -16,15 +16,16 @@ COMPAT_RELEASE="compat_version"
 KERNEL_RELEASE="compat_base_tree_version"
 MULT_DEP_FILE=".compat_pivot_dep"
 
-if [ $# -ne 1 ]; then
-	echo "Usage $0 config-file"
+if [ $# -ne 2 ]; then
+	echo "Usage $0 <generic-compat-config-file> <compat-wireless-config-file>"
 	exit
 fi
 
-COMPAT_CONFIG="$1"
+COMPAT_CONFIG_1="$1"
+COMPAT_CONFIG_2="$2"
 
-if [ ! -f $COMPAT_CONFIG ]; then
-	echo "File $1 is not a file"
+if [[ ! -f $COMPAT_CONFIG_1 || ! -f $COMPAT_CONFIG_2 ]]; then
+	echo "File $COMPAT_CONFIG_1 and $COMPAT_CONFIG_2 files must be present"
 	exit
 fi
 
@@ -145,7 +146,7 @@ EOF
 kernel_version_req $OLDEST_KERNEL_SUPPORTED
 
 # For each CONFIG_FOO=x option
-for i in $(egrep '^CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG | sed 's/ /+/'); do
+for i in $(egrep -h '^CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG_1 $COMPAT_CONFIG_2 | sed 's/ /+/'); do
 	case $i in
 	'ifdef+CONFIG_'* )
 		echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(3,\2,0))/' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(ifdef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (defined(RHEL_MAJOR) \&\& RHEL_MAJOR == \2 \&\& RHEL_MINOR >= \3)/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/'
-- 
1.7.4.15.g7811d

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux