diff -urN modutils-2.4.22/configure modutils-2.4.22.new/configure
--- modutils-2.4.22/configure	Sun Jul 21 09:31:45 2002
+++ modutils-2.4.22.new/configure	Wed Dec 11 10:40:52 2002
@@ -53,6 +53,10 @@
                                modules (default on ppc is yes, default on other
                                architectures is no)"
 ac_help="$ac_help
+  --enable-common-s390        Make one executable handle 32 and 64 bit kernel
+                               modules (default on s390 is yes, default on other
+                               architectures is no)"
+ac_help="$ac_help
   --enable-strip               Strip binaries during install.   Default is no
                                on IA64 (ski does not like stripped binaries),
                                yes on other architectures"
@@ -712,6 +716,8 @@
   sh*)       ARCH=sh    ;;
   powerpc)   ARCH=ppc   ;;
   powerpc64) ARCH=ppc64 ;;
+  s390)      ARCH=s390  ;;
+  s390x)     ARCH=s390x ;;
   hppa2*)    ARCH=hppa64 ;;
   *)         ARCH=$host_cpu ;;
 esac
@@ -881,6 +887,24 @@
 esac
 
 
+COMMON_s390=yes
+# Check whether --enable-common-s390 or --disable-common-s390 was given.
+if test "${enable_common_s390+set}" = set; then
+  enableval="$enable_common_s390"
+  if test "$enableval" = "yes"; then
+  COMMON_s390=yes
+  else
+  COMMON_s390=no
+fi
+fi
+
+case "$ARCH" in
+  s390x) if test "$COMMON_s390" = "yes"; then ARCH="s390"; fi ;;
+  s390*) ;;
+  *) COMMON_s390=no ;;
+esac
+
+
 
 
 case "$ARCH" in
@@ -1639,6 +1663,7 @@
 s%@COMMON_sparc@%$COMMON_sparc%g
 s%@COMMON_hppa@%$COMMON_hppa%g
 s%@COMMON_ppc@%$COMMON_ppc%g
+s%@COMMON_s390@%$COMMON_s390%g
 s%@ARCH@%$ARCH%g
 s%@STRIP@%$STRIP%g
 s%@USE_SYSCALL@%$USE_SYSCALL%g
diff -urN modutils-2.4.22/configure.in modutils-2.4.22.new/configure.in
--- modutils-2.4.22/configure.in	Sun Jul 21 09:31:45 2002
+++ modutils-2.4.22.new/configure.in	Wed Dec 11 10:40:52 2002
@@ -29,6 +29,8 @@
   sh*)       ARCH=sh    ;;
   powerpc)   ARCH=ppc   ;;
   powerpc64) ARCH=ppc64 ;;
+  s390)      ARCH=s390  ;;
+  s390x)     ARCH=s390x ;;
   hppa2*)    ARCH=hppa64 ;;
   *)         ARCH=$host_cpu ;;
 esac
@@ -172,6 +174,23 @@
   *) COMMON_ppc=no ;;
 esac
 AC_SUBST(COMMON_ppc)
+
+COMMON_s390=yes
+AC_ARG_ENABLE(common-s390,
+[  --enable-common-s390        Make one executable handle 32 and 64 bit kernel
+                               modules (default on s390 is yes, default on other
+                               architectures is no)],
+[if test "$enableval" = "yes"; then
+  COMMON_s390=yes
+  else
+  COMMON_s390=no
+fi])
+case "$ARCH" in
+  s390x) if test "$COMMON_s390" = "yes"; then ARCH="s390"; fi ;;
+  s390*) ;;
+  *) COMMON_s390=no ;;
+esac
+AC_SUBST(COMMON_s390)
 
 AC_SUBST(ARCH)
 
diff -urN modutils-2.4.22/depmod/Makefile.in modutils-2.4.22.new/depmod/Makefile.in
--- modutils-2.4.22/depmod/Makefile.in	Mon Nov 25 04:23:35 2002
+++ modutils-2.4.22.new/depmod/Makefile.in	Wed Dec 11 10:40:52 2002
@@ -20,6 +20,10 @@
 DEFS64		:= -DELF_MACHINE_H='"elf_ppc64.h"' -DARCH_ppc64
 endif
 
+ifeq (@COMMON_s390@,yes)
+DEFS64		:= -DELF_MACHINE_H='"elf_s390x.h"' -DARCH_s390x
+endif
+
 # arch independent definitions for common 32/64 code
 
 ifdef DEFS64
diff -urN modutils-2.4.22/insmod/Makefile.in modutils-2.4.22.new/insmod/Makefile.in
--- modutils-2.4.22/insmod/Makefile.in	Mon Nov 25 04:43:33 2002
+++ modutils-2.4.22.new/insmod/Makefile.in	Wed Dec 11 10:40:52 2002
@@ -42,6 +42,10 @@
 DEFS64		:= -DELF_MACHINE_H='"elf_ppc64.h"' -DARCH_ppc64
 endif
 
+ifeq (@COMMON_s390@,yes)
+DEFS64		:= -DELF_MACHINE_H='"elf_s390x.h"' -DARCH_s390x
+endif
+
 # arch independent definitions for common 32/64 code
 
 ifdef DEFS64
diff -urN modutils-2.4.22/obj/Makefile.in modutils-2.4.22.new/obj/Makefile.in
--- modutils-2.4.22/obj/Makefile.in	Fri Mar  1 01:39:06 2002
+++ modutils-2.4.22.new/obj/Makefile.in	Wed Dec 11 10:40:52 2002
@@ -28,6 +28,12 @@
 DEFS64		:= -DELF_MACHINE_H='"elf_ppc64.h"' -DARCH_ppc64
 endif
 
+ifeq (@COMMON_s390@,yes)
+LIBOBJ_OBJS	+= obj_s390x_64.o
+LIBOBJ_SRCS	+= obj_s390x.c
+DEFS64		:= -DELF_MACHINE_H='"elf_s390x.h"' -DARCH_s390x
+endif
+
 
 # arch independent definitions for common 32/64 code
 
diff -urN modutils-2.4.22/obj/obj_s390.c modutils-2.4.22.new/obj/obj_s390.c
--- modutils-2.4.22/obj/obj_s390.c	Fri Mar  1 01:39:06 2002
+++ modutils-2.4.22.new/obj/obj_s390.c	Wed Dec 11 10:40:52 2002
@@ -274,7 +274,7 @@
               if (!ge->allocated) {
                 ge->allocated = 1;
                 ge->offset = got_offset;
-                got_offset += sizeof(void*);
+                got_offset += sizeof(Elf32_Addr);
               }
 	      break;
 
diff -urN modutils-2.4.22/obj/obj_s390x.c modutils-2.4.22.new/obj/obj_s390x.c
--- modutils-2.4.22/obj/obj_s390x.c	Fri Mar  1 01:39:06 2002
+++ modutils-2.4.22.new/obj/obj_s390x.c	Wed Dec 11 10:40:52 2002
@@ -309,7 +309,7 @@
               if (!ge->allocated) {
                 ge->allocated = 1;
                 ge->offset = got_offset;
-                got_offset += sizeof(void*);
+                got_offset += sizeof(Elf64_Addr);
               }
              break;
 
diff -urN modutils-2.4.22/util/arch64.c modutils-2.4.22.new/util/arch64.c
--- modutils-2.4.22/util/arch64.c	Sun Apr 28 11:39:21 2002
+++ modutils-2.4.22.new/util/arch64.c	Wed Dec 11 10:40:52 2002
@@ -39,5 +39,5 @@
 		memcpy(uts.machine, uname_m, l);
 		uts.machine[l] = '\0';
 	}
-	return(strstr(uts.machine, "64") != NULL);
+	return(strstr(uts.machine, "64") != NULL || strstr(uts.machine, "s390x") != NULL);
 }
--- modutils-2.4.22/obj/obj_s390.c.ook	Tue Feb  4 00:07:15 2003
+++ modutils-2.4.22/obj/obj_s390.c	Tue Feb  4 00:11:36 2003
@@ -201,7 +201,7 @@
         *(unsigned int *) loc += isym->gotent.offset;
       break;
 
-    case R_390_GOTOFF:
+    case R_390_GOTOFF32:
       assert(got != 0);
       *loc += v - got;
       break;
@@ -261,7 +261,7 @@
             /* The next three don't need got entries but the address
                of the got itself.  */
 	    case R_390_GOTPC:
-	    case R_390_GOTOFF:
+	    case R_390_GOTOFF32:
 	      gotneeded = 1;
               break;
 
--- modutils-2.4.22/obj/obj_s390x.c.ook	Tue Feb  4 00:07:28 2003
+++ modutils-2.4.22/obj/obj_s390x.c	Tue Feb  4 00:11:49 2003
@@ -231,7 +231,7 @@
         *(unsigned int *) loc += isym->gotent.offset >> 1;
       break;
 
-    case R_390_GOTOFF:
+    case R_390_GOTOFF32:
       assert(got != 0);
       *loc += v - got;
       break;
@@ -294,7 +294,7 @@
                of the got itself.  */
            case R_390_GOTPC:
             case R_390_GOTPCDBL:
-           case R_390_GOTOFF:
+           case R_390_GOTOFF32:
              gotneeded = 1;
               break;
 
