36

I've been trying on and off for days to build the module for my USB wireless device.

It is an Edimax EW-7811UN

I've found several resources on building modules for Debian, but none for Arch. Currently I am attempting to cross-compile using the ToolChain found on the Raspberry Pi GitHub. These are the steps I've taken:

  • Downloaded the driver sources from the Edimax website.
  • Downloaded the kernel sources from GitHub.
  • Created a specific make rule (as per the Edimax documentation) in the Edimax MakeFile:

ifeq ($(CONFIG_PLATFORM_PI), y)
  EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
  ARCH := arm
  CROSS_COMPILE := arm-bcm2708-linux-gnueabi-
  KVER  := 3.1.9-30-ARCH+
  KSRC := /pi-sources/lib/modules/3.1.9-30-ARCH+/build 
  MODDESTDIR := /pi-sources/lib/modules/3.1.9-30-ARCH+/kernel/drivers/net/wireless/
  INSTALL_PREFIX :=
endif
  • KSRC is the directory containing the kernel sources.
  • MODDESTDIR is the directory you wish the module to end up.
  • CROSS_COMPILE is my toolchain (which has been added to PATH)

First attempt at make gives this error:

fatal error: linux/smp_lock.h: No such file or directory

I found that this is an outdated header, and symlinking it to smp.h should fix the issue. However, the build still fails with source errors, that look like this:

error: field 'recv_tasklet' has incomplete type

I've done enough compiling to know this looks as if the build doesn't support the latest kernel version, but if this is so then how has it been built for Debian?


Extra information:

  • The full output here.
Jivings
  • 22,538
  • 11
  • 90
  • 139

2 Answers2

13

Instructions for cross-compiling

  1. Downloaded the driver sources from the Edimax website.

  2. Clone the kernel sources from GitHub.

  3. cd into your kernel source and cd into include/linux. Run

    ln -s smp.h smp_lock.h`.
    
  4. unzip the Edimax download and tar -xzf the driver package. cd into the driver/rtl... subdirectory.

  5. Edit include/rtw_xmit.h and add #include <linux/interrupt.h> under the other includes.

  6. Edit os_dep/osdep_service.c and add

    #include <linux/semaphore.h>
    #define init_MUTEX(sem)         sema_init(sem, 1)
    

    under the other includes.

  7. Edit the Makefile adding

    ifeq ($(CONFIG_PLATFORM_PI), y)
    EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
    ARCH := arm
    CROSS_COMPILE := arm-bcm2708-linux-gnueabi-
    KVER  := 3.1.9-30-ARCH+
    KSRC := ~/pi-sources
    MODDESTDIR := ~/pi-sources/lib/modules/3.1.9-30-ARCH+/kernel/drivers/net/wireless/
    INSTALL_PREFIX :=
    endif
    

under similar sections.

  1. Assuming arm-bcm2708-linux-gnueabi-{gcc|ld} is in your path, run make CONFIG_PLATFORM_PI=y modules.

The module should now be compiled.

Alex Chamberlain
  • 15,530
  • 14
  • 67
  • 113
-1

Try copying the config.gz from /proc/config.gz on your RPi. Then gunzip it and rename it to .config and make as above.

tlhIngan
  • 3,372
  • 5
  • 19
  • 33