4. Get the module source
# You should still be root after the chroot command cd / git clone git://gitorious.org/hid-aureal-kernel-module/hid-aureal-kernel-module.git
5. Prep for adding a new module
Copy the module source into the driver directory. I decided to put in it in the directory that seemed to be similar. Note the use of the wildcard in “raspberrypi-linux*”. The trailing letters seem to change occassionally.
cd raspberrypi-linux-*/drivers/hid/usbhid/ cp /hid-aureal-kernel-module/aureal-id.h . cp /hid-aureal-kernel-module/hid-aureal.c .
Edit the kernel configuration to include this new module.
Under these lines:
comment "USB Input Devices" depends on USB
Add the following text
config HID_AUREAL tristate "Aureal fix" default m help Aureal fix
Edit the Makefile
At the end of the file add:
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
6. Configure kernel
# The following needs to be done once apt-get install libncurses5-dev # Start the configuration menu cd /raspberrypi-linux-* make ARCH=arm menuconfig
You will be given a menu selection with a bunch of options. Go to “Device Drivers” -> “HID Devices”. You should see an “M” next to “Aureal fix”.
Select “USB Human Interface Device (full HID) support” and hit the “m” key so that “M” is shown next to this option also.
Exit out of the menu and make sure to save the configuration.
I’ve uploaded a modified version of the build script that will rebuild the kernel and regenerate the output.
cd / wget http://kaytat.com/rebuild.sh sh rebuild.sh
8. Install the new kernel onto the rpi
Copy the output to the pi using scp
# You should still be root after the chroot command cd / scp kernel-*.gz email@example.com:/home/pi
You will need to modify 192.168.3.14 to the IP address of the rpi. This command will ask for a password. It’s “raspberry”.
SSH into the pi and install. I use Putty for SSH. The username is pi and password is the same as above. Then run:
sudo -s cd / tar -xzf /home/pi/kernel-rootfs-latest-hardfp.tar.gz cd boot tar -xzf /home/pi/kernel-vfat-latest-hardfp.tar.gz nano /etc/rc.local
Near the very end, just before “exit 0” add the following lines:
/sbin/rmmod usbhid || true /sbin/modprobe hid-aureal || true /sbin/modprobe usbhid || true
The “|| true” is necessary due to the -e switch in #!/bin/sh. Save the file and then reboot. This is actually the main part of this whole exercise. I did all this so that I could make kernel modules and then be able to unload them, and then reload them in the proper order.
That should be it.
On the pi, run
You should see
aureal 0003:0755:2626.0001: fixing Aureal Cy se W-01RN USB_V3.1 report descriptor. Keyboard Logical Maximum = 101
The key is the “fixing” part since that word comes from the module we built.
Raspbmc was straightforward to install. The issue I had was with the remote control. I have a cheapo MCE remote with a USB IR receiver and I was hoping it would work straight out of the box, but alas it didn’t.
Edit: Here’s the remote: http://wiki.xbmc.org/index.php?title=Remote_Control_Reviews#IRF_Media_W-01RN
At first I thought it was the weird mouse pointer/arrow mode blue button, but after some trial and error, I realized that wasn’t it.
After a little digging, I found a solution for Linux: http://club.dx.com/forums/Forums.dx/threadid.624377
I verified the solution on my Ubuntu box by cloning the git repository locally (http://gitorious.org/hid-aureal-kernel-module), rebuilding the module, installing it, and executing those modprobe commands.
I figured it would be just as easy on raspbmc, but unfortunately, the headers for the rpi kernel (3.1.9+) aren’t published in the regular repository. I think raspbmc is based on rasbian (http://www.raspbian.org/). It didn’t make sense to try and mix-and-match headers, so I decided to rebuild the kernel from scratch.
I had never rebuilt a kernel from scrach, or used that fancy “make menuconfig”, or chroot so I thought I’d give it a shot. The rpi is made for tinkering, right?
Luckily, the entire process is fairly well documented on the raspbmc site (http://www.raspbmc.com/wiki/technical/kernel/) but I just wanted to share my step-by-step process.
1. Start with a regular Ubuntu box
The kernel build procedure for raspbmc uses a cross-compiler so it builds a lot faster than building it on the rpi itself. I didn’t time the full compilation process, but I think it’s on the order of 10’s of minutes, not hours.
I don’t remember if I had to install any extra packages before building, but just in case, I would suggest at least this:
sudo apt-get install build-essential
2. Get the build filesystem
The instructions are here: http://www.raspbmc.com/wiki/technical/build-filesystem/
My ubuntu commands were something like:
cd ~ wget http://download.raspbmc.com/downloads/source/filesystem/buildfs-bcm_rootfs-raspbmc-i386_cross_r2-hardfp.tar.gz mkdir target cd target sudo tar -xzf ../buildfs-bcm_rootfs-raspbmc* cd .. sudo cp /etc/network/interfaces target/etc/network/interfaces sudo cp /etc/resolv.conf target/etc/resolv.conf sudo mount proc -t proc target/proc sudo chroot target/
3. Get the kernel source and build … all in one go!
A script exists to do all this at once.
# At this point, you should be in the new root file system, as root wget http://svn.stmlabs.com/svn/raspbmc/testing/kernel/build_kernel.sh sh build_kernel.sh 4
This downloads the latest kernel source, applies the raspbmc specific patches, and rebuilds. I got a bunch of these errors at the end, but I think they can be ignored:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_COLLATE = "C", LC_NUMERIC = "C", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
If this works, congrats, you’ve built a Linux kernel. Nice.
To be continued … (get module source, create menconfig entry, change usbhid from built-in to module, add new module, rebuild, upgrade pi, edit rc.local to rmmod and then modprobe)