28 Replies Latest reply on Apr 25, 2012 2:07 AM by Drew Fustini

    Installing Kernel Headers on the Pi?

    GizmoB73

      I have been trying to get my WLAN adapter working on the Pi and it would seem I need to compile the drivers.

       

      From what I can tell though, the kernel headers are not installed.

       

      I have tried

       

      $ sudo apt-get install linux-headers-$(uname -r)

       

      but I just get

       

      E: Unable to locate package linux-headers-3.1.9

      E: Couldn't find any package by regex 'linux-headers-3.1.9'

       

       

      I guess this version is unique to the Pi and what I need is probably in here somewhere:

       

      https://github.com/raspberrypi/linux/tree/2fb814968753d0d4a5fdf056a3a8c9eee3c41aa6

       

      But as a linux noob, I have no idea what I need, or what to do with it?

       

      I think there are already others with the same problem and I guess there will be many more soon.

       

      Could anyone provide a "Noddy" guide on this?

       

      Thanks

       

      Gary

        • Re: Installing Kernel Headers on the Pi?
          Drew Fustini

          Hi Gary,

           

          Good to see you over here (oh, just realized your a roadtester which makes sense why your nick looked familiar to me in that RPi.org thread).  I've been trying to get wi-fi working as well.  I think the trouble is that the debian 6 armel repo isn't aware that the RPi kernel is v3.1.9.  Typically in Linux, the packing system would be able to install the kernel source and headers for the version you're running.  The other problem is that the Debian image from Feb-17 doesn't seem to include any of the wireless kernel modules.

           

          Interesting that you give the URL https://github.com/raspberrypi/linux/tree/2fb814968753d0d4a5fdf056a3a8c9eee3c41aa6.  I wonder if that was my problem.  I was using https://github.com/raspberrypi/linux.gitper instructions from David Singleton:

           

          https://sites.google.com/a/davidsingleton.org/www2/home/stuff-i-had-to-do-to-get-raspberry-pi-debian-image-working

           

          Anyways, the modules I built wouldn't load into the kernel as I posted in:

           

          http://www.raspberrypi.org/forum/distributions/debian-arm-on-raspberry-pi/page-6#p63616

           

          However, pepedog wisely pointed out that the binary kernel modules are available the raspberrypi firmware repo on github:

           

          https://github.com/raspberrypi/linux/blob/rpi-patches/arch/arm/configs/bcmrpi_defconfig

           

          I'm going to give it shot with the modules and boot directories from there.  I'll be very interested to hear how you progress as well.  Hopefully, the early wi-fi efforts can lead to better documentation or even new Debian image which includes the needed wireless modules.

           

          Cheers,

          Drew

            • Re: Installing Kernel Headers on the Pi?
              GizmoB73

              Thanks for the reply Drew.

               

              Interesting link on the David Singleton stuff, looks like he is doing much of the same stuff as me, although I didn't have any issues with the networking, it just worked.

               

              Unfortunately I have been a DOS and Windows developer and Windows Mobile for the last several years so the Linux stuff is a steep learning curve.

               

              To be honest the comments from pepedog were not "Noddy" enough for my Linux skills at present, so I am spending a lot of time reading articles on Linux at present.  It is a little frustrating as I want to be doing more project stuff, but it is also an invaluable learning experience.

               

              I wouldn't even know what a Raspberry Pi kernel module looks like at present but I am sure I will get there in the end.

               

              I look forward to hearing back on your progress.

               

              Cheers

               

              Gary

                • Re: Installing Kernel Headers on the Pi?
                  Drew Fustini

                  So I copied the modules and boot from github raspberry firmware repo to /boot and /lib/modules on the Debian image.  However, now the Pi won't boot anymore (hangs right after Pi logo).

                   

                  But lo and behold I tried Fedora Remix and it has all the wireless kernel modules in /lib/modules!  It loaded the rtl8187 and r8712u ok for the adapters I have.  I'm still trying to figure out how to configure for WPA2 network, but encouraged that the kernel recognized and loaded the drivers.

                   

                  On the downside, the Fedora Remix image seems to hate the usb hub I'm using, so it's a choice of 2 of 3 (kb, mouse, wifi) at a time.  Though I've ssh'd into it from my workstation so the kb/mouse is not really an issue right now.

                    • Re: Installing Kernel Headers on the Pi?
                      Drew Fustini

                      Turned out it worked without a hitch on Fedora.  In LXDE, I opened up the NetworkManager applet in the lower right hand side and selected the SSID of AP.  For my first test, I had configured the AP just for WEP.  I'll test with WPA2 next, but very encouraged that it associated ok with WEP.  This was with an Asus 802.11n adapter using the r8712u driver.  I have a couple more adapters I'll check soon too.

                       

                      Again, the only problem I've encountered with Fedora is with USB hub.  The keyboard also has an integrated hub so what I ended up doing is plugging the keyboard and adapter directly and connected mouse via keyboard only when I need it.  With mouse attached, I often get erratic keyboard input which can be frustrating for things like password entry.  When booting up and logging in, just have the keyboard and mouse connected directly to Pi.  After further WiFi testing, I think I'll turn an eye to researching this issue.

                        • Re: Installing Kernel Headers on the Pi?
                          Drew Fustini

                          Groovy there is a new debian image and OmerK reports that his wifi adapter worked:

                           

                          http://omer.me/2012/04/setting-up-wireless-networks-under-debian-on-raspberry-pi/

                           

                          I just downloaded the image and going to mount and check /lib/modules.  I'll give a try on the Pi tomorrow.

                            • Re: Installing Kernel Headers on the Pi?
                              Drew Fustini

                              FYI - I've created a document to report on the adapters I've tested:

                               

                              http://www.element14.com/community/docs/DOC-44703

                                • Re: Installing Kernel Headers on the Pi?
                                  GizmoB73

                                  Thanks Drew,

                                   

                                  Interesting findings and I am glad I am not alone in having an uphill struggle with Wi-Fi.

                                   

                                  Gary

                                    • Re: Installing Kernel Headers on the Pi?
                                      Drew Fustini

                                      Hi - yeah, it'll be a bit rough going I think until all the different devices and drivers get tested out.  I saw your RPi.org post but didn't get chance to respond yet.  I should have another adapter later today which the latest Debian should support.  So at that point I'll have to have my hand at the wpa supplicant configuration.  In Fedora, NetworkManager and the nm-applet are installed so wireless configuration is very friendly (aside from the horrible USB hub behavior [unrelated to WiFi]).

                                       

                                      And going back to the cross-compiled kernel module issues, I really am keen to figure that out and get the r8712u driver (for those two 802.11n adapters) working on Debian now that I know that it does work ok on the Raspberry Pi's ARM architecture (with Fedora Remix's lovely complete /lib/modules directory).

                                        • Re: Installing Kernel Headers on the Pi?
                                          GizmoB73

                                          I made some ground with my ZyXEL NWD2105 and this is supposed to be officially supported in "firmware-ralink".  I struggled initially with the WPA, but then installed wicd which improved things.  I even managed to get a connection and negotiate a DHCP address with my access point... once.

                                           

                                          It seems I get loads of lock-ups and frequent kernel panics with this adapter, often the Pi won't boot up if the adapter in installed at power-on, but sometimes it does.

                                           

                                          I will try again with the other adapter, which will require the compilation stuff, but might give up soon as I have spent days on this and I'm going nowhere fast.

                                            • Re: Installing Kernel Headers on the Pi?
                                              Drew Fustini

                                              That's good to know about wicd as I had been thinking of using that, too.  But sorry to hear it has been unstable.  That device uses the rt2800usb driver, right?  Have you seen any error messages before the lock up?

                                               

                                              Last night, I tried a RTL8187-based Trendnet TEW-424UB 802.11g adapter.  I had hoped it would work as the RTL8187 driver is in the Debian image and JamesH commented on RPi.org that he got a Netgear adapter with that chipset to work.  However, it failed to work just like the RTL8187-based BlueProton BT3.  I see many errors in kernel log in both latest Debian and Fedora after inserting either of these RTL8187-based adapters (updated my testing doc with those).  This makes me think there is an issue with the driver on the Pi's ARM kernel.

                                               

                                              Anyway, now I am motivated to figure out how to get the r8712u driver working in Debian as both the IOGear GWU625 and Asus USB-N10 worked ok in Fedora with that driver.  So back to the task of cross-compilation and kernel module loading attempts

                                               

                                              Let me know how you fair with the other adapter you mentioned.

                                               

                                              Thanks,

                                              Drew

                            • Re: Installing Kernel Headers on the Pi?
                              GizmoB73

                              Well I might have been a bit harsh about blaming the lock-ups and kernel panics on the adapters.

                               

                              It seems that those problems were due to me having a low voltage on the Pi.  When I check the voltage across TP1 and TP2 I was getting about 3.9V.  I don't know how this was still running, but adding a USB WLAN adapter and powering it up was obvioulsy a step too far.

                               

                              I tracked the problem down to my powered hub.  I have a decent 3A PSU on it, but the hub it cheap.  The soldering was poor and the tracks a bit too thin to deliver the current required by the Pi.  After a bit of soldering a some extra wire, the voltage cam up to 4.81V.  Not fantastic, but should be OK.  I will be looking for other options to improve it further.

                               

                              For now I have used a separate PSU for the Pi so that it is definitely running at a respectable 5.1v now.

                               

                              I have retested both adapters and I get the same results but without the lock-ups and kernel panics.  It is still not working, but stable, and therefore a lot less frustrating.

                               

                              Out of desparation, I am going to try the squeeze-backports of the two firmware packages, just to see if it will make any difference.

                                • Re: Installing Kernel Headers on the Pi?
                                  Drew Fustini

                                  Ah, very interesting to know.  Darn power supplies always causing trouble.

                                   

                                  So now that it is stable, do you still have the problem:

                                   

                                  I even managed to get a connection and negotiate a DHCP address with my access point... once.

                                   

                                  Is there error next time you try to reconnect?

                                   

                                  Good luck with backports.

                                    • Re: Installing Kernel Headers on the Pi?
                                      GizmoB73

                                      I haven't been able to get the wireless to reconnect again.  I was running with two separate supplies to get my 5V on the Pi but it is a nuisance because of the backfeed from the hubs uplink connection.  It makes it very fiddly when you need to pull the power.

                                       

                                      I will probably start again from scratch with a clean debian image soon.

                                       

                                      When running from a single supply into my hub, I am still getting around 4.81v.  This is probably enough, but as the cut-off is 4.75V it is a bit too close for comfort.  I don't want to be wasting any more time because of low voltage, so I need to make up some cables to use some other bits I have laying around here as PSU solution.

                                       

                                      Will have to try again soon.

                                        • Re: Installing Kernel Headers on the Pi?
                                          Drew Fustini

                                          Thanks for the heads up. I've wondered if power is an issue for me, too.  I'm going to bring a couple different micro usb chargers tomorrow in case that helps.

                                           

                                          What test points are you using to take that reading - on the power adapter or directly on the Pi?  I'm also considering hooking up a bench supply so I know exactly what the output is.

                                           

                                          However, I'm thinking the rtl8187 adapter issue probably isn't with power unless power varies alot between WiFi adapters.  I did today get another adapter to work in that Debian image: 148f:2573 Ralink Technology, Corp. RT2501/RT2573 Wireless Adapter (from lsusb).  It was just good luck as my friend happened to have this old no-name adapter.  Nice to be able to constrast the failing adapters against a working one now.

                                           

                                          Cheers,

                                          Drew

                                            • Re: Installing Kernel Headers on the Pi?
                                              GizmoB73

                                              Good to hear that you have got one working at least.  This seems to be quite a lottery, even if the adapters appear to be supported in the firmware packages.

                                               

                                              For voltage measurement I was using TP1 and TP2 on the Pi board itself, although for ease of access I have fitted my "Slice Of Pi" GPIO board which gives good access to the Gnd, 3v3 and 5v0 points.

                                               

                                              Cheers

                                               

                                              Gary

                                                • Re: Installing Kernel Headers on the Pi?
                                                  Drew Fustini

                                                  Ah, cool that you have that board.  I remember seeing it when looking at the eLinux wiki.  I did bring a DMM today, couple different USB power adapters including a 2.1A, different micro USB cables, and different keyboards.  Hoping to rule out power issues for the smsc kernel errors with RTL8187 adapters attached.

                                                   

                                                  BTW, I've found WikiDevi very useful in tracking down different revisions of a given adapter for example:

                                                   

                                                  http://www.wikidevi.com/wiki/TRENDnet_TEW-424UB_v1

                                                   

                                                  I gave another shot at cross compiling last night.  There is additional instructions on http://elinux.org/Rpi_kernel_compilation now as to how to create the kernel image for the boot partition. Today, I'm going to copy that new kernel image and the new /lib/modules to my Debian 2012-04-13 SD card and try to boot.  Also, the driver I'm after right now is r8712u which also required my to add CONFIG_STAGING (iirc) to 'y' in kernel config.

                                                   

                                                  If I can get over the hump of getting a kernel and modules I've compiled to work, then I think the drivers issue will be much less.

                                                    • Re: Installing Kernel Headers on the Pi?
                                                      GizmoB73

                                                      Good stuff with the kernel compilation, presuambly that will give the missing kernel headers...

                                                       

                                                      I have started fresh now.

                                                       

                                                      New debian image, clean power supply and my hub appears to have died... oh well it was cheap anyway.

                                                       

                                                      Good news is... i have managed to get Wi-Fi workign properly now! Woo Hoo!

                                                       

                                                      I am using the ZyXEL NWD2105 and using the drivers from: $ sudo aptitude -t squeeze-backports install firmware-realtek

                                                       

                                                      I then installed wicd.

                                                       

                                                      Popped into LXDE to configure wicd with my WPA PSK and set to default, then chose "Connect" and it worked!

                                                       

                                                      Unplugged the Ethernet cable, rebooted and away it goes. Superb.

                                                       

                                                      It does take a few seconds after a reboot before it picks up the wifi network but still, that's fine with me.

                                                       

                                                      I did notice a couple of glitches on my keyboard now.  This could be interference as it is a Logitech k400 2.4GHz wireless jobby, but according to the specs, the NWD2105 can take 300mA while transmitting and 160mA receiving, so it is probably close to the limit on the polyfuses.  What I really need now is a powered hub...

                                                        • Re: Installing Kernel Headers on the Pi?
                                                          Drew Fustini

                                                          That's great to hear!  I'm tempted to pick one up.  Could you paste the USB ID from lsusb?

                                                           

                                                          Interesting notes on the current consumption during RX and TX.  I'm still trying to fully understand the power situation on the Pi.  Looking back at PeteL's Q & A (http://www.raspberrypi.org/archives/837), he stated "The fuses kick in hard around 280mA and fold back and limit to 140mA."  So I'm wondering what happens if a WiFi adapter tries to try 300mA.

                                                           

                                                          Thanks,

                                                          Drew

                                                            • Re: Installing Kernel Headers on the Pi?
                                                              Drew Fustini

                                                              BTW, I finally got my own kernel to boot and got the r8712u driver loaded   Here's instructions I followed: http://www.element14.com/community/docs/DOC-44948/l/compiling-linux-kernel-staging-driver-modules

                                                                • Re: Installing Kernel Headers on the Pi?
                                                                  GizmoB73

                                                                  That's great news on the compilation, well done.  I will have to see if I can follow the instructions myself now.

                                                                   

                                                                  As for the ZyXEL WiFi, from a power perspective, it really does need to be run from a powered hub and I think.  The Pi feels like it is really straining to keep things running.  I added a basic 4 port non-powered hub just to see if I could put some distance between the WiFi and my Logitech receiver and the extra power taken by the non-powered hub, tipped it over the edge.

                                                                   

                                                                  The output from lsusb for the ZyXEL NWD2105 is:

                                                                  Bus 001 Device 004: ID 0586:341e ZyXEL Communications Corp.

                                                                   

                                                                  Here is where I got mine from:

                                                                   

                                                                  http://www.ebuyer.com/237221-zyxel-nwd2105-wireless-n150-micro-usb-adapter-91-005-353001b

                                                                   

                                                                  It is not as small as the Edimax EW7811Un, but at least it is working without compiling the drivers.

                                                                   

                                                                  Cheers

                                                                   

                                                                  Gary

                                                                    • Re: Installing Kernel Headers on the Pi?
                                                                      Drew Fustini

                                                                      That's a nice find - pretty cheap on Amazon, too.  Looks like this is it's entry on WikiDevi: http://wikidevi.com/wiki/ZyXEL_NWD2105.  You should add to the eLinux wiki page: http://elinux.org/RPi_VerifiedPeripherals#USB_WiFi_Adapters

                                                                       

                                                                      Interesting to hear your feedback on powered hub.  I'm still trying to figure if the RTL8187 adapter problem is power or driver related.  But at least got two working ones now with the r8712u driver

                                                                       

                                                                      BTW, on that document I created, I attached the kernel image and /lib/modules zip archive which you should be able to use if the driver you need is in the raspberrypi github v3.1.9+ kernel source.

                                                                        • Re: Installing Kernel Headers on the Pi?
                                                                          GizmoB73

                                                                          Thanks Drew,

                                                                           

                                                                          I have downloaded the source but havn't had time to do any digging around with it yet.

                                                                           

                                                                          I bought a new powered hub to replace the one that went pop.  I got a small 4-port Belkin hub.  It came with a 2.5 Amp PSU but I am not using that.  I have my own supply which I am using with a Y lead and that seems to give me a consistent 5v on the Pi, whereas using the Belkin PSU with the Pi power coming from the hub seemed to dip down to 4.8v again.

                                                                           

                                                                          Another discovery I have made which could be quite important, is that I cannot get the ZyXEL adapter to work when running through an external hub. It is recognised by lsusb, but dmesg throws up all sorts of DEBUG errors and hangs the system.  As soon as I put it in one of the Pi USB ports, it works a treat.

                                                                           

                                                                          This seems to work fine now though, because the Belkin Hub is running everything else fine, and no stability issues so far.

                                                                           

                                                                          I might re-visit the Edimax adapter with it plugged directly into the Pi.

                                                                           

                                                                          Have you noticed anything like this?  Do your WiFi adapters work when plugged into an external hub?

                                                                            • Re: Installing Kernel Headers on the Pi?
                                                                              Drew Fustini

                                                                              I believe the two I have working so far (with r8712u driver) do work from the external hub... but my memory is a little clouded by my ongoing attempts with other adapters.  I'll test to see tomorrow.  Interesting to hear about your setup - offloading everything else to the hub.

                                                                               

                                                                              FYI - user ajtag looks to have gotten rtl8192cu working:

                                                                               

                                                                              http://www.raspberrypi.org/forum/troubleshooting/trying-to-get-an-rtl8188cus-wireless-usb-nic-working

                                                                               

                                                                              I think that is what you need for your other adapter, right?

                                                                                • Re: Installing Kernel Headers on the Pi?
                                                                                  Drew Fustini

                                                                                  Well, thanks for asking that question about the hub!  So I noticed that Asus N10, Asus N13 and IOGear GWU625 all worked ok from the hub but only if the keyboard was plugged into the Pi directly and not the hub.  When keyboard was in hub, too, I would get smsc95xx register error in kernel log.  Rather odd I thought, and my TP1/TP2 voltage is stable at 5.15V throughout.

                                                                                   

                                                                                  So I happened to check what would happen with no keyboard and just SSH.  Well, low and behold, my RTL8187-based Trendnet TEW-424UB started working!  There were only the same model Levono kb (04b3:301b IBM Corp. SK-8815 Keyboard) in the office, but I did have an old PS/2 keyboard with a PS/2 to USB converter (09ae:0002 Tripplite B015-000B015-000 R0.74 USB to PS2 adapter).  The RTL8187 driver kept working with that kb plugged in.  Goodness gracious - not sure why I waited so long to try another keyboard!

                                                                                    • Re: Installing Kernel Headers on the Pi?
                                                                                      GizmoB73

                                                                                      Thanks for the heads-up on the 8192cu.  Looks like he has included the drivers he compiled too.  I will give them a try when I get a chance, but looking at some other stuff at present.

                                                                                       

                                                                                      Looks like the new debian image on the .org website now includes the kernel headers, so in theory I should be able to compile my own now too.

                                                                                       

                                                                                      So much to try and do and so little spare time...

                                                                                       

                                                                                      Interesting about your results with the hub and keyboards.  I am not sure what the pattern is, but it suggests that there is still plenty of trail and error.

                                                                                        • Re: Installing Kernel Headers on the Pi?
                                                                                          Drew Fustini

                                                                                          You're right about trial and error!  I had been testing with Debian from the console via wicd-curses.  I finally & launched LXDE today and attached a mouse to discover my IOGear GWU625 wifi adapter (r8712u driver) stopped working and smsc95xx register read/write errors started occurring.  I've tried two different wired USB mice and different permutations of connections, via powered hub and also direct.  Regardless, wifi adapter fails when all 3 (kb, mouse, wifi) are connected.

                                                                                           

                                                                                          For LXDE in Debian, you were using ZyXEL plugged in directly with keyboard & mouse connected to unpowered hub, right?