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

Martin Michlmayr tbm at cyrius.com
Thu Mar 23 11:34:50 UTC 2006


* Aurelien Jarno <aurel32 at debian.org> [2006-03-23 09:05]:
> 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

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?

> mipsisa32-{be,le}-elf. It also removes the gcc flags passed by madwifi,
> actually as on other platforms.


> 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 <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 -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


-- 
Martin Michlmayr
http://www.cyrius.com/




More information about the Pkg-madwifi-maintainers mailing list