Compat-wireless driver on chumby

From Chumby Wiki
Revision as of 00:43, 18 March 2011 by Torin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article describes the process of cross-compiling and install new compat-wireless drivers (kernel modules) on chumby. So far, it is only tested for Chumby One & AzureWave NU137 (ar9217 chipset, ath9k_htc module) on Ubuntu 10.04 dev machine

GNU toolchain

Install arm-linux compiler on your development machine. See GNU Toolchain
Remember to set PATH environment to the toolchain after installation.

Cross-compile chumby linux kernel

Find out which build number is your device by looking at the content of /etc/firmware_build on chumby
Download the corresponding linux kernel source from here
Extract the source somewhere, say /home/user/linux-2.6.28.mx233
Then cross-compile it with GNU toolchain

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

Cross-compile compat-wireless driver

Get the tarball from here. Reading the whole page is recommended
Extract the tarball somewhere, say /home/user/compat-wireless
(Optional) You can select to build only certain drivers instead of the whole compat-wireless package. Read the compat-wireless page for more info.

cd /home/user/compat-wireless
./scripts/driver-select

Remove B43 support by editing drivers/net/wireless/Makefile and removing this line:

obj-$(CONFIG_B43)              += b43/

Cross-compile it

#KLIB and KLIB_BUILD points to your kernel source folder
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- KLIB=/home/user/linux-2.6.28.mx233 KLIB_BUILD=/home/user/linux-2.6.28.mx233

Do not perform this as root! It'll regenerate your initramfs with ARM kernel modules, making your wifi not work at boot. It'll fail just after "grub-mkconfig", which is fine. Do not use 'make install-modules', it doesn't work properly with cross-compilation. You can find out the list of modules being compiled with

find ./ | grep ko$

Pack compat-wireless drivers

Tarball all kernel modules just compiled

find ./ | grep ko$ | xargs tar cvjf wireless-compat_modules.tar.bz2

Copy it to a FAT32 thumbdrive and get it on chumby
If your device requires a firmware, copy it to the thumbdrive as well.

Prepare chumby device

Remount chumby filesystem as read/write

mount -o remount,rw /

Copy new firmware to /lib/firmware (if any)

cp /mnt/usb/firmware_filename.fw /lib/firmware

Edit /lib/udev/rules.d/50-firmware.rules to have this line:

SUBSYSTEM=="compat_firmware", ACTION=="add", RUN+="firmware.sh"

Backup drivers on system

cd /lib/modules/2.6.28-chumby
mv updates old-updates
mkdir updates

Install new drivers

cp /mnt/usb/wireless-compat_modules.tar.bz2 /lib/modules/2.6.28-chumby/updates
cd /lib/modules/2.6.28-chumby/updates
tar -xf wireless-compat_modules.tar.bz2
rm wireless-compat_modules.tar.bz2

Update kernel modules dependencies

depmod -a

Remount filesystem as read-only

mount -o remount,ro /

Reboot

reboot

Revert changes

If you somehow screw up the system, you need to get serial console access to the system to fix it. Remount chumby filesystem as read/write

mount -o remount,rw /

Delete new drivers, get back the old ones

cd /lib/modules/2.6.28-chumby
rm -r updates
mv old-updates updates

Update kernel modules dependencies

depmod -a

Remount filesystem as read-only

mount -o remount,ro /

Reboot

reboot