]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
* Apply patch from
authorSam Hartman <hartmans@debian.org>
Sun, 30 May 2004 19:03:22 +0000 (19:03 +0000)
committerSam Hartman <hartmans@debian.org>
Sun, 30 May 2004 19:03:22 +0000 (19:03 +0000)
    /afs/cs.cmu.edu/user/jhutz/junk/openafs-patches/openafs-build-on-linux26
which correctly generates 2.6 modules.
  * Make sure makefile generation script is executable in debian/rules

debian/changelog
debian/rules
src/afs/LINUX/osi_module.c
src/config/param.i386_linux26.h
src/libafs/MakefileProto.LINUX.in
src/libafs/make_kbuild_makefile.pl [new file with mode: 0755]

index d6bbc55673b4f406d96997896c0120303af7459a..b217bd9632baaf0a723cb140e460bedcc01115fd 100644 (file)
@@ -2,8 +2,10 @@ openafs (1.3.64-1) experimental; urgency=low
 
   * New upstream version
   * Add 2.6 to kern-sysname for i386
+  * Apply patch from
+    /afs/cs.cmu.edu/user/jhutz/junk/openafs-patches/openafs-build-on-linux26  which correctly generates 2.6 modules.
 
- -- Sam Hartman <hartmans@debian.org>  Sun, 23 May 2004 22:35:31 -0400
+ --
 
 openafs (1.2.11-1) unstable; urgency=high
 
index 2be8eb9a17089f72784a9476ca9203a0115e61e3..31f54dd0c48884159c1184a302daf3e2bf6810ab 100755 (executable)
@@ -39,6 +39,7 @@ configure-stamp:
         afslogsdir=/var/log/openafs sh configure --with-afs-sysname=$(SYS_NAME) --disable-kernel-module \
        --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib \
        --localstatedir=/var/lib 
+       chmod a+x src/libafs/make_kbuild_makefile.pl         
        install -d $(SYS_NAME)/dest/root.client/usr/vice/etc
        install -d dest/root.server/usr/afs/bin
 
index 4eafd9d40931647116cab6e3bdf40884aa23e67b..202b51b9ce2ba78c77228f0c1d290cedc4f68061 100644 (file)
@@ -147,7 +147,7 @@ afsproc_init()
     struct proc_dir_entry *entry1;
 
     openafs_procfs = proc_mkdir(PROC_FSDIRNAME, proc_root_fs);
-    entry1 = create_proc_entry(PROC_SYSCALL_NAME, 0, openafs_procfs);
+    entry1 = create_proc_entry(PROC_SYSCALL_NAME, 0666, openafs_procfs);
 
     entry1->proc_fops = &afs_syscall_fops;
 
index 641dc8d051a7dde0f42c04a678cfc70375270fc2..392c469bcd71fe88ac3da98726c23962af9f886a 100644 (file)
 #define AFS_GLOBAL_SUNLOCK
 #endif
 
-#if defined(MODULE) && defined(CONFIG_MODVERSIONS)
-#define MODVERSIONS
-#include <linux/modversions.h>
-#endif
-
 #endif /* __KERNEL__  && !DUMP_KERNEL */
 
 #include <afs/afs_sysnames.h>
index 010ed4d0744887eb4ea374be0a713a86d2cba61e..aeaf2ba94316373ea19de3ce352799d8044393c5 100644 (file)
@@ -36,8 +36,10 @@ LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
 
 # System specific build commands and flags
 <i386_linux26>
-CCFLAGS = $(COMMON_KERN_CFLAGS) @P5PLUS_KOPTS@ -I../mach
-DEFINES = $(COMMON_DEFINES) -DCPU=586 -DKBUILD_BASENAME=libafs_$(subst .,_,$(subst -,_,${CLIENT})) -DKBUILD_MODNAME=libafs_$(subst .,_,$(subst -,_,${CLIENT}))
+# All the platform-specific and kernel-related things are provided by
+# the kernel build system.  So we should _not_ use COMMON_KERN_CFLAGS!
+CCFLAGS = -Wno-strict-prototypes
+DEFINES = $(COMMON_DEFINES)
 
 <i386_linux22 i386_linux24>
 CCFLAGS = $(COMMON_KERN_CFLAGS) @P5PLUS_KOPTS@
@@ -86,7 +88,8 @@ CCFLAGS = $(COMMON_KERN_CFLAGS) -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -fali
 DEFINES = $(COMMON_DEFINES)
 
 <all>
-INCLUDES = -I. -I../ -I${TOP_OBJDIR}/src/config
+INCLUDES = -I. -I../ -I${TOP_OBJDIR}/src/config \
+  -I${TOP_SRCDIR}/rx -I${TOP_SRCDIR}/rxstat
 
 CFLAGS = $(CCFLAGS) $(DEFINES) $(INCLUDES)
 
@@ -101,6 +104,12 @@ DESTDIRS=linux_destdirs
 
 include Makefile.common
 
+<i386_linux26>
+LINUX_MODULE_EXT=ko
+<all -i386_linux26>
+LINUX_MODULE_EXT=o
+<all>
+
 LINUX_MODULE_NAME=
 LOCAL_SMP_DEF=
 
@@ -110,7 +119,7 @@ setup:
        for m in ${MPS} ; do \
                KDIR=$(KOBJ)-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m; \
                mkdir -p $${KDIR}; \
-               ln -fs ../Makefile $${KDIR}/Makefile ; \
+               ln -fs ../Makefile $${KDIR}/Makefile.afs ; \
                ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
                ln -fs ../config $${KDIR}/config; \
        done 
@@ -135,7 +144,7 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-parisc asm
 <alpha_linux_22 alpha_linux_24>
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-alpha asm
-<i386_linux22 i386_linux24 i386_linux26>
+<i386_linux22 i386_linux24>
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-i386 asm
 <i386_umlinux22 i386_umlinux24>
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-um asm
@@ -153,8 +162,6 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm
 <ia64_linux24>
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-ia64 asm
-<i386_linux26>
-       ln -fs ${LINUX_KERNEL_PATH}/include/asm-i386/mach-default mach
 <all>
        for m in ${MPS} ; do \
                KDIR=${KOBJ}-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m ; \
@@ -173,8 +180,9 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
                        TARG=libafs ; \
                fi ; \
                cd $${KDIR} ; \
-               $(MAKE) SMP_DEF="$${SMP_DEF}" $@_$${TARG} CLIENT=${LINUX_VERSION}${LINUX_MODULE_NAME} || exit $$?; \
+               $(MAKE) -f Makefile.afs SMP_DEF="$${SMP_DEF}" $@_$${TARG} CLIENT=${LINUX_VERSION}${LINUX_MODULE_NAME} KDIR=$${KDIR} || exit $$?; \
                cd ../ ; \
+<all>
        done
 
 linux_compdirs_libafs: depsrcs libafs
@@ -193,10 +201,10 @@ linux_destdirs_libafs.bm: dest_libafs.bm
 
 # Below this line are targets when in the COMMON directory:
 # For Linux there is no kernel NFS server.
-LIBAFS = libafs-${CLIENT}.o
-LIBAFS_MP = libafs-${CLIENT}.mp.o
-LIBAFS_EP = libafs-${CLIENT}.ep.o
-LIBAFS_BM = libafs-${CLIENT}.bm.o
+LIBAFS = libafs-${CLIENT}.${LINUX_MODULE_EXT}
+LIBAFS_MP = libafs-${CLIENT}.mp.${LINUX_MODULE_EXT}
+LIBAFS_EP = libafs-${CLIENT}.ep.${LINUX_MODULE_EXT}
+LIBAFS_BM = libafs-${CLIENT}.bm.${LINUX_MODULE_EXT}
 
 INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
 INST_LIBAFS_MP = ${DESTDIR}${afskerneldir}/${LIBAFS_MP}
@@ -219,6 +227,13 @@ libafs.ep: $(LIBAFS_EP)
 libafs.bm: $(LIBAFS_BM)
        echo BM Build Complete
 
+<i386_linux26>
+${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}:
+       ../make_kbuild_makefile.pl ${KDIR} $@ @TOP_OBJDIR@/src/config/Makefile.config \
+         Makefile.afs Makefile.common
+       $(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules
+        
+<all -i386_linux26>
 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
        $(RM) -f $@
        $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
@@ -234,6 +249,7 @@ ${LIBAFS_EP}: $(AFSAOBJS) $(AFSNONFSOBJS)
 ${LIBAFS_BM}: $(AFSAOBJS) $(AFSNONFSOBJS)
        $(RM) -f $@
        $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
+<all>
 
 install_libafs:        $(INST_LIBAFS) 
        echo SP Install Complete
diff --git a/src/libafs/make_kbuild_makefile.pl b/src/libafs/make_kbuild_makefile.pl
new file mode 100755 (executable)
index 0000000..878d1a5
--- /dev/null
@@ -0,0 +1,103 @@
+#!/usr/bin/perl
+# make_kbuild_makefile.pl
+# Generate a Makefile for use with the Linux 2.6+ kernel build system
+#
+# Usage: make_kbuild_makefile.pl ${KDIR} ${TARG} Makefiles...
+#
+# The specified makefiles will be scanned for variable values
+# The module ${TARG} will be built in ${TOP_SRCDIR}/src/libafs/${KDIR}.
+# It will include objects listed in ${AFSAOBJS} and ${AFSNONFSOBJS}
+# Appropriate source files for each object will be symlinked into ${KDIR}
+# EXTRA_CFLAGS will be set to ${CFLAGS} ${COMMON_INCLUDE}
+
+# Produces ${KDIR}/Makefile, suitable for use with kbuild
+
+use IO::File;
+
+
+if (@ARGV < 3) {
+  die "Usage: echo objects... | $0 KDIR TARG Makefiles...\n";
+}
+
+($KDIR, $TARG, @Makefiles) = @ARGV;
+$TARG =~ s/\.k?o$//;
+
+## Read in all of the Makefiles given on the command line
+## Our ultimate goal is to find the correct source file for each object.
+## We make the following assumptions:
+## - Every variable is defined before it is used.
+## - Each of our objects has exactly one dependency, which is the name
+##   of the source file that needs to be symlinked into $KDIR
+foreach $mf (@Makefiles) {
+  $F = new IO::File($mf, O_RDONLY) or die "$mf: $!\n";
+  $text = '';
+  while (<$F>) {
+    chomp;
+    $text .= $_;
+    next if $text =~ s/\\$/ /;                 ## Continuation
+    if ($text =~ /^#/) { $text = ''; next }    ## Comment
+    #print STDERR "<< $text\n";
+
+    $text =~ s/\$\((\w+)\)/$vars{$1}/g;        # Substitute variables
+    $text =~ s/\$\{(\w+)\}/$vars{$1}/g;
+    #print STDERR ">> $text\n";
+
+    if ($text =~ /^\s*(\S+)\s*=/) {            ## Variable definition
+      ($key, $value) = ($1, $');
+      $value =~ s/^\s*//;                      # Remove leading and
+      $value =~ s/\s*$//;                      # trailing whitespace
+      $vars{$key} = $value;                    # Store it
+    }
+    elsif ($text =~ /^(\S+\.o):\s*(\S+\.c)/) {    ## Dependency
+      $deps{$1} = $2;
+    }
+    $text = '';
+  }
+  $F->close();
+}
+
+
+$KDIR = "$vars{TOP_OBJDIR}/src/libafs/$KDIR";
+@objects = (split(' ', $vars{AFSAOBJS}), split(' ', $vars{AFSNONFSOBJS}));
+
+$MV = new IO::File("$vars{TOP_OBJDIR}/src/config/Makefile.version", O_RDONLY)
+        or die "$vars{TOP_OBJDIR}/src/config/Makefile.version: $!\n";
+while (<$MV>) {
+  s#AFS_component_version_number#$KDIR/AFS_component_version_number#g;
+  $MakefileVersion .= $_;
+}
+$MV->close();
+
+if (! -d $KDIR) {
+  mkdir($KDIR, 0777) or die "$KDIR: $!\n";
+}
+
+
+foreach (@objects) {
+  ($src = $_) =~ s/\.o$/.c/;
+  die "No source known for $_\n" unless exists $deps{$_};
+  if (-e "$KDIR/$src" || -l "$KDIR/$src") {
+    unlink("$KDIR/$src") or die "$KDIR/$src: $!\n";
+  }
+  next unless $deps{$_} =~ m#/#;
+  symlink($deps{$_}, "$KDIR/$src") or die "$KDIR/$src: $!\n";
+}
+
+foreach $src (qw(h sys netinet)) {
+  if (-e "$KDIR/$src" || -l "$KDIR/$src") {
+    unlink("$KDIR/$src") or die "$KDIR/$src: $!\n";
+  }
+  symlink("$vars{LINUX_KERNEL_PATH}/include/linux", "$KDIR/$src")
+    or die "$KDIR/$src: $!\n";
+}
+
+$cflags = "$vars{CFLAGS} $vars{COMMON_INCLUDE}";
+$cflags =~ s#-I(?!/)#-I$KDIR/#g;
+$cflags =~ s/\s+/ \\\n /g;
+$F = new IO::File("$KDIR/Makefile", O_WRONLY|O_CREAT|O_TRUNC, 0666)
+     or die "$KDIR/Makefile: $!\n";
+print $F "EXTRA_CFLAGS=$cflags\n";
+print $F "obj-m := $TARG.o\n";
+print $F "$TARG-objs := ", join("\\\n $_", @objects), "\n";
+print $F "\n$MakefileVersion\n";
+$F->close() or die "$KDIR/Makefile: $!\n";