View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

iPAQ Familiar Kernel HOW-TO

Just my notes for now. I will clean up and add details of compiling in FreeS/WAN patches, etc ... pebrown@cc.gatech.edu

Back to HOW-TO's



Getting familiar v4 kernel source and recompiling:
=================================================

  You will need the pre-built gcc,etc. cross compiler toolchain from
  ftp://ftp.handhelds.org/pub/linux/arm/toolchain/beta/ is installed
  or sym-linked in /usr/local/arm.  You will need the beta toolchain
  when working with the v0.20 COMPAQ-hh or the familiar v0.4 distro.
  The beta toolchain is setup for the linux-2.4.0-test11-rmk1-np3-hh2
  header files.  You can point this to the version of the source you
  pull from CVS by sym-linking the /usr/local/arm/linux directory to
  where you put the CVS code you checkout below.  It expects the
  following heirchy:

    /usr/local/arm/linux/kernel/

  The CVSROOT settings are:

    CVSROOT  = :pserver:anoncvs@cvs.handhelds.org:/cvs
    password = anoncvs

  Set this up using:


    # export CVSROOT=:pserver:anoncvs@cvs.handhelds.org:/cvs

  Once this is setup, login to CVS: (password is 'anoncvs')

    # cvs login
    (Logging in to anoncvs@cvs.handhelds.org)
    CVS password: anoncvs
    #

  In the directory you want to download the source (it will
  create the subdir 'linux/kernel' for the source) run cvs:

    # cvs checkout -rfamiliar-v0_4 linux/kernel
    <...lots of output...>

  Once you get the source you will need to modify the top level
  Makefile in linux/kernel/Makefile.  The CROSS_COMPILE directive
  uses the toolchain programs in /usr/local/arm/arm-v4l-linux*
  and the original Makefile does not include the 'v4l' part.

    // old setting for CROSS_COMPILE
    CROSS_COMPILE = arm-linux-
    // new setting for CROSS_COMPILE (see General section above)
    CROSS_COMPILE = arm-v4l-linux-

  Then you need to 'make menuconfig' and save the configuration.
  This will just save the default, but this default complies more
  into the kernel (i.e. less modules) and make the kernel larger
  than 512k (see the familiar setup for making the partitions large
  enough to handle this).

  Then just 'make depend', 'make zImage', and 'make modules'.  You
  also need to install the modules on the iPAQ.  You first need to
  run 'make INSTALL_MOD_PATH=/tmp-install-path modules_install' and
  then copy over the new modules to /lib/modules/2.4.3-rmk2-np1.new
  on the iPAQ.  Save the old modules so you can easily flash the
  old kernel: 'mv /lib/modules/2.4.3-rmk2-np1 /lib/modules/2.4.3-rmk2-np1.orig'
  and setup a link in the linuxrc file (see below).  That way you
  can chage the linuxargs flash param and reboot the old kernel without
  any problems.

  I have 2 /linuxrc files setup, 1 for the new kernel and 1 for the
  old kernel b/c I had to modify the modules and also /etc/inittab
  to get the new kernel to work.  The modification to the /etc/inittab
  file is:

  # changed this to work will new kernel, otherwise it does not boot
  #T0:23:respawn:/sbin/getty -L ttySA0 115200 vt100
  T0:23:respawn:/sbin/getty -L tts/0 115200 vt100

  I saved the original file to /etc/inittab.orig and this modified
  file to /etc/inittab.new and modified my linuxrc file (see below)
  so I can easily boot the old kernel with a reflash and an adjustment
  of the linuxargs flash param.  Simply change the /linuxrc in the
  linuxargs param to /linuxrc.new to boot the new kernel and it will
  adjust the /etc/inittab file and link to the proper modules (if
  you use the flies below or adjust your own).

  # --------- start linuxrc file to boot orig familiar kernel -----------#
  #!/bin/sh
  echo "Executing /linuxrc..."

  export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

  # setup proper modules
  rm /lib/modules/2.4.3-rmk2-np1
  ln -s /lib/modules/2.4.3-rmk2-np1.orig /lib/modules/2.4.3-rmk2-np1

  # setup inittab
  rm /etc/inittab
  ln -s /etc/inittab.orig /etc/inittab

  echo "Loading floating point emulator..."
  /sbin/insmod nwfpe

  echo "Mounting /proc"
  mount -n /proc

  echo "Loading Unix socket support"
  /sbin/insmod unix

  echo "Setting up RAMFS, please wait... "
  /sbin/insmod ramfs
  mount /mnt/ramfs
  tar xfpz .ramfs.tar.gz -C /mnt/ramfs > /dev/null 2>&1

  if [ ! -s /etc/inittab ]
  then
    echo "You are attemping to boot an incomplete system, starting a shell..."
    mkdir /mnt/ramfs/tmp
    cd /tmp
    exec /bin/sh
  fi

  echo "Setting Date/Time from previous settings"
  /bin/date -s "`/bin/cat /etc/lastdate`"

  echo "Executing /sbin/init..."
  exec /sbin/init
  # ------------ end linuxrc file to boot new familiar kernel -------------#

  # -------- start linuxrc.new file to boot new familiar kernel -----------#
  #!/bin/sh
  echo "Executing /linuxrc..."

  export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

  # setup proper modules
  rm /lib/modules/2.4.3-rmk2-np1
  ln -s /lib/modules/2.4.3-rmk2-np1.new /lib/modules/2.4.3-rmk2-np1

  # setup inittab
  rm /etc/inittab
  ln -s /etc/inittab.new /etc/inittab

  # replace pcmcia startup scripts
  mv -f /etc/rc2.d/s10pcmcia /etc/rc2.d/S10pcmcia

  # in kernel
  #echo "Loading floating point emulator..."
  #/sbin/insmod nwfpe

  echo "Mounting /proc"
  mount -n /proc

  # in kernel
  #echo "Loading Unix socket support"
  #/sbin/insmod unix

  echo "Setting up RAMFS, please wait... "
  # in kernel
  #/sbin/insmod ramfs
  mount /mnt/ramfs
  tar xfpz .ramfs.tar.gz -C /mnt/ramfs > /dev/null 2>&1

  if [ ! -s /etc/inittab ]
  then
    echo "You are attemping to boot an incomplete system, starting a shell..."
    mkdir /mnt/ramfs/tmp
    cd /tmp
    exec /bin/sh
  fi

  echo "Setting Date/Time from previous settings"
  /bin/date -s "`/bin/cat /etc/lastdate`"

  echo "Executing /sbin/init..."
  exec /sbin/init
  # ---------- end linuxrc.new file to boot new familiar kernel -----------#


Back to HOW-TO's


Links to this Page