Difference between revisions of "Hacking Linux for chumby"

From Chumby Wiki
Jump to: navigation, search
(Ironforge)
(Building and Installing a new Silvermoon chumby kernel)
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=Existing Software=
+
==Existing Software==
 
See existing [[Chumby Software Applications, Scripts and Tools]] already on your Chumby stock linux distro.
 
See existing [[Chumby Software Applications, Scripts and Tools]] already on your Chumby stock linux distro.
  
=Alpha Prototype=
+
==Building and Installing a new Silvermoon chumby kernel==
 +
 
 +
===Building the silvermoon/opus 1.8.1 kernel===
 +
 
 +
====Installing the toolchain====
 +
 
 +
First, install the [[GNU Toolchain]] (gcc 4.3.2)
 +
 
 +
====Build the kernel====
 +
 
 +
The following instructions will compile the Linux 2.6.28 kernel shipped with chumby silvermoon/opus firmware version 1.8.1:
 +
 
 +
mkdir kernel
 +
cd kernel
 +
wget http://files.chumby.com/source/silvermoon/silvermoon-1.8.1/linux-2.6.28.tgz
 +
tar zxvf linux-2.6.28.tgz
 +
cd linux-2.6.28
 +
ARCH=arm CROSS_COMPILE=arm-linux- make
 +
* Once the build completes, remount your root partition on your silvermoon unit read/write via:
 +
{{Command|mount -oremount,rw /}}
 +
* Copy the freshly built kernel from '''arch/arm/boot/zImage''' on your build system to '''/boot/vmlinuz''' on the target silvermoon device
 +
* run '''sync''' on the target silvermoon device, then '''reboot'''
 +
 
 +
===Building the silvermoon 1.0.3 kernel===
 +
 
 +
====Installing the toolchain====
 +
 
 +
First, install the [[GNU Toolchain]] (gcc 4.3.2)
 +
 
 +
====Build the kernel====
 +
 
 +
The following instructions will compile the Linux 2.6.28 kernel shipped with chumby silvermoon firmware version 1.0.3:
 +
 
 +
mkdir kernel
 +
cd kernel
 +
wget http://files.chumby.com/source/silvermoon/silvermoon-1.0.3/linux-2.6.28-silvermoon-1.0.3.tar.gz
 +
tar zxvf linux-2.6.28-silvermoon-1.0.3.tar.gz
 +
cd linux-2.6.28-silvermoon-1.0.3
 +
ARCH=arm CROSS_COMPILE=arm-linux- make
 +
* Once the build completes, remount your root partition on your Silvermoon unit read/write via:
 +
{{Command|mount -oremount,rw /}}
 +
* Copy the freshly built kernel from '''arch/arm/boot/zImage''' on your build system to '''/boot/vmlinuz''' on the target silvermoon device
 +
* run '''sync''' on the target silvermoon device, then '''reboot'''
 +
 
 +
==Building and installing a new chumby One kernel==
 +
 
 +
#Install an ARM Linux toolchain, such as the 4.3.2 [[GNU Toolchain]]
 +
#Download [http://files.chumby.com/source/falconwing/build2370/linux-2.6.28.mx233.tgz]
 +
#Configure the kernel as you like, by running **make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig**
 +
#*The CROSS_COMPILE= arguments may vary depending on your toolchain's prefix.  Code Sourcery uses arm-none-linux-gnueabi- by default, but arm-linux- has also been used in the past
 +
#Compile the kernel by running **make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-**
 +
#Install modules to a local directory by running **INSTALL_MOD_PATH=[path-to-temp-rfs] make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules_install**
 +
#Copy the contents of your temp RFS to / on the chumby.  This should end up putting new files in /lib/modules
 +
#Copy arch/arm/boot/zImage to the chumby, somewhere temporary like /mnt/storage/
 +
#Determine which RFS you're in.  If /proc/cmdline contains "root=/dev/mmcblk0p2" you're in rfsA.  If it contains "root=/dev/mmcblk0p3", you're in rfsB.
 +
#Write the new kernel.  Use krnA if you're in rfsA, and krnB if you're in rfsB:
 +
config_util --cmd=putblock --dev=/dev/mmcblk0p1 --block=krnA < /mnt/storage/zImage
 +
 
 +
 
 +
==Building and Installing a new Classic chumby kernel==
 +
 
 +
===Building the chumby 1.7 kernel===
 +
 
 +
====Installing the toolchain====
 +
 
 +
First, install the [[GNU Toolchain]] (gcc 4.3.2)
 +
 
 +
====Build the kernel====
 +
 
 +
The following instructions will compile the Linux 2.6.16 kernel shipped with chumby firmware version 1.7:
 +
 
 +
mkdir kernel
 +
cd kernel
 +
wget http://files.chumby.com/source/ironforge/build396/align.pl
 +
wget http://files.chumby.com/source/ironforge/build1.7.1649/linux-2.6.16-chumby-1.7.0.tar.gz
 +
tar zxvf linux-2.6.16-chumby-1.7.0.tar.gz
 +
cd linux-2.6.16-chumby-1.7.0
 +
ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make
 +
perl ../align.pl arch/arm/boot/zImage
 +
zip k1.bin.zip arch/arm/boot/zImage
 +
 
 +
 
 +
===Building the chumby 1.6 kernel===
 +
 
 +
====Installing the toolchain====
 +
 
 +
First, install the [http://wiki.chumby.com/mediawiki/index.php/GNU_Toolchain#GCC_4.1.2b GCC 4.1.2b toolchain]
 +
 
 +
====Build the kernel====
 +
 
 +
The following instructions will compile the Linux 2.6.16 kernel shipped with chumby firmware version 1.6:
 +
 
 +
mkdir kernel
 +
cd kernel
 +
wget http://files.chumby.com/source/ironforge/build396/align.pl
 +
wget http://files.chumby.com/source/ironforge/build733/linux-2.6.16-chumby-1.6.0.tar.gz
 +
tar zxvf linux-2.6.16-chumby-1.6.0.tar.gz
 +
cd linux-2.6.16-chumby-1.6.0
 +
ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make
 +
perl ../align.pl arch/arm/boot/zImage
 +
zip k1.bin.zip arch/arm/boot/zImage
 +
 
 +
 
 +
 
 +
===Building the chumby 1.5 kernel===
 +
 
 +
====Installing the toolchain====
 +
 
 +
First, install the [http://wiki.chumby.com/mediawiki/index.php/GNU_Toolchain#GCC_4.1.2b GCC 4.1.2b toolchain]
 +
 
 +
====Build the kernel====
 +
 
 +
The following instructions will compile the Linux 2.6.16 kernel shipped with chumby firmware version 1.5:
 +
 
 +
mkdir kernel
 +
cd kernel
 +
wget http://files.chumby.com/source/ironforge/build396/align.pl
 +
wget http://files.chumby.com/source/ironforge/build565/linux-2.6.16-chumby-1.5.0.tar.gz
 +
tar zxvf linux-2.6.16-chumby-1.5.0.tar.gz
 +
cd linux-2.6.16-chumby-1.5.0
 +
ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make
 +
perl ../align.pl arch/arm/boot/zImage
 +
zip k1.bin.zip arch/arm/boot/zImage
 +
 
 +
Be sure you build with the correct toolchain!
 +
 
 +
===Installing the kernel image===
 +
 
 +
* create an '''update2''' directory on the root of a USB storage drive
 +
* copy '''k1.bin.zip''' to the '''update2''' directory on the USB storage drive
 +
* insert the USB storage drive into chumby
 +
* hold the touch screen down and power on the chumby (keep holding the screen for 5 seconds)
 +
* once the device has booted into special options mode, click '''Install updates'''
 +
* click '''Install from USB flash drive'''
 +
 
 +
 
 +
==Building the Wi-Fi driver==
 +
 
 +
{{Note| This assumes you've built the chumby 1.7 linux kernel.}}
 +
 
 +
If you've followed the steps above to build the chumby 1.7 linux kernel, you should be able to build the Ralink rt73 driver by doing the following:
 +
 
 +
cd kernel
 +
wget http://files.chumby.com/source/ironforge/build1.7.1649/rt73-chumby-1.7.0.tar.gz
 +
tar zxvf rt73-chumby-1.7.0.tar.gz
 +
cd rt73-chumby-1.7.0/Module/
 +
make ARCH=arm CROSS_COMPILE=arm-linux- KERNDIR=../../linux-2.6.16-chumby-1.7.0 arm
 +
 
 +
<br/><br/><br/>
 +
 
 +
==DEPRECATED==
 +
===Alpha Prototype===
 
The Alpha Prototype chumby runs a modified linux 2.4.20 kernel.
 
The Alpha Prototype chumby runs a modified linux 2.4.20 kernel.
  
Line 21: Line 172:
 
If all goes well, you should end up with an uncompressed kernel image at arch/arm/boot/Image.
 
If all goes well, you should end up with an uncompressed kernel image at arch/arm/boot/Image.
  
=Ironforge=
+
===Ironforge===
 
The "Ironforge" production chumby runs Linux 2.6.16 kernel.
 
The "Ironforge" production chumby runs Linux 2.6.16 kernel.
  
Line 84: Line 235:
 
drivers/mfd/chumby-tsc2100.ko
 
drivers/mfd/chumby-tsc2100.ko
 
</pre>
 
</pre>
 
 
== Flashing the Kernel ==
 
 
 
Directions provided by Bunnie in the forum: [http://forum.chumby.com/viewtopic.php?id=828]
 
 
<pre>
 
If you want to reflash the kernel image, the quickest way to do it is to take the zImage file,
 
zip it, and copy it to a VFAT formatted USB disk, and put it in a directory called "update2" by
 
the name of k1.bin.zip. Even though zImage is already compressed, you need to zip it again because
 
of the way the firmware updater works.
 
 
Then, power on the chumby while pressing the touchscreen, and continue pressing it until you get
 
into special options. Select the menu option to update the chumby, and then select update via USB.
 
This will take the kernel image on the USB disk and flash it into the device.
 
 
You can completely destroy the k1.bin.zip image and recover from this, because this update mechanism
 
uses its own copy of the kernel that is unaffected by the update to k1.bin.zip.
 
 
If you want to add more apps, you need to build a cramfs filesystem, and use a similar procedure
 
but name the resulting cramfs binary image rfs1.bin.zip, also stuck in the update2/ directory on
 
the USB drive.
 
</pre>
 
 
=Building and Installing a new chumby v1.2 kernel=
 
 
==Building the kernel==
 
 
The following instructions will compile the Linux 2.6.16 kernel shipped with chumby firmware version 1.2:
 
 
mkdir kernel
 
cd kernel
 
wget http://files.chumby.com/source/ironforge/build396/align.pl
 
wget http://files.chumby.com/source/ironforge/build396/linux-2.6.16-chumby-1.2.tar.gz
 
tar zxvf linux-2.6.16-chumby-1.2.tar.gz
 
cd linux-2.6.16
 
ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make
 
perl ../align.pl arch/arm/boot/zImage
 
zip k1.bin.zip arch/arm/boot/zImage
 
 
Be sure you build with the correct toolchain!
 
 
==Installing the kernel image==
 
 
* create an '''update2''' directory on the root of a USB storage drive
 
* copy '''k1.bin.zip''' to the '''update2''' directory on the USB storage drive
 
* insert the USB storage drive into chumby
 
* hold the touch screen down and power on the chumby (keep holding the screen for 5 seconds)
 
* once the device has booted into special options mode, click '''Install updates'''
 
* click '''Install from USB flash drive'''
 

Latest revision as of 11:59, 11 October 2011

Existing Software

See existing Chumby Software Applications, Scripts and Tools already on your Chumby stock linux distro.

Building and Installing a new Silvermoon chumby kernel

Building the silvermoon/opus 1.8.1 kernel

Installing the toolchain

First, install the GNU Toolchain (gcc 4.3.2)

Build the kernel

The following instructions will compile the Linux 2.6.28 kernel shipped with chumby silvermoon/opus firmware version 1.8.1:

mkdir kernel
cd kernel
wget http://files.chumby.com/source/silvermoon/silvermoon-1.8.1/linux-2.6.28.tgz
tar zxvf linux-2.6.28.tgz
cd linux-2.6.28
ARCH=arm CROSS_COMPILE=arm-linux- make
  • Once the build completes, remount your root partition on your silvermoon unit read/write via:
mount -oremount,rw /
  • Copy the freshly built kernel from arch/arm/boot/zImage on your build system to /boot/vmlinuz on the target silvermoon device
  • run sync on the target silvermoon device, then reboot

Building the silvermoon 1.0.3 kernel

Installing the toolchain

First, install the GNU Toolchain (gcc 4.3.2)

Build the kernel

The following instructions will compile the Linux 2.6.28 kernel shipped with chumby silvermoon firmware version 1.0.3:

mkdir kernel
cd kernel
wget http://files.chumby.com/source/silvermoon/silvermoon-1.0.3/linux-2.6.28-silvermoon-1.0.3.tar.gz
tar zxvf linux-2.6.28-silvermoon-1.0.3.tar.gz
cd linux-2.6.28-silvermoon-1.0.3
ARCH=arm CROSS_COMPILE=arm-linux- make
  • Once the build completes, remount your root partition on your Silvermoon unit read/write via:
mount -oremount,rw /
  • Copy the freshly built kernel from arch/arm/boot/zImage on your build system to /boot/vmlinuz on the target silvermoon device
  • run sync on the target silvermoon device, then reboot

Building and installing a new chumby One kernel

  1. Install an ARM Linux toolchain, such as the 4.3.2 GNU Toolchain
  2. Download [1]
  3. Configure the kernel as you like, by running **make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig**
    • The CROSS_COMPILE= arguments may vary depending on your toolchain's prefix. Code Sourcery uses arm-none-linux-gnueabi- by default, but arm-linux- has also been used in the past
  4. Compile the kernel by running **make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-**
  5. Install modules to a local directory by running **INSTALL_MOD_PATH=[path-to-temp-rfs] make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules_install**
  6. Copy the contents of your temp RFS to / on the chumby. This should end up putting new files in /lib/modules
  7. Copy arch/arm/boot/zImage to the chumby, somewhere temporary like /mnt/storage/
  8. Determine which RFS you're in. If /proc/cmdline contains "root=/dev/mmcblk0p2" you're in rfsA. If it contains "root=/dev/mmcblk0p3", you're in rfsB.
  9. Write the new kernel. Use krnA if you're in rfsA, and krnB if you're in rfsB:
config_util --cmd=putblock --dev=/dev/mmcblk0p1 --block=krnA < /mnt/storage/zImage


Building and Installing a new Classic chumby kernel

Building the chumby 1.7 kernel

Installing the toolchain

First, install the GNU Toolchain (gcc 4.3.2)

Build the kernel

The following instructions will compile the Linux 2.6.16 kernel shipped with chumby firmware version 1.7:

mkdir kernel
cd kernel
wget http://files.chumby.com/source/ironforge/build396/align.pl
wget http://files.chumby.com/source/ironforge/build1.7.1649/linux-2.6.16-chumby-1.7.0.tar.gz
tar zxvf linux-2.6.16-chumby-1.7.0.tar.gz
cd linux-2.6.16-chumby-1.7.0
ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make
perl ../align.pl arch/arm/boot/zImage 
zip k1.bin.zip arch/arm/boot/zImage


Building the chumby 1.6 kernel

Installing the toolchain

First, install the GCC 4.1.2b toolchain

Build the kernel

The following instructions will compile the Linux 2.6.16 kernel shipped with chumby firmware version 1.6:

mkdir kernel
cd kernel
wget http://files.chumby.com/source/ironforge/build396/align.pl
wget http://files.chumby.com/source/ironforge/build733/linux-2.6.16-chumby-1.6.0.tar.gz
tar zxvf linux-2.6.16-chumby-1.6.0.tar.gz
cd linux-2.6.16-chumby-1.6.0
ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make
perl ../align.pl arch/arm/boot/zImage 
zip k1.bin.zip arch/arm/boot/zImage


Building the chumby 1.5 kernel

Installing the toolchain

First, install the GCC 4.1.2b toolchain

Build the kernel

The following instructions will compile the Linux 2.6.16 kernel shipped with chumby firmware version 1.5:

mkdir kernel
cd kernel
wget http://files.chumby.com/source/ironforge/build396/align.pl
wget http://files.chumby.com/source/ironforge/build565/linux-2.6.16-chumby-1.5.0.tar.gz
tar zxvf linux-2.6.16-chumby-1.5.0.tar.gz
cd linux-2.6.16-chumby-1.5.0
ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make
perl ../align.pl arch/arm/boot/zImage 
zip k1.bin.zip arch/arm/boot/zImage

Be sure you build with the correct toolchain!

Installing the kernel image

  • create an update2 directory on the root of a USB storage drive
  • copy k1.bin.zip to the update2 directory on the USB storage drive
  • insert the USB storage drive into chumby
  • hold the touch screen down and power on the chumby (keep holding the screen for 5 seconds)
  • once the device has booted into special options mode, click Install updates
  • click Install from USB flash drive


Building the Wi-Fi driver

Note: This assumes you've built the chumby 1.7 linux kernel.

If you've followed the steps above to build the chumby 1.7 linux kernel, you should be able to build the Ralink rt73 driver by doing the following:

cd kernel
wget http://files.chumby.com/source/ironforge/build1.7.1649/rt73-chumby-1.7.0.tar.gz
tar zxvf rt73-chumby-1.7.0.tar.gz
cd rt73-chumby-1.7.0/Module/
make ARCH=arm CROSS_COMPILE=arm-linux- KERNDIR=../../linux-2.6.16-chumby-1.7.0 arm




DEPRECATED

Alpha Prototype

The Alpha Prototype chumby runs a modified linux 2.4.20 kernel.

Compiling the Kernel

First, install the GCC Toolchain (gcc 3.3.2) - this toolchain is only for use with the prototypes.

In order to build the chumby kernel, you can download the kernel source from chumby_kernel.tgz and build by doing the following:

# mkdir kernel
# cd kernel
# tar zxvf chumby_kernel.tgz
# make menuconfig
(then immediately exit and save the config)
# make dep
# make Image

If all goes well, you should end up with an uncompressed kernel image at arch/arm/boot/Image.

Ironforge

The "Ironforge" production chumby runs Linux 2.6.16 kernel.

First install the GNU Toolchain (gcc 4.1.2) - this toolchain is for use with the production units. Older toolchains may not work.

In order to build the chumby kernel, you can download the kernel source from linux-2.6.16-chumby-1.0.tar.gz and build by doing the following, NOT as root, but as a normal user.

$ mkdir kernel
$ cd kernel
$ tar zxvf linux-2.6.16-chumby-1.0.tar.gz
$ cd linux-2.6.16
$ cp arch/arm/configs/mx21ads_defconfig .config
$ ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make oldconfig
  (select 'Y' when asked if you wish to build in the 224 color Turbochef logo)
$ ARCH=arm BOARD=mx21ads CROSS_COMPILE=arm-linux- make


If all goes well, you should end up with a compressed kernel image at arch/arm/boot/zImage and all of loadable kernel modules under the drivers directory.

By default, there are only 3 drivers built with this configuration:

$ find drivers -name *.ko

Which should return:

drivers/char/chumby_accel.ko
drivers/char/chumby_sense1.ko
drivers/char/chumby_timer.ko
drivers/mfd/chumby-tsc2100.ko

Warning, this configuration will not get you a working kernel! Do not use just yet...

You might want to enable more modules to get the recommended:

# find drivers -name *.ko

Which should return:

drivers/media/video/cpia.ko
drivers/media/video/compat_ioctl32.ko
drivers/media/video/cpia_usb.ko
drivers/media/video/v4l1-compat.ko
drivers/media/video/v4l2-common.ko
drivers/media/video/videodev.ko
drivers/bluetooth/hci_usb.ko
drivers/bluetooth/hci_vhci.ko
drivers/video/console/bitblit.ko
drivers/video/console/fbcon.ko
drivers/video/console/fbcon_ccw.ko
drivers/video/console/fbcon_cw.ko
drivers/video/console/fbcon_rotate.ko
drivers/video/console/fbcon_ud.ko
drivers/video/console/font.ko
drivers/video/console/softcursor.ko
drivers/char/chumby_accel.ko
drivers/char/chumby_sense1.ko
drivers/char/chumby_timer.ko
drivers/usb/media/dsbr100.ko
drivers/usb/net/asix.ko
drivers/usb/net/cdc_ether.ko
drivers/usb/net/pegasus.ko
drivers/usb/net/usbnet.ko
drivers/usb/input/usbhid.ko
drivers/mfd/chumby-tsc2100.ko