Bug#358559: madwidi-source: Fails to build kernel module on mipsel

Aurelien Jarno aurelien at aurel32.net
Fri Mar 24 19:23:38 UTC 2006


On Fri, Mar 24, 2006 at 05:59:14PM +0000, Thiemo Seufer wrote:
> On Fri, Mar 24, 2006 at 06:41:32PM +0100, Aurelien Jarno wrote:
> [snip]
> > >>Hmm, you select the hal.o file accordingly?  Won't mips1-le-elf work
> > >>on both R1 and R2?  Checking for R1/R2 doesn't seem ideal to me if it
> > >>can be avoided.
> > >>
> > >>Thiemo, any comment?
> > >
> > >
> > >At least for 32bit kernels this looks like a viable option, if the hal
> > >layer is sufficiently simple (i.e. no dependency to kernel headers).
> > >
> > >Same for 64bit kernels and MIPS-III.
> > 
> > So in short we could use mipsisa32-{be,le}-elf on all machines but the 
> > one that have CONFIG_CPU_MIPS32_R1 or CONFIG_CPU_MIPS32_R2 set to one. 
> > Am I right?
> 
> Erm, depends on what "mipsisa32" selects in that case.
> The compatibility tree is:
> 
>                 / -> MIPS-III -> MIPS-IV -> MIPS64 -> MIPS64R2  # 64bit
>                 |                             ^          ^
> 		|                             |          |
> MIPS-I -> MIPS-II ------------------------> MIPS32 -> MIPS32R2  # 32bit
> 
> so you need MIPS-I for 32bit Kernels and MIPS-III for 64bit kernels.
> For the current compilers in Debian this can be selected via
> -march=mips1 and -march=mips3 respectively.
>

Ok, please find attached a new patch that uses mips1-{be,le}-elf for all
kernels. Tested on R1 and R4400 CPU.

As for 64-bit kernels, the MIPS-III binary does not work, as it is a
32-bit file:

  LD [M]  /usr/src/modules/madwifi/ath_hal/ath_hal.o
ld: /usr/src/modules/madwifi/ath_hal/hal.o: ABI is incompatible with that of the selected emulation
ld: failed to merge target specific data of file /usr/src/modules/madwifi/ath_hal/hal.o
ld: BFD 2.16.91 20060118 Debian GNU/Linux assertion fail ../../bfd/elflink.c:7915
ld: BFD 2.16.91 20060118 Debian GNU/Linux assertion fail ../../bfd/elflink.c:7915
ld: BFD 2.16.91 20060118 Debian GNU/Linux assertion fail ../../bfd/elflink.c:7915
ld: BFD 2.16.91 20060118 Debian GNU/Linux assertion fail ../../bfd/elflink.c:7915
ld: Attempt to do relocatable link with elf32-tradbigmips input and elf64-tradbigmips output
ld: final link failed: File in wrong format
make[3]: *** [/usr/src/modules/madwifi/ath_hal/ath_hal.o] Error 1
make[2]: *** [_module_/usr/src/modules/madwifi/ath_hal] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-2.6.16-rc6-r4k-ip22'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/modules/madwifi/ath_hal'
make: *** [all] Erreur 1
make: quittant le répertoire « /usr/src/modules/madwifi »
root at nyquist:/usr/src/modules/madwifi# file /usr/src/modules/madwifi/ath_hal/*o
/usr/src/modules/madwifi/ath_hal/ah_osdep.o: ELF 64-bit MSB relocatable, MIPS, MIPS-III version 1 (SYSV), not stripped
/usr/src/modules/madwifi/ath_hal/hal.o:      ELF 32-bit MSB relocatable, MIPS, MIPS-III version 1 (SYSV), not stripped


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32 at debian.org         | aurelien at aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net
-------------- next part --------------
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
@@ -15,11 +15,11 @@
 endif
 
 ifeq ($(DEB_HOST_ARCH),mips)
-	ARCH_TARGET := mipsisa32-be-elf
+	ARCH_TARGET := mips1-be-elf
 endif
 
 ifeq ($(DEB_HOST_ARCH),mipsel)
-	ARCH_TARGET := mipsisa32-be-elf
+	ARCH_TARGET := mips1-le-elf
 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 <aurel32 at debian.org>
+##
+## 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.
+
+ at DPATCH@
+--- 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 \
+ 	-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


More information about the Pkg-madwifi-maintainers mailing list