linux 2.6 flag extraction
authorFrank Mori Hess <fmhess@speakeasy.net>
Tue, 5 Aug 2003 18:55:06 +0000 (18:55 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Tue, 5 Aug 2003 18:55:06 +0000 (18:55 +0000)
Makefile.modbuild
scripts/dep.linux
scripts/linux_flags-2.6/Makefile [new file with mode: 0644]
scripts/linux_flags/Makefile

index 07c9246c2e888b6a9a7b75b2b30140005204e2ff..2a1e8c8ce6aea01f0680eb2bdff5dcd0e56d9065 100644 (file)
@@ -80,7 +80,7 @@ _modinst_%:
 
 
 ifeq ($(CONFIG_MODVERSIONS),y)
-MODFLAGS += -DMODVERSIONS -include $(LINUXDIR)/include/linux/modversions.h
+MODFLAGS += -DMODVERSIONS -include $(MODVERSIONS_H_PATH)
 endif
 
 
index 95d261c88162cb1c49de8129e7100b5f9c7da933..ac223549c41f319ffab75251fd4f4269c6d70fa0 100755 (executable)
@@ -20,18 +20,25 @@ if [ ! -f "$LINUXDIR/.config" ];then
        exit 1
 fi
 
-if [ ! -f "$LINUXDIR/.hdepend" ];then
-       echo
-       echo You need to run \'make dep\' on the kernel source before
-       echo continuing.
-       echo
-       exit 1
-fi
+UTS_VERSION=$(grep UTS_RELEASE ${LINUXDIR}/include/linux/version.h| \
+       sed 's/[^"]*"\(.*\)\{1\}"/\1/')
+LINUX_VERSION_CODE=$(grep LINUX_VERSION_CODE ${LINUXDIR}/include/linux/version.h| \
+       sed 's/.*LINUX_VERSION_CODE\([0-9xXa-fA-F]*\)/\1/')
 
 echo using LINUXDIR=$LINUXDIR
 
 export LINUXDIR
 
+if (( $LINUX_VERSION_CODE < 0x20500 )); then
+       if [ ! -f "$LINUXDIR/.hdepend" ];then
+               echo
+               echo You need to run \'make dep\' on the kernel source before
+               echo continuing.
+               echo
+               exit 1
+       fi
+fi
+
 . $LINUXDIR/.config
 
 #
@@ -54,9 +61,6 @@ fi
 #
 # check running kernel vs. /usr/src/linux and warn if necessary
 #
-UTS_VERSION=$(grep UTS_RELEASE ${LINUXDIR}/include/linux/version.h| \
-       sed 's/[^"]*"\(.*\)\{1\}"/\1/')
-
 echo "Kernel source version is ${UTS_VERSION}"
 
 UNAME=$(uname -r)
@@ -78,18 +82,22 @@ EOF
 fi
 
 topdir=$(pwd)
-
-cd ${topdir}/scripts/linux_flags
-make LINUXDIR=${LINUXDIR}
+if (( $LINUX_VERSION_CODE >= 0x20500 )); then
+       FLAGDIR=${topdir}/scripts/linux_flags-2.6
+       make -C ${LINUXDIR} V=1 SUBDIRS=${FLAGDIR} LINUXDIR=${LINUXDIR} modules
+else
+       FLAGDIR=${topdir}/scripts/linux_flags
+       make -C ${FLAGDIR} LINUXDIR=${LINUXDIR}
+fi
 if [ $? != 0 ]; then
        echo "make in linux source directory failed, do you have write permission?"
        exit $?
 fi
 cd ${topdir}
-mv scripts/linux_flags/flags .buildvars
+mv $FLAGDIR/flags .buildvars
 
 
-if [ "$(echo ${UTS_VERSION} | grep '^2.[45]')" != "" ];then
+if (( $LINUX_VERSION_CODE >= 0x00020300 ));then
        echo "FLAT_MODULES := no" >>.buildvars
 else
        echo "FLAT_MODULES := yes" >>.buildvars
diff --git a/scripts/linux_flags-2.6/Makefile b/scripts/linux_flags-2.6/Makefile
new file mode 100644 (file)
index 0000000..f556ce9
--- /dev/null
@@ -0,0 +1,22 @@
+
+obj-m += fake.o
+
+$(obj)/fake.c: flags
+       touch $(obj)/fake.c
+
+.PHONY: flags
+flags:
+       echo LINUXDIR=$(LINUXDIR) >$(obj)/flags
+       echo MODVERSIONS_H_PATH=$(LINUXDIR)/include/config/modversions.h >$(obj)/flags
+       echo ARCH=$(ARCH) >>$(obj)/flags
+       echo AFLAGS="$(AFLAGS)" >>$(obj)/flags
+       echo LDFLAGS= >>$(obj)/flags
+       echo ARFLAGS="$(ARFLAGS)" >>$(obj)/flags
+       echo CROSS_COMPILE="$(CROSS_COMPILE)" >>$(obj)/flags
+       echo KERNELRELEASE="$(KERNELRELEASE)" >>$(obj)/flags
+       echo CFLAGS="$(CFLAGS)" | sed 's_Iinclude_I"$(LINUXDIR)/include"_g'>>$(obj)/flags
+       echo CC="$(CC)" >>$(obj)/flags
+       echo LD="$(LD) $(LDFLAGS)" >>$(obj)/flags
+       echo AS="$(AS)" >>$(obj)/flags
+
+
index 98c65ff44b3d887ff18e0d95a20493f5b281cc78..2bcca2388f8dc8c1e137972b23d5ea23a6798030 100644 (file)
@@ -6,6 +6,7 @@ all:
 
 modules:
        echo LINUXDIR=$(LINUXDIR) >flags
+       echo MODVERSIONS_H_PATH=$(LINUXDIR)/include/linux/modversions.h >flags
        echo ARCH=$(ARCH) >>flags
        echo AFLAGS="$(AFLAGS)" >>flags
        echo LDFLAGS="$(LDFLAGS)" >>flags