Add debian new kernel module build style support

Please run configure as
	./configure --with-l26=/lib/modules/`uname -r`
instead of
	./configure --with-l26=/lib/modules/`uname -r`/build
This commit is contained in:
Mikio Hara
2009-09-23 13:25:04 -07:00
committed by Glen Gibb
parent 31a507fedc
commit 7d1591aec9
9 changed files with 31 additions and 135 deletions
-3
View File
@@ -1,3 +0,0 @@
[submodule "ext"]
path = ext
url = ../openflowext
+2 -2
View File
@@ -227,7 +227,7 @@ argument to the configure script, as described under step 1 in that
section. Specify the location on --with-l26 for Linux 2.6.
For example, to build for a running instance of Linux 2.6:
% ./configure --with-l26=/lib/modules/`uname -r`/build
% ./configure --with-l26=/lib/modules/`uname -r`
If you wish to build OpenFlow for an architecture other than the
architecture used for compilation, you may specify the kernel
@@ -245,7 +245,7 @@ switching table is in a directory named datapath/hwtable-foomatic, you
could compile support for it with the running Linux 2.6 kernel like
so:
% ./configure --with-l26=/lib/modules/`uname -r`/build \
% ./configure --with-l26=/lib/modules/`uname -r` \
--enable-hw-tables=foomatic
For more information about hardware table modules, please read
-13
View File
@@ -4,20 +4,9 @@ AUTOMAKE_OPTIONS = foreign -Wno-syntax subdir-objects
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = datapath
if HAVE_DPKG_BUILDPACKAGE
distcheck-hook:
cd $(srcdir) && dpkg-buildpackage -rfakeroot -us -uc
cd $(srcdir) && fakeroot ./debian/rules clean
else
distcheck-hook:
endif
AM_CPPFLAGS = $(SSL_CFLAGS)
AM_CPPFLAGS += -I $(top_srcdir)/include
AM_CPPFLAGS += -I $(top_srcdir)/lib
if HAVE_EXT
AM_CPPFLAGS += -I $(top_srcdir)/ext/include
endif
AM_CFLAGS = -Wstrict-prototypes
@@ -66,5 +55,3 @@ include udatapath/automake.mk
include tests/automake.mk
include include/automake.mk
include third-party/automake.mk
include debian/automake.mk
include ext.mk
+20 -52
View File
@@ -38,35 +38,42 @@ dnl Configure linux kernel source tree
AC_DEFUN([OFP_CHECK_LINUX], [
AC_ARG_WITH([$1],
[AC_HELP_STRING([--with-$1=/path/to/linux-$2],
[Specify the linux $2 kernel sources])],
[Specify the linux $2 kernel module build envrionment and sources])],
[path="$withval"], [path=])dnl
if test -n "$path"; then
path=`eval echo "$path"`
AC_MSG_CHECKING([for $path directory])
if test -d "$path"; then
AC_MSG_RESULT([yes])
$3=$path
AC_SUBST($3)
if test -d "$path" && test -d "$path/build" ; then
AC_MSG_RESULT([yes])
if test -d "$path/source" ; then
$3=$path/build
$4=$path/source
else
$3=$path/build
$4=$path/build
fi
AC_SUBST($3)
AC_SUBST($4)
else
AC_MSG_RESULT([no])
AC_ERROR([source dir $path doesn't exist])
AC_MSG_RESULT([no])
AC_ERROR([source dir $path doesn't exist])
fi
AC_MSG_CHECKING([for $path kernel version])
patchlevel=`sed -n 's/^PATCHLEVEL = //p' "$path/Makefile"`
sublevel=`sed -n 's/^SUBLEVEL = //p' "$path/Makefile"`
patchlevel=`sed -n 's/^PATCHLEVEL = //p' "$KBLD26/Makefile"`
sublevel=`sed -n 's/^SUBLEVEL = //p' "$KBLD26/Makefile"`
AC_MSG_RESULT([2.$patchlevel.$sublevel])
if test "2.$patchlevel" != '$2'; then
AC_ERROR([Linux kernel source in $path is not version $2])
fi
if ! test -e "$path"/include/linux/version.h || \
! test -e "$path"/include/linux/autoconf.h; then
AC_MSG_ERROR([Linux kernel source in $path is not configured])
if ! test -e $KBLD26/include/linux/version.h || \
! test -e $KBLD26/include/linux/autoconf.h; then
AC_MSG_ERROR([Linux kernel source in $path is not configured])
fi
m4_if($2, [2.6], [OFP_CHECK_LINUX26_COMPAT])
fi
AM_CONDITIONAL($4, test -n "$path")
AM_CONDITIONAL($5, test -n "$path")
])
dnl OFP_GREP_IFELSE(FILE, REGEX, IF-MATCH, IF-NO-MATCH)
@@ -173,45 +180,6 @@ AC_DEFUN([OFP_CHECK_IF_PACKET],
[Define to 1 if net/if_packet.h is available.])
fi])
dnl Enable OpenFlow extension submodule.
AC_DEFUN([OFP_ENABLE_EXT],
[AC_ARG_ENABLE([ext],
AS_HELP_STRING([--enable-ext],
[use OpenFlow extensions
(default is yes if "ext" dir exists)]))
case "${enable_ext}" in
(yes)
HAVE_EXT=yes
;;
(no)
HAVE_EXT=no
;;
(*)
if test -e "$srcdir/ext/automake.mk"; then
HAVE_EXT=yes
else
HAVE_EXT=no
fi
;;
esac
if test $HAVE_EXT = yes; then
if test -e "$srcdir/ext/automake.mk"; then
:
else
AC_MSG_ERROR([cannot configure extensions without "ext" directory])
fi
AC_DEFINE([HAVE_EXT], [1],
[Whether the OpenFlow extensions submodule is available])
fi
AM_CONDITIONAL([HAVE_EXT], [test $HAVE_EXT = yes])])
dnl Checks for dpkg-buildpackage. If this is available then we check
dnl that the Debian packaging is functional at "make distcheck" time.
AC_DEFUN([OFP_CHECK_DPKG_BUILDPACKAGE],
[AC_CHECK_PROG([HAVE_DPKG_BUILDPACKAGE], [dpkg-buildpackage], [yes], [no])
AM_CONDITIONAL([HAVE_DPKG_BUILDPACKAGE],
[test $HAVE_DPKG_BUILDPACKAGE = yes])])
dnl ----------------------------------------------------------------------
dnl These macros are from GNU PSPP, with the following original license:
dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+1 -53
View File
@@ -1,55 +1,3 @@
#! /bin/sh
set -e
have_ext=$(if test -e ext/automake.mk; then echo yes; else echo no; fi)
for opt
do
case $opt in
(--enable-ext) have_ext=yes ;;
(--disable-ext) have_ext=no ;;
(--help) cat <<EOF
$0: bootstrap OpenFlow from a Git repository
usage: $0 [OPTIONS]
The recognized options are:
--enable-ext include openflowext
--disable-ext exclude openflowext
By default, openflowext is included if it is present.
EOF
exit 0
;;
(*) echo "unknown option $opt; use --help for help"; exit 1 ;;
esac
done
# Generate list of files in debian/ to distribute.
(echo '# Automatically generated by boot.sh (from Git tree).' &&
printf 'EXTRA_DIST += \\\n' &&
git ls-files debian | grep -v '^debian/\.gitignore$' |
sed -e 's/\(.*\)/ \1 \\/' -e '$s/ \\//') > debian/automake.mk
# Enable or disable ext.
if test "$have_ext" = yes; then
echo 'Enabling openflowext...'
echo 'include ext/automake.mk' > ext.mk
echo 'm4_include([ext/configure.m4])' > ext.m4
cat debian/control.in ext/debian/control.in > debian/control
for d in $(cd ext/debian && git ls-files --exclude-from=debian/dontlink)
do
test -e debian/$d || ln -s ../ext/debian/$d debian/$d
if ! fgrep -q $d debian/.gitignore; then
echo "Adding $d to debian/.gitignore"
(cat debian/.gitignore && printf '/%s' "$d") \
| LC_ALL=C sort > tmp$$ \
&& mv tmp$$ debian/.gitignore
fi
done
else
echo 'Disabling openflowext...'
echo '# This file intentionally left blank.' > ext.mk
echo '# This file intentionally left blank.' > ext.m4
cat debian/control.in > debian/control
fi
# Bootstrap configure system from .ac/.am files
autoreconf --install -I config --force
autoreconf --install --force
+1 -6
View File
@@ -60,9 +60,7 @@ AC_CHECK_FUNCS([strsignal])
AC_ARG_VAR(KARCH, [Kernel Architecture String])
AC_SUBST(KARCH)
OFP_CHECK_LINUX(l26, 2.6, KSRC26, L26_ENABLED)
OFP_CHECK_DPKG_BUILDPACKAGE
OFP_CHECK_LINUX(l26, 2.6, KBLD26, KSRC26, L26_ENABLED)
OFP_ENABLE_OPTION([-Wall])
OFP_ENABLE_OPTION([-Wno-sign-compare])
@@ -80,9 +78,6 @@ OFP_ENABLE_OPTION([-Wmissing-prototypes])
OFP_ENABLE_OPTION([-Wmissing-field-initializers])
OFP_ENABLE_OPTION([-Wno-override-init])
OFP_ENABLE_EXT
m4_include([ext.m4])
AC_CONFIG_FILES([Makefile
datapath/Makefile
datapath/linux-2.6/Kbuild
+1 -2
View File
@@ -14,8 +14,7 @@ Installation
First build OpenFlow ensuring you include the directive to build the
openflow_netfpga2 hardware table in your configure statement:
% ./configure --with-l26=/lib/modules/`uname -r`/build
--enable-hw-tables=nf2
% ./configure --with-l26=/lib/modules/`uname -r` --enable-hw-tables=nf2
To get debugging output from the NetFPGA hardware table uncomment the following
line from within <openflow>/datapath/hwtable_nf2/nf2_flowtable.h, then recompile:
+5 -3
View File
@@ -1,8 +1,10 @@
# -*- makefile -*-
export builddir = @abs_builddir@
export srcdir = @abs_srcdir@
export top_srcdir = @abs_top_srcdir@
export KSRC = @KSRC26@
export KBLD = @KBLD26@
export VERSION = @VERSION@
export BUILD_VETH = @BUILD_VETH@
@@ -33,7 +35,7 @@ else
KOBJ := $(KSRC)
endif
ifneq ($(shell grep -c 'PATCHLEVEL = 6' $(KSRC)/Makefile),1)
ifneq ($(shell grep -c 'PATCHLEVEL = 6' $(KSRC)/Makefile), 1)
$(error Linux kernel source in $(KSRC) not 2.6)
endif
@@ -42,13 +44,13 @@ ifeq (,$(wildcard $(VERSION_FILE)))
$(error Linux kernel source not configured - missing version.h)
endif
CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
CONFIG_FILE := $(KBLD)/include/linux/autoconf.h
ifeq (,$(wildcard $(CONFIG_FILE)))
$(error Linux kernel source not configured - missing autoconf.h)
endif
default:
$(MAKE) -C $(KSRC) M=$(builddir) modules
$(MAKE) -C $(KBLD) M=$(builddir) modules
endif
# Much of the kernel build system in this file is derived from Intel's
+1 -1
View File
@@ -106,7 +106,7 @@ Download and untar OpenFlow v0.8.1
tar xzf openflow-v0.8.1.tar.gz
Build OpenFlow user-space and kernel-space switches:
cd openflow-v0.8.1
./configure --with-l26=/lib/modules/`uname -r`/build
./configure --with-l26=/lib/modules/`uname -r`
make
sudo make install
Now, download and untar the OpenFlow Test Suite: