Kernel compile on the HP iPAQ hx4700

(13 December 2006)

Prerequisites

The following assumes you're already running Familiar Linux on your iPAQ hx4700. I'm currently running Familiar 0.8.4 (but you must use the SDG bootloader; note that the official Familiar instructions do not cover installation on an hx4700, so please look at all instructions provided via both those links if you are going to install. If in doubt, ask questions, or you may kill your iPAQ, and it won't be my fault).

You need a toolchain capable of creating binaries for the hx4700. Download the appropriate arm-linux-gcc.

You'll obviously also need kernel sources. Grab the latest "-hh" version; for reference, I used 2.6.16-hh3 when writing this.

The compile

Once you have the various tools set up and source code in place, the compile is actually surprisinly simple.

  1. In the top-level Makefile, ensure the following lines are correct:
    ARCH:=          arm
    CROSS_COMPILE?= arm-linux-
    If your arm-linux-* binaries are not in your $PATH, define CROSS_COMPILE: as CROSS_COMPILE?= /path/to/arm-linux-
  2. Run: make hx4700_defconfig
    This provides a .config file which will work on the hx4700, with the most common options turned on.
  3. Edit the .config at the top of the kernel tree if need be (manually, or run make menuconfig, etc).
  4. Run: make modules
  5. Run: make modules_install INSTALL_MOD_PATH=/tmp
    This will place a /lib/modules/ directory structure under /tmp. This is just a precaution, as the kernel is labelled "2.6.16-hh3", so the modules should never be confused with mainline kernel modules, but better safe than sorry.
  6. Run: make zImage

By now, your kernel and its modules should be complete.

The install

This should go without saying, but: make sure you have keep a copy of the original kernel, and don't remove old kernel modules from the iPAQ until you're happy, in case it all goes pear shaped.

Installation of modules is easy; simply copy them into place. I have wireless set up on the hx4700, so I simply run the following to put the modules in place:

rm /tmp/lib/modules/2.6.16-hh3/source
rm /tmp/lib/modules/2.6.16-hh3/build
scp -r /tmp/lib/modules/2.6.16-hh3 root@ipaq:/lib/modules/

"source" and "build" are symlinks into the build tree. Believe me when I say that you will run out of space on your iPAQ should you accidentally try and copy them over with the modules.

Installation of the kernel is slightly tricker, in that you can't just copy the image over to /boot on the iPAQ and go. The kernel must be flashed to /dev/mtdblock1 via the SDG bootloader, in the same way that you will probably have flashed the default kernel, root and home filesystems into place. Copy your zImage from arch/arm/boot/zImage onto your CF card, and update the reflash.ctl file to point to the new kernel. Unmount the CF card and insert it into the hx4700.

Hold down the contacts and email buttons (top left, top right respectively), and hit 'reset' to enter the flash utility on the bootloader. Select your kernel image, and follow the on-screen instructions.

You can watch the process via a serial line (115200 8N1, no flow control). When it's complete, reset the iPAQ again, and say hello to your new kernel.

Resources