Compat-wireless driver on chumby

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

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.

export PATH="${PATH}:/usr/arm-linux/bin"

or permanently, edit /etc/environment on Ubuntu

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 [1]
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 compat-wireless 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 will regenerate your initramfs with ARM kernel modules, making your wifi not work at boot.
It will fail just after "grub-mkconfig", which is fine.
Do not use 'make install-modules', it doesn't work properly with cross-compilation. Check that the desired module presents in the just-compiled modules

find ./ | grep ko$

Pack compat-wireless drivers

Tarball all just-compiled kernel modules

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

You can check that the module is recognized

modinfo module_name_here

Remount filesystem as read-only

mount -o remount,ro /

Reboot now! modprobe will not work if you don't 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 now! modprobe will not work if you don't reboot.

reboot