Difference between revisions of "Compat-wireless driver on chumby"

From Chumby Wiki
Jump to: navigation, search
(Created page with "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 NU1...")
 
Line 5: Line 5:
 
Install arm-linux compiler on your development machine. See [[GNU Toolchain]]<br>
 
Install arm-linux compiler on your development machine. See [[GNU Toolchain]]<br>
 
Remember to set PATH environment to the toolchain after installation.
 
Remember to set PATH environment to the toolchain after installation.
 +
export PATH="${PATH}:/usr/arm-linux/bin"
 +
or permanently, edit <b>/etc/environment</b> on Ubuntu
  
 
=Cross-compile chumby linux kernel=
 
=Cross-compile chumby linux kernel=
Find out which build number is your device by looking at the content of /etc/firmware_build on chumby<br>
+
Find out which build number is your device by looking at the content of <b>/etc/firmware_build</b> on chumby<br>
Download the corresponding linux kernel source from [http://files.chumby.com/source/ here]<br>
+
Download the corresponding linux kernel source from [http://files.chumby.com/source/]<br>
 
Extract the source somewhere, say /home/user/linux-2.6.28.mx233<br>
 
Extract the source somewhere, say /home/user/linux-2.6.28.mx233<br>
 
Then cross-compile it with GNU toolchain
 
Then cross-compile it with GNU toolchain
Line 14: Line 16:
  
 
=Cross-compile compat-wireless driver=
 
=Cross-compile compat-wireless driver=
Get the tarball from [http://wireless.kernel.org/en/users/Download#Directly_downloading_the_tarball here]. Reading the whole page is recommended<br>
+
Get the compat-wireless tarball from [http://wireless.kernel.org/en/users/Download#Directly_downloading_the_tarball here]. Reading the whole page is recommended<br>
 
Extract the tarball somewhere, say /home/user/compat-wireless<br>
 
Extract the tarball somewhere, say /home/user/compat-wireless<br>
 
(Optional) You can select to build only certain drivers instead of the whole compat-wireless package. Read the compat-wireless page for more info.
 
(Optional) You can select to build only certain drivers instead of the whole compat-wireless package. Read the compat-wireless page for more info.
Line 24: Line 26:
 
  #KLIB and KLIB_BUILD points to your kernel source folder
 
  #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
 
  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.
+
Do not perform this as root!<br>
It'll fail just after "grub-mkconfig", which is fine.
+
It will regenerate your initramfs with ARM kernel modules, making your wifi not work at boot.<br>
 +
It will fail just after "grub-mkconfig", which is fine.<br>
 
Do not use 'make install-modules', it doesn't work properly with cross-compilation.
 
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
+
Check that the desired module presents in the just-compiled modules
 
  find ./ | grep ko$
 
  find ./ | grep ko$
  
 
=Pack compat-wireless drivers=
 
=Pack compat-wireless drivers=
Tarball all kernel modules just compiled
+
Tarball all just-compiled kernel modules
 
  find ./ | grep ko$ | xargs tar cvjf wireless-compat_modules.tar.bz2
 
  find ./ | grep ko$ | xargs tar cvjf wireless-compat_modules.tar.bz2
 
Copy it to a FAT32 thumbdrive and get it on chumby<br>
 
Copy it to a FAT32 thumbdrive and get it on chumby<br>
Line 41: Line 44:
 
Copy new firmware to /lib/firmware (if any)
 
Copy new firmware to /lib/firmware (if any)
 
  cp /mnt/usb/firmware_filename.fw /lib/firmware
 
  cp /mnt/usb/firmware_filename.fw /lib/firmware
Edit /lib/udev/rules.d/50-firmware.rules to have this line:
+
Edit <b>/lib/udev/rules.d/50-firmware.rules</b> to have this line:
 
  SUBSYSTEM=="compat_firmware", ACTION=="add", RUN+="firmware.sh"
 
  SUBSYSTEM=="compat_firmware", ACTION=="add", RUN+="firmware.sh"
 
Backup drivers on system
 
Backup drivers on system
Line 55: Line 58:
 
Update kernel modules dependencies
 
Update kernel modules dependencies
 
  depmod -a
 
  depmod -a
 +
You can check that the module is recognized
 +
modinfo module_name_here
 
Remount filesystem as read-only
 
Remount filesystem as read-only
 
  mount -o remount,ro /
 
  mount -o remount,ro /
Reboot
+
Reboot now! <br>modprobe</b> will not work if you don't reboot.
 
  reboot
 
  reboot
  
 
=Revert changes=
 
=Revert changes=
If you somehow screw up the system, you need to [http://wiki.ladyada.net/chumbyhackerboard/serial get serial console access] to the system to fix it.
+
If you somehow screw up the system, you need to [http://wiki.ladyada.net/chumbyhackerboard/serial get serial console access] to the system to fix it.<br>
 
Remount chumby filesystem as read/write
 
Remount chumby filesystem as read/write
 
  mount -o remount,rw /
 
  mount -o remount,rw /
Line 72: Line 77:
 
Remount filesystem as read-only
 
Remount filesystem as read-only
 
  mount -o remount,ro /
 
  mount -o remount,ro /
Reboot
+
Reboot now! <br>modprobe</b> will not work if you don't reboot.
 
  reboot
 
  reboot

Revision as of 00:56, 18 March 2011

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</b> 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</b> will not work if you don't reboot.

reboot