element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Documents Compiling Linux kernel & staging driver modules
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: fustini
  • Date Created: 20 Apr 2012 4:59 AM Date Created
  • Last Updated Last Updated: 9 Sep 2013 7:09 PM
  • Views 2153 views
  • Likes 0 likes
  • Comments 0 comments
Related
Recommended

Compiling Linux kernel & staging driver modules

UPDATE: I recommend Raspbian "Wheezy" image as most WiFi drivers and firmware are included

 

NOTE: for just the r8712u driver: http://www.element14.com/community/servlet/JiveServlet/download/44948-7-97488/r8712u_ko.zip

 

In the course of testing WiFi adapters, I needed the r8712u kernel module which resides in the staging driver directory of the Linux kernel source in Raspberry Pi's github repo.  Fedora Remix and the 2012-04-19 Arch Linux includes staging drivers, but the Debian image does not (as of 2012-04-19 version).  Thus, I had to cross-compile on my laptop (x86 Ubuntu Linux 11.10) the Linux kernel including all the kernel modules.

 

1) The eLinux wiki has a good guide to cross-compiling the ARM Linux kernel for the Raspberry Pi on whatever your computer is:

 

http://elinux.org/RPi_Kernel_Compilation

 

 

2)  When you get to the step of:

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig

 

There are couple options:

 

a) I ran the command above which asks a very large number of questions, one of which is CONFIG_STAGING.  You'll need to answer 'y' to that one if you want to build the staging drivers (which was my goal).  Also be sure that whatever driver you need is set to either 'y' or 'm'.

 

b) Another option is to copy /proc/config.gz from the Pi running Debian, gunzip it, and save it into your kernel build directory as .config.  Then when you run the above command there will only be a few questions to answer, however you'll need to edit .config to make sure CONFIG

 

 

3) Compile the kernel following the next step in the eLinux wiki instructions.  It will then take some time to compile the kernel depending on how fast your system is.

 

 

4) Now that everything is compiled, we need to be able to create the directory kernel modules that will be copied to the Pi.  We don't want the kernel modules to go to the actual location on our system (if running Linux like me), so instead INSTALL_MOD_PATH specifies where they should go:

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=/tmp/module modules_install

Replace /tmp/ with wherever you want to store the files which will then be later copied to SD card.

 

 

5) Put your SD card with the Debian image in your card reader connected to your computer.  Your computer should mount two partitions: the smaller FAT partition is the "boot" partition and the bigger Linux partition is the where these kernel modules will go.  You should see "/lib" at the root level of the Linux partition:

 

a) Backup "/lib/firmware" and "/lib/modules" directories on the SD card (to something like firmware.orig and modules.orig)

b) Copy the "lib/firmware" and "lib/modules" directories from your INSTALL_MOD_PATH to "/lib/" on the SD card

 

 

6) That takes care of the kernel modues, but we still need to finish preparing the Linux kernel and copy to the boot partition.  The eLinux wiki article descirbes this important step:

 

http://elinux.org/RPi_Kernel_Compilation#Final_step:_Making_the_.27kernel.img.27_for_your_Pi

 

NOTE: I was able to load the staging drivers I compiled on the latest Debian (2012-04-19) without having to copy my compiled kernel, too

 

Finally, I've attached my .config along with /lib/modules and the kernel image that I built on 2012-04-19 from an up-to-date clone of the Linux kernel sources from Raspberry Pi's github.  This new kernel and modules are working ok for me with the Debian 2012-04-13 image.  If you are reading this not too far in the future, then you can probably just download these files and not bother with compiling.

Attachments:
rpi_github_kernel_modules_20120419.zip
rpi_github_kernel_config_20120419.zip
rpi_github_kernel_image_20120419.zip
r8712u_ko.zip
  • wifi
  • raspberry_pi
  • kernel
  • sudo_open
  • linux
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube