Package: madwidi-source
Version: 0.svn20060207-3
Severity: normal
Tags: patch

Hi,

I was unable to build the kernel module on mipsel. The problem is that
1) The mipsisa32-be-elf version of hal.o is used on mipsel, which is
   little endian
2) Depending on the CPU, the kernel could have multiple formats, MIPS-I,
   MIPS-II or MIPS-III. In the case of the madwifi driver, it is
   hardcoded to mipsisa32 aka MIPS-III.
3) The gcc flags passed by madwifi to select the processor conflict
   with the kernel ones.

Please find attached a patch to fix that. It try to detect R1 or R2
processor, and select the hal.o file accordingly. It goes by default to
mipsisa32-{be,le}-elf. It also removes the gcc flags passed by madwifi,
actually as on other platforms.

Bye,
Aurelien

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: mipsel (mips)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-rc6-bcm947xx
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
diff -u madwifi-0.svn20060207/debian/patches/00list 
madwifi-0.svn20060207/debian/patches/00list
--- madwifi-0.svn20060207/debian/patches/00list
+++ madwifi-0.svn20060207/debian/patches/00list
@@ -2,0 +3 @@
+03_mips.dpatch
diff -u madwifi-0.svn20060207/debian/rules.modules 
madwifi-0.svn20060207/debian/rules.modules
--- madwifi-0.svn20060207/debian/rules.modules
+++ madwifi-0.svn20060207/debian/rules.modules
@@ -16,10 +16,23 @@
 
 ifeq ($(DEB_HOST_ARCH),mips)
        ARCH_TARGET := mipsisa32-be-elf
+ifneq ($(shell grep '^CONFIG_CPU_MIPS32_R1.*=.*y' $(KSRC)/.config),)
+       ARCH_TARGET := mips1-be-elf
+endif
+ifneq ($(shell grep '^CONFIG_CPU_MIPS32_R2.*=.*y' $(KSRC)/.config),)
+       ARCH_TARGET := mips-be-elf
+endif
+
 endif
 
 ifeq ($(DEB_HOST_ARCH),mipsel)
-       ARCH_TARGET := mipsisa32-be-elf
+       ARCH_TARGET := mipsisa32-le-elf
+ifneq ($(shell grep '^CONFIG_CPU_MIPS32_R1.*=.*y' $(KSRC)/.config),)
+       ARCH_TARGET := mips1-le-elf
+endif
+ifneq ($(shell grep '^CONFIG_CPU_MIPS32_R2.*=.*y' $(KSRC)/.config),)
+       ARCH_TARGET := mips-le-elf
+endif
 endif
 
 ifeq ($(DEB_HOST_ARCH),amd64)
--- madwifi-0.svn20060207.orig/debian/patches/03_mips.dpatch
+++ madwifi-0.svn20060207/debian/patches/03_mips.dpatch
@@ -0,0 +1,65 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## mips.patch by Aurelien Jarno <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix mips compiler flags. The compiler flags are already passed
+## DP: by the kernel scripts, the madwifi scripts don't have to pass
+## DP: them again, as they may conflict.
+
[EMAIL PROTECTED]@
+--- madwifi.orig/hal/public/mipsisa32-le-elf.inc
++++ madwifi/hal/public/mipsisa32-le-elf.inc
+@@ -65,5 +65,5 @@
+ 
+ LDOPTS=       -EL
+ COPTS+=       -DAH_BYTE_ORDER=AH_LITTLE_ENDIAN
+-COPTS+=       -G 0 -EL -mno-abicalls -fno-pic -march=r4600 -Wa,--trap \
++COPTS+=       -G 0 -EL -mno-abicalls -fno-pic -Wa,--trap \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
+--- madwifi.orig/hal/public/mips-le-elf.inc
++++ madwifi/hal/public/mips-le-elf.inc
+@@ -63,5 +63,5 @@
+ 
+ LDOPTS=       -EL
+ COPTS+=       -DAH_BYTE_ORDER=AH_LITTLE_ENDIAN
+-COPTS+=       -G 0 -EL -mno-abicalls -fno-pic -mips2 -Wa,--trap \
++COPTS+=       -G 0 -EL -mno-abicalls -fno-pic -Wa,--trap \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
+--- madwifi.orig/hal/public/mipsisa32-be-elf.inc
++++ madwifi/hal/public/mipsisa32-be-elf.inc
+@@ -65,7 +65,7 @@
+ 
+ LDOPTS+=      -EB
+ COPTS+=       -DAH_BYTE_ORDER=AH_BIG_ENDIAN
+-COPTS+=       -G 0 -mno-abicalls -fno-pic -march=r4600 -Wa,--trap \
++COPTS+=       -G 0 -mno-abicalls -fno-pic -Wa,--trap \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls \
+       -isystem ${KERNELPATH}/include
+ 
+--- madwifi.orig/hal/public/mips-be-elf.inc
++++ madwifi/hal/public/mips-be-elf.inc
+@@ -66,5 +66,5 @@
+ 
+ LDOPTS=       -EB
+ COPTS+=       -DAH_BYTE_ORDER=AH_BIG_ENDIAN
+-COPTS+=       -G 0 -EB -mno-abicalls -fno-pic -mips2 -Wa,--trap \
++COPTS+=       -G 0 -EB -mno-abicalls -fno-pic -Wa,--trap \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
+--- madwifi.orig/hal/public/mips1-le-elf.inc
++++ madwifi/hal/public/mips1-le-elf.inc
+@@ -63,5 +63,5 @@
+ 
+ LDOPTS=       -EL
+ COPTS+=       -DAH_BYTE_ORDER=AH_LITTLE_ENDIAN
+-COPTS+=       -G 0 -EL -mno-abicalls -fno-pic -mips1 -Wa,--trap \
++COPTS+=       -G 0 -EL -mno-abicalls -fno-pic -Wa,--trap \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
+--- madwifi.orig/hal/public/mips1-be-elf.inc
++++ madwifi/hal/public/mips1-be-elf.inc
+@@ -63,5 +63,5 @@
+ 
+ LDOPTS=       -EB
+ COPTS+=       -DAH_BYTE_ORDER=AH_BIG_ENDIAN
+-COPTS+=       -G 0 -EB -mno-abicalls -fno-pic -mips1 -Wa,--trap \
++COPTS+=       -G 0 -EB -mno-abicalls -fno-pic -Wa,--trap \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls

Reply via email to