.... all-new kernel version detection.
This commit is contained in:
parent
bc67ec46be
commit
82cdb7a660
3
CHANGES
3
CHANGES
|
@ -41,6 +41,9 @@
|
|||
* Intersil Corporation as part of PRISM(R) chipset product development.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
- Completely re-did the kernel version detection system; also removed
|
||||
the WLAN_TARGET_ARCH stuff as well as we now auto-magically figure
|
||||
it out.
|
||||
- Hopefully fixed the 'crash on unload' for 2.2.x kernels and PCI.
|
||||
- 'p2req_join' command, see doc/wlanctl-ng.p2req_join.txt
|
||||
This lets you join a specific SSID. Thanks to Clay Jones.
|
||||
|
|
21
Configure
21
Configure
|
@ -286,6 +286,9 @@ if [ ! -f $LINUX_SRC/include/linux/version.h ] ; then
|
|||
fail
|
||||
fi
|
||||
|
||||
KERNEL_SOURCE=$LINUX_SRC make -Cscripts 2>&1 > /dev/null
|
||||
. scripts/make.opts
|
||||
|
||||
# What kernel are we compiling for?
|
||||
|
||||
version () {
|
||||
|
@ -294,8 +297,10 @@ version () {
|
|||
|
||||
$ECHO ""
|
||||
|
||||
SRC_RELEASE=`grep UTS_RELEASE $LINUX_SRC/include/linux/version.h | \
|
||||
sed -e 's/^[^"]*"//g' -e 's/".*$//g'`
|
||||
#SRC_RELEASE=`grep UTS_RELEASE $LINUX_SRC/include/linux/version.h | \
|
||||
# sed -e 's/^[^"]*"//g' -e 's/".*$//g'`
|
||||
|
||||
SRC_RELEASE="$KERNEL_RELEASE"
|
||||
|
||||
VERSION_CODE=`grep LINUX_VERSION_CODE $LINUX_SRC/include/linux/version.h | \
|
||||
sed -e 's/[^0-9]//g'`
|
||||
|
@ -310,12 +315,6 @@ if [ "$SRC_RELEASE" != "$CUR_RELEASE" ] ; then
|
|||
$ECHO "WARNING: the current kernel is actually version $CUR_RELEASE."
|
||||
fi
|
||||
|
||||
if [ ! "$WLAN_TARGET_ARCH" ] ; then
|
||||
BUILD_ARCH=`uname -m | sed -e 's/i.86/i386/'`
|
||||
else
|
||||
BUILD_ARCH=$WLAN_TARGET_ARCH
|
||||
fi
|
||||
|
||||
# Check for consistent kernel build dates
|
||||
|
||||
CUR_D=`uname -v | sed -e 's/^#[0-9]* //;s/SMP //'`
|
||||
|
@ -354,7 +353,8 @@ $ECHO ""
|
|||
write_bool CONFIG_PACKET
|
||||
fi
|
||||
|
||||
|
||||
dump_str "KERNEL_CFLAGS=$KERNEL_CFLAGS"
|
||||
dump_str "KERNEL_MODFLAGS=$KERNEL_MODFLAGS"
|
||||
#=======================================================================
|
||||
# If compiling for pcmcia-cs, find the PCMCIA source tree
|
||||
|
||||
|
@ -468,9 +468,6 @@ $ECHO ""
|
|||
#=======================================================================
|
||||
# Make sure our target architecture is correct
|
||||
|
||||
WLAN_TARGET_ARCH=$BUILD_ARCH
|
||||
ask_str "Target Architecture? (i386/ppc/arm/alpha/hppa/mips)" WLAN_TARGET_ARCH
|
||||
|
||||
$ECHO ""
|
||||
|
||||
ask_str "Prefix for build host compiler? (rarely needed)" HOST_COMPILE
|
||||
|
|
|
@ -3,7 +3,6 @@ WLAN_PATCHLEVEL=1
|
|||
WLAN_SUBLEVEL=15
|
||||
WLAN_EXTRAVERSION=-pre6
|
||||
LINUX_SRC=/usr/src/linux
|
||||
WLAN_TARGET_ARCH=
|
||||
PCMCIA_SRC=
|
||||
PREFIX=
|
||||
INST_EXEDIR=/sbin
|
||||
|
|
36
scripts/Makefile
Normal file
36
scripts/Makefile
Normal file
|
@ -0,0 +1,36 @@
|
|||
CURR_DIR :=$(shell pwd)
|
||||
|
||||
export CURR_DIR
|
||||
|
||||
.PHONY: get_version
|
||||
|
||||
all: clean get_version get_options
|
||||
|
||||
get_version:
|
||||
@if [ ! -d $(KERNEL_SOURCE)/ ]; then \
|
||||
echo "";\
|
||||
echo "$(KERNEL_SOURCE) directory does not exist. Please edit the file 'config'";\
|
||||
echo "in this directory and set KERNEL_SOURCE to the correct location of your ";\
|
||||
echo "kernel source.";\
|
||||
echo "";\
|
||||
echo "You are currently running kernel version `uname -r`, the source code should";\
|
||||
echo "be for this version.";\
|
||||
echo "";\
|
||||
exit 1;\
|
||||
fi
|
||||
@if [ ! -f $(KERNEL_SOURCE)/include/linux/version.h ]; then \
|
||||
echo "$(KERNEL_SOURCE)/include/linux/version.h is missing. Please run make config";\
|
||||
echo "in your kernel source tree";\
|
||||
exit 1;\
|
||||
fi
|
||||
|
||||
$(CC) -I$(KERNEL_SOURCE)/include get_version.c -o get_version
|
||||
|
||||
get_options:
|
||||
$(MAKE) -f $(CURR_DIR)/Makefile.get_options -C $(KERNEL_SOURCE) get_version_target
|
||||
|
||||
clean:
|
||||
$(RM) get_version make.opts
|
||||
|
||||
distclean: clean
|
||||
|
11
scripts/Makefile.get_options
Normal file
11
scripts/Makefile.get_options
Normal file
|
@ -0,0 +1,11 @@
|
|||
KERNEL_VERSION := $(shell $(CURR_DIR)/get_version)
|
||||
KERNEL_RELEASE := $(shell echo $(KERNEL_VERSION) | cut -d\" -f2| cut -c-5)
|
||||
|
||||
include Makefile
|
||||
|
||||
get_version_target:
|
||||
echo "KERNEL_RELEASE=$(KERNEL_VERSION)" >> $(CURR_DIR)/make.opts
|
||||
echo "KERNEL_CFLAGS='$(CFLAGS)'" >> $(CURR_DIR)/make.opts
|
||||
# echo "KERNEL_CC='$(CC)'" >> $(CURR_DIR)/make.opts
|
||||
echo "KERNEL_MODFLAGS='$(MODFLAGS)'" >> $(CURR_DIR)/make.opts
|
||||
|
6
scripts/get_version.c
Normal file
6
scripts/get_version.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <linux/version.h>
|
||||
#include <stdio.h>
|
||||
main()
|
||||
{
|
||||
printf("%s", UTS_RELEASE);
|
||||
}
|
|
@ -108,26 +108,17 @@ MODULES+=$(P80211_MODULE)
|
|||
# Implicit rules to handle the separate obj dirs
|
||||
OBJ_DIR=obj
|
||||
|
||||
# Compiler Options
|
||||
CFLAGS = $(KERNEL_CFLAGS) $(KERNEL_MODFLAGS)
|
||||
# Preprocessor Options
|
||||
CPPFLAGS=-I../include $(WLAN_INCLUDE_DEBUG) $(WLAN_CS_CONFIG_SNIFF)
|
||||
|
||||
$(OBJ_DIR)/%.o : ../shared/%.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OBJ_DIR)/%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compiler Options
|
||||
ifndef CFLAGS
|
||||
CFLAGS = -O2 -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe
|
||||
ifeq ($(WLAN_TARGET_ARCH), alpha)
|
||||
CFLAGS := $(CFLAGS) -mno-fp-regs -ffixed-8
|
||||
endif
|
||||
endif
|
||||
|
||||
# Preprocessor Options
|
||||
CPPFLAGS=-D__LINUX_WLAN__ -D__KERNEL__ -DMODULE=1 \
|
||||
-I../include -I$(LINUX_SRC)/include \
|
||||
$(WLAN_INCLUDE_DEBUG) $(WLAN_CS_CONFIG_SNIFF)
|
||||
|
||||
# Dependency Source List
|
||||
DEP_SRC=$(P80211_SRC)
|
||||
|
||||
|
@ -137,7 +128,7 @@ all : .depend dirs $(MODULES)
|
|||
|
||||
dep .depend: $(DEP_SRC) ../../config.mk
|
||||
ifdef MODULES
|
||||
$(CPP) -M $(CPPFLAGS) $(DEP_SRC) > .depend
|
||||
$(CPP) -M $(CPPFLAGS) $(CFLAGS) $(DEP_SRC) > .depend
|
||||
endif
|
||||
|
||||
dirs :
|
||||
|
|
|
@ -137,48 +137,33 @@ ifeq ($(PRISM2_USB), y)
|
|||
MODULES+=$(USB_MODULE)
|
||||
endif
|
||||
|
||||
# Compiler Options
|
||||
CFLAGS = $(KERNEL_CFLAGS) $(KERNEL_MODFLAGS)
|
||||
# Preprocessor Options
|
||||
CPPFLAGS=-I../../include -I../include $(WLAN_INCLUDE_DEBUG) $(WLAN_CS_CONFIG_SNIFF)
|
||||
|
||||
# Use the following if building for kernel pcmcia
|
||||
ifeq ($(WLAN_KERN_PCMCIA), y)
|
||||
CS_SYSINC=-I$(PCMCIA_SRC)/include
|
||||
endif
|
||||
|
||||
# Implicit rules to handle the separate obj dirs
|
||||
$(CS_OBJ_DIR)/%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(CS_SYSINC) \
|
||||
$(CC) -c $(CFLAGS) $(CS_SYSINC) $(CPPFLAGS) \
|
||||
-DWLAN_HOSTIF=WLAN_PCMCIA $< -o $@
|
||||
|
||||
$(PLX_OBJ_DIR)/%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(SYSINC) \
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) \
|
||||
-DWLAN_HOSTIF=WLAN_PLX $< -o $@
|
||||
|
||||
$(PCI_OBJ_DIR)/%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(SYSINC) \
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) \
|
||||
-DWLAN_HOSTIF=WLAN_PCI $< -o $@
|
||||
|
||||
$(USB_OBJ_DIR)/%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(SYSINC) \
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) \
|
||||
-DWLAN_HOSTIF=WLAN_USB $< -o $@
|
||||
|
||||
# Compiler Options
|
||||
ifndef CFLAGS
|
||||
CFLAGS = -O2 -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe
|
||||
ifeq ($(WLAN_TARGET_ARCH), alpha)
|
||||
CFLAGS := $(CFLAGS) -mno-fp-regs -ffixed-8
|
||||
endif
|
||||
endif
|
||||
|
||||
# Preprocessor Options
|
||||
CPPFLAGS=-D__LINUX_WLAN__ -D__KERNEL__ -DMODULE=1 $(WLAN_INCLUDE_DEBUG) \
|
||||
-I../include -I../../include
|
||||
|
||||
# Use the following if building for pcmcia
|
||||
ifeq ($(WLAN_KERN_PCMCIA), y)
|
||||
CS_SYSINC=-I$(LINUX_SRC)/include -I$(PCMCIA_SRC)/include/static \
|
||||
-I$(PCMCIA_SRC)/include
|
||||
else
|
||||
CS_SYSINC=$(WLAN_CS_CONFIG_SNIFF) -I$(PCMCIA_SRC)/include \
|
||||
-I$(LINUX_SRC)/include
|
||||
endif # WLAN_KERN_PCMCIA
|
||||
|
||||
# Use just SYSINC for all non-pcmcia
|
||||
SYSINC= -I$(LINUX_SRC)/include
|
||||
|
||||
# Dependency Source List
|
||||
DEP_SRC=$(SRC)
|
||||
|
||||
|
@ -258,7 +243,7 @@ endif
|
|||
rm -f $@
|
||||
for i in $(DEP_SRC); do \
|
||||
(/bin/echo -n $(PLX_OBJ_DIR)/ ; \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_PLX -M $(CPPFLAGS) $(SYSINC) $$i ) \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_PLX -M $(CFLAGS) $(CPPFLAGS) $$i ) \
|
||||
>> $@ ; \
|
||||
done
|
||||
|
||||
|
@ -266,7 +251,7 @@ endif
|
|||
rm -f $@
|
||||
for i in $(DEP_SRC); do \
|
||||
(/bin/echo -n $(PCI_OBJ_DIR)/ ; \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_PCI -M $(CPPFLAGS) $(SYSINC) $$i ) \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_PCI -M $(CFLAGS) $(CPPFLAGS) $$i ) \
|
||||
>> $@ ; \
|
||||
done
|
||||
|
||||
|
@ -274,8 +259,8 @@ endif
|
|||
rm -f $@
|
||||
for i in $(DEP_SRC); do \
|
||||
(/bin/echo -n $(CS_OBJ_DIR)/ ; \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_PCMCIA -M $(CPPFLAGS) \
|
||||
$(CS_SYSINC) $$i ) \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_PCMCIA -M $(CS_SYSINC) $(CFLAGS) $(CPPFLAGS) \
|
||||
$$i ) \
|
||||
>> $@ ; \
|
||||
done
|
||||
|
||||
|
@ -283,7 +268,7 @@ endif
|
|||
rm -f $@
|
||||
for i in $(DEP_SRC); do \
|
||||
(/bin/echo -n $(USB_OBJ_DIR)/ ; \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_USB -M $(CPPFLAGS) $(SYSINC) $$i ) \
|
||||
$(CPP) -DWLAN_HOSTIF=WLAN_USB -M $(CFLAGS) $(CPPFLAGS) $$i ) \
|
||||
>> $@ ; \
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue