From 055f965f639052c0ad7832c306926cb9623b8efa Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Tue, 5 Aug 2003 18:55:06 +0000 Subject: [PATCH] linux 2.6 flag extraction --- Makefile.modbuild | 2 +- scripts/dep.linux | 38 +++++++++++++++++++------------- scripts/linux_flags-2.6/Makefile | 22 ++++++++++++++++++ scripts/linux_flags/Makefile | 1 + 4 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 scripts/linux_flags-2.6/Makefile diff --git a/Makefile.modbuild b/Makefile.modbuild index 07c9246c..2a1e8c8c 100644 --- a/Makefile.modbuild +++ b/Makefile.modbuild @@ -80,7 +80,7 @@ _modinst_%: ifeq ($(CONFIG_MODVERSIONS),y) -MODFLAGS += -DMODVERSIONS -include $(LINUXDIR)/include/linux/modversions.h +MODFLAGS += -DMODVERSIONS -include $(MODVERSIONS_H_PATH) endif diff --git a/scripts/dep.linux b/scripts/dep.linux index 95d261c8..ac223549 100755 --- a/scripts/dep.linux +++ b/scripts/dep.linux @@ -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 index 00000000..f556ce9d --- /dev/null +++ b/scripts/linux_flags-2.6/Makefile @@ -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 + + diff --git a/scripts/linux_flags/Makefile b/scripts/linux_flags/Makefile index 98c65ff4..2bcca238 100644 --- a/scripts/linux_flags/Makefile +++ b/scripts/linux_flags/Makefile @@ -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 -- 2.26.2