Loading HIPL on OpenWRT

Preparation

This is a common part for both La Fonera and Netgear WGT634U.

  1. If you are using bash, make sure that your shell option does not include the noclobber option. First check if noclobber is included in your shell option.

    $ set | grep -i noclobber
    SHELLOPTS=braceexpand:emacs:hashall:histexpand:interactive-comments:monitor:noclobber:notify
    

    Like this case, if you have that option, you must remove set -o noclobber in your $HOME/.bashrc file. Otherwise you might encounter a lot of errors while building OpenWRT, like "cannot overwrite existing files".

  2. Checkout and build the openWRT sources following this manual: http://wiki.openwrt.org/OpenWrtDocs/BuildingKamikazeHowTo It is not much different for each version, no matter the 7.09 release or the svn devel tree.

  3. It's a good idea to make a directory named as 'files' under your OpenWRT tree, and get your own custom configuration files under that directory, maintaining the hierarchy on Linux. For example:

    $ ls
    svn   kamikaze-7.09
    $ mkdir kamikaze-7.09/files
    $ mkdir kamikaze-7.09/files/etc kamikaze-7.09/files/bin
    $ cp <somewhere>/etc/* kamikaze-7.09/files/etc/
    

    This way of customization is really convenient, because you need neither to find proper locations for them in your build directory, nor to place those files there. It means all the files under 'kamikaze-7.09/files' directory is automatically copied into your build directory, every time you build an OpenWRT image.

Building HIPL for OpenWRT on La Fonera

This part is just for La Fonera. For WGT634U, please refer to the section called “Building HIP for OpenWRT on Netgear WGT634U”.

  1. Your configuration should include these options:

    Target System (Atheros [2.6])
    Target Images (jffs2, squashfs)
    Image configuration --->
     (static) LAN Protocol (NEW)
     (192.168.5.30) LAN IP Address (NEW)
     (255.255.255.0) LAN Network Mask (NEW)
    Base System  --->
     Configuration  --->
      Linux Module Utilities  --->
       [*] modprobe
    Network  --->
     <*> ipsec-tools
     <*> isakmpd
     <*> ip6tables
     <*> hostapd
    Kernel modules  --->
     Netfilter Extensions  --->
      <*> kmod-ip6tables
      <*> kmod-ipt-filter
      <*> kmod-ipt-ipsec
      <*> kmod-ipt-nat
      <*> kmod-ipt-queue
     Network Support  --->
      <*> kmod-ipsec
      <*>  kmod-ipsec4
      <*>  kmod-ipsec6
      <*> kmod-iptunnel4
      <*> kmod-ipv6
      <*> kmod-tun
     Other modules  --->
      <*> kmod-crypto
     Wireless Drivers  --->
      <*> kmod-madwifi
    Advanced configuration options (for developers)  --->
     Build Options  --->
      (8)   Number of jobs to run simultaneously (for PISA development. Speeds up compilation dramatically on multicore systems)
    

    You could also download a pre-configured configuration file for your device from http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/config/dot_config_fonera, and place it as kamikaze_7.09/.config, and http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/config/target/linux/atheros-2.6/config/default as kamikaze_7.09/target/linux/atheros-2.6/config/default.

  2. Now build it.

    $ make
    

  3. If you cannot make jffs2 images without root privilege, try building with root privilege to get around it.

  4. If you get any error during the build, try using the verbose mode to figure out what's going on.

    $ make V=99
    

  5. If the build has succeeded, you can see firmware images in your bin directory.

    $ ls -l bin/
    1668 -rw-r--r-- 1 root root 1703936 2008-06-11 14:03 openwrt-atheros-2.6-root.jffs2-128k
    1668 -rw-r--r-- 1 root root 1703936 2008-06-11 14:03 openwrt-atheros-2.6-root.jffs2-256k
    1668 -rw-r--r-- 1 root root 1703936 2008-06-11 14:03 openwrt-atheros-2.6-root.jffs2-64k
    1156 -rw-r--r-- 1 root root 1179648 2008-06-11 14:03 openwrt-atheros-2.6-root.squashfs
    2380 -rwxr-xr-x 1 root root 2425928 2008-06-11 14:03 openwrt-atheros-2.6-vmlinux.elf
    1032 -rw-r--r-- 1 root root 1048576 2008-06-11 14:03 openwrt-atheros-2.6-vmlinux.gz
     776 -rw-r--r-- 1 root root  786432 2008-06-11 14:03 openwrt-atheros-2.6-vmlinux.lzma
       4 drwxr-xr-x 2 root root    4096 2008-06-11 14:03 packages/
    

  6. Install them on /tftpboot and write them on your device.

Loading HIPL for OpenWRT on La Fonera

This part is just for La Fonera. For WGT634U, please refer to the section called “Loading HIPL on Netgear WGT634U”.

For building HIPL on the kamikaze release 7.09. 

NEW preferred way to build and install HIPL on OpenWRT:

NOTE: Automatic package dependency selection is only verified for hipfw! Please report missing dependencies for the other packages.

  1. Get and extract OpenWRT kamikaze 7.09 source, untar it and create the download directory for packages that should be built.

      $ wget http://downloads.openwrt.org/kamikaze/7.09/kamikaze_7.09.tar.bz2
      $ tar xzf kamikaze_7.09.tar.gz
      $ mkdir -p path/to/kamikaze/dl
      
  2. Get the newest hipl source tree from the hipl repository and place the tarball that you are going to create in the kamikaze download directory. Note that VERSION string should not be taken literally in the instructions below. It refers to the tarball version number (as denoted by AC_INIT line in configure.ac).

      $ bzr checkout http://hipl.hiit.fi/hipl/hipl-bzr/trunk
      $ cd trunk
      $ autoreconf --install
      $ ./configure
      $ make dist
      $ cp hipl-VERSION.tar.gz path/to/kamikaze/dl
      

  3. Select the packages, which you want to build for OpenWRT. The following command will allow you to do this in a similar way to configuring a custom kernel.

      $ make menuconfig
      

    Ensure that you select the HIPL-package that you require to run. You might only need the hipfw or only hipd. Your selection will automatically select all necessary dependencies. Below we give an example on how to select hipfw only, the hipd will not be installed.

      Network  --->
      <*> hipl-hipfw
      

    NOTE: Due to dependency issues with the build system, you still have to select kmod-ipsec4 and kmod-ipsec6 manually.

    Kernel modules  --->
     Network Support  --->
      <*>  kmod-ipsec4
      <*>  kmod-ipsec6
      

  4. Now build OpenWRT.

      $ make V=99
      

  5. Load the images on La Fonera and reboot.

Old way to build and install HIPL on OpenWRT (in case the above is not working):

  1. Get and extract OpenWRT kamikaze 7.09 source.

      $ tar xzf kamikaze_7.09.tar.gz
      
  2. Get all patches for HIPL on OpenWRT from http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/patches/, which produce Makefiles and configuration files for necessary packages. And apply them into the kamikaze_7.09 source tree.

      $ ls
      64 etc_config_dhcp.diff      64 etc_firewall_user.diff
      64 etc_config_network.diff   64 etc_hostapd.diff
      64 etc_config_wireless.diff  64 hipl_openwrt-7.09.diff
      64 lib_wifi_madwifi.sh.diff  64 kamikaze_7.09
      $ cd kamikaze_7.09
      $ patch -p1 < ../hipl_openwrt-7.09.diff
      $ patch -p1 < ../etc_config_dhcp.diff
      $ patch -p1 < ../etc_config_network.diff
      $ patch -p1 < ../etc_config_wireless.diff
      $ patch -p1 < ../etc_firewall_user.diff
      $ patch -p1 < ../etc_hostapd.diff
      $ patch -p1 < ../lib_wifi_madwifi.sh.diff
      $ ls package/hipl/Makefile
      Makefile
      

    Note that you might also change the kernel version in <path_to_kamikaze>/target/linux/atheros-2.6/Makefile into 2.6.23 or a similar version number, especially if you are using vanilla kamikaze sources.

  3. Get the newest hipl source tree from the hipl repository, pack them as a tarball and place it under the dl directory.

      $ bzr checkout http://hipl.hiit.fi/hipl/hipl-bzr/trunk
      $ mkdir -p path/to/kamikaze/dl
      $ tar czf path/to/kamikaze/dl/hipl-VERSION.tar.gz trunk
      

    An alternative to that is to get a hipl tarball from http://hipl.hiit.fi/hipl/contrib/openwrt/, and to place it in the directory kamikaze_7.09/dl/. However, this tarball is currently too old. Do that only when you get in trouble with the first method with the newest sources.

    $ wget http://hipl.hiit.fi/hipl/contrib/openwrt/hipl--openwrt--2.6.tar.gz -O kamikaze_7.09/dl/hipl--openwrt--2.6.tar.gz

  4. Copy our own kernel configuration file for atheros from http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/config/target/linux/atheros-2.6/config/default and place it as kamikaze_7.09/target/linux/atheros-2.6/config/default.

  5. Enable hipl in the Networking menu by executing "make menuconfig".

      Network  --->
      <*> hipl
      

    Select the kernel modules kmod-ipsec, kmod-ipsec4 and kmod-ipsec6.

  6. Build OpenWRT, make a vmlinuz and a rootfs image.

      $ make V=99
      

    Or you can also build just the hipl packages.

      $ make package/hipl-install V=99
      

  7. Load the images on La Fonera and reboot.

  8. If you are able to reboot your device with your image, the next thing to do is to install kernel module packages needed for running hipl. Make sure first that the following packages are available in your kamikaze tree.

      $ cd bin/packages/
      $ ls -l kmod-crypto* kmod-ipsec* kmod-ipv6* kmod-tun*
      176 -rw-r--r-- 1 pisa users 169225 2008-06-18 11:41 kmod-crypto_2.6.21.3-atheros-1_mips.ipk
      36 -rw-r--r-- 1 pisa users  32461 2008-06-18 11:41 kmod-ipsec_2.6.21.3-atheros-1_mips.ipk
      16 -rw-r--r-- 1 pisa users  10813 2008-06-18 11:41 kmod-ipsec4_2.6.21.3-atheros-1_mips.ipk
      20 -rw-r--r-- 1 pisa users  13259 2008-06-18 11:41 kmod-ipsec6_2.6.21.3-atheros-1_mips.ipk
      172 -rw-r--r-- 1 pisa users 167391 2008-06-18 11:41 kmod-ipv6_2.6.21.3-atheros-1_mips.ipk
      12 -rw-r--r-- 1 pisa users   6800 2008-06-18 11:41 kmod-tun_2.6.21.3-atheros-1_mips.ipk
      

    If they are not available, configure your OpenWRT again to add them as packages.("<M>")

  9. Install the packages in your La Fonera device. On your device console:

      # scp user@srv:path/to/kamikaze_7.09/bin/packages/kmod-{crypto,ipsec,ipv6,tun}* .
      # ipkg install kmod-crypto* kmod-ipsec* kmod-ipv6* kmod-tun*
      

  10. Load the installed modules, unless you already have /etc/modules.d/35-hipl.

      # cd /lib/modules/2.6.21.3
      # insmod crypto_null.ko
      # insmod sha1.ko
      # insmod aes.ko
      # insmod crypto_hash.ko
      # insmod hmac.ko
      # insmod tun.ko
      # insmod ipv6.ko
      # insmod af_key.ko
      # insmod xfrm_user.ko
      # insmod ah4.ko
      # insmod esp4.ko
      # insmod ipcomp.ko
      # insmod xfrm_tunnel.ko
      # insmod ah6.ko
      # insmod esp6.ko
      # insmod ipcomp6.ko
      # insmod tunnel6.ko
      # insmod xfrm6_tunnel.ko
      

    Don't panic even though some of those modules do not exist. Chances are, the missing modules are already embedded in your kernel image. To know whether a certain object is configured as a module or not, refer to the configuration file kamikaze_7.09/target/linux/atheros-2.6/config/default.

For building HIPL on the kamikaze development version. 

  1. Get OpenWRT source codes from the subversion repository.

    $ svn checkout https://svn.openwrt.org/openwrt/trunk
    

  2. Get all patches for hipl packages in OpenWRT http://hipl.hiit.fi/hipl/contrib/openwrt/devel/patches/, and apply them into the kamikaze source tree.

    $ ls
    64 hipl_openwrt_kernel-svn.diff  64 hipl_openwrt_packages-svn.diff
    64 kamikaze/
    $ cd kamikaze
    $ patch -p1 < ../hipl_openwrt_packages-svn.diff
    $ patch -p1 < ../hipl_openwrt_kernel-svn.diff
    

    Copy our own kernel configuration file for atheros from http://hipl.hiit.fi/hipl/contrib/openwrt/devel/config/target/linux/atheros/ and place it in kamikaze/target/linux/atheros/.

  3. Enable hipl in the Networking menu by executing "make menuconfig".

    Network  --->
     <*> hipl
    

  4. Get the newest hipl source tree from the hipl repository, pack them as a tarball and place it under the dl directory.

    $ bzr checkout http://hipl.hiit.fi/hipl/hipl-bzr/trunk
    $ mkdir -p path/to/kamikaze/dl
    $ tar czf path/to/kamikaze/dl/hipl-VERSION.tar.gz trunk
    

    An alternative to that is to get a hipl tarball from http://hipl.hiit.fi/hipl/contrib/openwrt/, and to place it in the directory kamikaze_7.09/dl/. However, this tarball is currently too old. Do that only when you get in trouble with the first method with the newest sources.

    $ wget http://hipl.hiit.fi/hipl/contrib/openwrt/hipl--openwrt--2.6.tar.gz -O kamikaze/dl/hipl--openwrt--2.6.tar.gz
    

  5. Build OpenWRT, make a vmlinuz and a rootfs image.

    $ make V=99
    

    Or you can also build just a hipl package.

    $ make package/hipl-install V=99
    

  6. Load the images on La Fonera and reboot.

  7. If you are able to reboot your device with your image, the next thing to do is to install kernel module packages needed for running hipl. Make sure first that the following packages are available in your kamikaze tree.

    $ cd bin/packages/
    $ ls -l kmod-crypto* kmod-ipsec* kmod-ipv6* kmod-tun*
    176 -rw-r--r-- 1 pisa users 169225 2008-06-18 11:41 kmod-crypto_2.6.21.3-atheros-1_mips.ipk
     36 -rw-r--r-- 1 pisa users  32461 2008-06-18 11:41 kmod-ipsec_2.6.21.3-atheros-1_mips.ipk
     16 -rw-r--r-- 1 pisa users  10813 2008-06-18 11:41 kmod-ipsec4_2.6.21.3-atheros-1_mips.ipk
     20 -rw-r--r-- 1 pisa users  13259 2008-06-18 11:41 kmod-ipsec6_2.6.21.3-atheros-1_mips.ipk
    172 -rw-r--r-- 1 pisa users 167391 2008-06-18 11:41 kmod-ipv6_2.6.21.3-atheros-1_mips.ipk
     12 -rw-r--r-- 1 pisa users   6800 2008-06-18 11:41 kmod-tun_2.6.21.3-atheros-1_mips.ipk
    

    If they are not available, configure your OpenWRT again to add them as packages.("<M>")

  8. Install the packages in your La Fonera device. On your device console:

    # scp user@srv:path/to/kamikaze-svn/bin/packages/kmod-{crypto,ipsec,ipv6,tun}* .
    # ipkg install kmod-crypto* kmod-ipsec* kmod-ipv6* kmod-tun*
    

  9. Load the installed modules, unless you already have /etc/modules.d/35-hipl.

    # cd /lib/modules/2.6.21.3
    # insmod crypto_null.ko
    # insmod sha1.ko
    # insmod aes.ko
    # insmod crypto_hash.ko
    # insmod hmac.ko
    # insmod tun.ko
    # insmod ipv6.ko
    # insmod af_key.ko
    # insmod xfrm_user.ko
    # insmod ah4.ko
    # insmod esp4.ko
    # insmod ipcomp.ko
    # insmod xfrm_tunnel.ko
    # insmod ah6.ko
    # insmod esp6.ko
    # insmod ipcomp6.ko
    # insmod tunnel6.ko
    # insmod xfrm6_tunnel.ko
    

    Don't panic even though some of those modules do not exist. Chances are, the missing modules are already embedded in your kernel image. To know whether a particular object is already configured as a module or not, refer to the configuration file 'kamikaze/target/linux/atheros/config-2.6.21'.

Some notes about HIPL on La Fonera

Note that size of a kernel image for La Fonera must not exceed 720 KB. So you should not add various kernel options as you need to keep size being smaller than 720 KB.

As La Fonera has only limited flash memory space, you should limit the final rootfs image up to 4 MB at most. It means you are not afford to add packages as you wish. If you are just about to add all of the hipl binary files into your rootfs image, your flash memory would not able to load the oversized image. Therefore the hipl install part in Makefile is carefully designed to copy only necessary files into the rootfs image.

If you meet an error like "libintl.h: no such file or directory", try rebuilding gcc and uClibc in toolchain.

Building hipl under the kamikaze devel tree does not go well always. It could cause you to correct numerous errors while building it. You are warned!

If you encounter an error like "SHA: undefined reference", use the macro HIP_SHA() instead of SHA(). Using SHA() does not make any problem with a native compiler, but it causes errors with a crosscompiler. For that reason HIP_SHA() is defined in `lib/core/crypto.h` to be used for any calls to SHA().

Building HIP for OpenWRT on Netgear WGT634U

This part is just for Netgear WGT634U. For La Fonera, please refer to the section called “Building HIPL for OpenWRT on La Fonera”.

For preparation, refer to the section called “Preparation”.

  1. Your configuration should include these options:

    Target System (Broadcom BCM947xx/953xx [2.6])
    Target Images (jffs2, squashfs)
    Image configuration --->
     (static) LAN Protocol (NEW)
     (192.168.5.30) LAN IP Address (NEW)
     (255.255.255.0) LAN Network Mask (NEW)
    Base System  --->
     Configuration  --->
      Linux Module Utilities  --->
       [*] modprobe
    Network  --->
     <*> ipsec-tools
     <*> isakmpd
     <*> ip6tables
     <*> hostapd
    Kernel modules  --->
     Netfilter Extensions  --->
      <*> kmod-ip6tables
      <*> kmod-ipt-filter
      <*> kmod-ipt-ipsec
      <*> kmod-ipt-nat
      <*> kmod-ipt-queue
    Network Support  --->
      <*> kmod-ipsec
      <*>  kmod-ipsec4
      <*>  kmod-ipsec6
      <*> kmod-iptunnel4
      <*> kmod-ipv6
      <*> kmod-tun
    Other modules  --->
      <*> kmod-crypto
    Wireless Drivers  --->
      <*> kmod-madwifi
    Advanced configuration options (for developers)  --->
     Build Options  --->
      (8)   Number of jobs to run simultaneously (for PISA development. Speeds up compilation dramatically on multicore systems)
    

  2. You could also download a pre-configured configuration file for your device from http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/config/dot_config_wgt, and place it as kamikaze_7.09/.config, and http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/config/target/linux/brcm47xx-2.6/config/default as kamikaze_7.09/target/linux/brcm47xx-2.6/config/default. Make sure that you have the following kernel configurations in your target/linux/brcm47xx-2.6/config/default. Those are not available in the default configuration file provided by OpenWRT kamikaze 7.09.

    CONFIG_DUMMY=y
    CONFIG_PACKET=y
    CONFIG_UNIX=y
    

  3. Now build it.

    $ make
    

  4. If you cannot make jffs2 images without root privilege, try building with root privilege to get around it.

  5. If you get any error during the build, try using the verbose mode to figure out what's going on.

    $ make V=99
    

  6. If the build has succeeded, you can see firmware images in your bin directory.

    $ bin/openwrt-wgt*
    5136 -rw-rw-r-- 1 pisa src-pisa 5246976 Sep  3 16:58 bin/openwrt-wgt634u-2.6-jffs2.bin
    3528 -rw-rw-r-- 1 pisa src-pisa 3608576 Sep  3 16:58 bin/openwrt-wgt634u-2.6-squashfs.bin
    

  7. Install them on /tftpboot and write them on your device.

  8. Note that for Broadcom BCM the target name becomes 'mipsel' instead of 'mips'. So the name of cross compiler is 'mipsel-linux-uclibc-gcc'.

  9. Unlike La Fonera, to build OpenWRT for WGT634U, you need to take care of the maximum final image size 4MB. If you add lots of packages in the image, its size is really likely to exceed 4MB. If you cannot reduce the size with your own effort, try unselecting jffs2 in your OpenWRT configuration and selecting only squashfs, because squashfs images are slimmer than jffs2 images.

Loading HIPL on Netgear WGT634U

For building HIPL on the kamikaze release 7.09. 

  1. Get and extract OpenWRT kamikaze 7.09 source.

      $ tar xzf kamikaze_7.09.tar.gz
      
  2. Get all patches for HIPL on OpenWRT from http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/patches/, which produce Makefiles and configuration files for necessary packages. And apply them into the kamikaze_7.09 source tree.

      $ ls
      64 etc_config_dhcp.diff      64 etc_firewall_user.diff
      64 etc_config_network.diff   64 etc_hostapd.diff
      64 etc_config_wireless.diff  64 hipl_openwrt-7.09.diff
      64 lib_wifi_madwifi.sh.diff  64 kamikaze_7.09
      $ cd kamikaze_7.09
      $ patch -p1 < ../hipl_openwrt-7.09.diff
      $ patch -p1 < ../etc_config_dhcp.diff
      $ patch -p1 < ../etc_config_network.diff
      $ patch -p1 < ../etc_config_wireless.diff
      $ patch -p1 < ../etc_firewall_user.diff
      $ patch -p1 < ../etc_hostapd.diff
      $ patch -p1 < ../lib_wifi_madwifi.sh.diff
      $ ls package/hipl/Makefile
      Makefile
      

    Note that you might also change the kernel version in <path_to_kamikaze>/target/linux/brcm47xx-2.6/Makefile into 2.6.23 or a similar version number, especially if you are using vanilla kamikaze sources.

  3. Get the newest hipl source tree from the hipl repository, pack them as a tarball and place it under the dl directory.

      $ bzr checkout http://hipl.hiit.fi/hipl/hipl-bzr/trunk
      $ mkdir -p kamikaze_7.09/dl
      $ tar czf kamikaze_7.09/dl/hipl-VERSION.tar.gz trunk
      

    An alternative to that is to get a hipl tarball from http://hipl.hiit.fi/hipl/contrib/openwrt/, and to place it in the directory kamikaze_7.09/dl/. However, this tarball is currently too old. Do that only when you get in trouble with the first method with the newest sources.

    $ wget http://hipl.hiit.fi/hipl/contrib/openwrt/hipl--openwrt--2.6.tar.gz -O kamikaze_7.09/dl/hipl--openwrt--2.6.tar.gz

  4. Copy our own kernel configuration file for brcm47xx from http://hipl.hiit.fi/hipl/contrib/openwrt/7.09/config/target/linux/brcm47xx-2.6/config/default and place it as kamikaze_7.09/target/linux/brcm47xx-2.6/config/default.

  5. Enable hipl in the Networking menu by executing "make menuconfig".

      Network  --->
      <*> hipl
      

  6. Build OpenWRT, make a vmlinuz and a rootfs image.

      $ make V=99
      

    Or you can also build just a hipl package.

      $ make package/hipl-install V=99
      

  7. Load the images on WGT634U and reboot.

  8. If you are able to reboot your device with your image, the next thing to do is to install kernel module packages needed for running hipl. Make sure first that the following packages are available in your kamikaze tree.

      $ cd bin/packages/
      $ ls -l kmod-crypto* kmod-ipsec* kmod-ipv6* kmod-tun*
    $ cd bin/packages/
    $ ls -l kmod-crypto* kmod-ipsec* kmod-ipv6* kmod-tun*
     28 -rw-rw-r-- 1 pisa src-pisa  26423 Sep  3 16:57 kmod-crypto_2.6.22-brcm47xx-1_mipsel.ipk
     12 -rw-rw-r-- 1 pisa src-pisa  11297 Sep  3 16:57 kmod-ipsec4_2.6.22-brcm47xx-1_mipsel.ipk
     16 -rw-rw-r-- 1 pisa src-pisa  14299 Sep  3 16:57 kmod-ipsec6_2.6.22-brcm47xx-1_mipsel.ipk
     36 -rw-rw-r-- 1 pisa src-pisa  33031 Sep  3 16:57 kmod-ipsec_2.6.22-brcm47xx-1_mipsel.ipk
    168 -rw-rw-r-- 1 pisa src-pisa 165355 Sep  3 16:57 kmod-ipv6_2.6.22-brcm47xx-1_mipsel.ipk
      8 -rw-rw-r-- 1 pisa src-pisa   6820 Sep  3 16:57 kmod-tun_2.6.22-brcm47xx-1_mipsel.ipk
      

    If they are not available, configure your OpenWRT again to add them as packages.("<M>")

  9. Install the packages in your WGT634U device. On your device console:

      # scp user@srv:path/to/kamikaze_7.09/bin/packages/kmod-{crypto,ipsec,ipv6,tun}* .
      # ipkg install kmod-crypto* kmod-ipsec* kmod-ipv6* kmod-tun*
      

  10. Load the installed modules, unless you already have /etc/modules.d/35-hipl.

      # cd /lib/modules/2.6.21.3
      # insmod sha1.ko
      # insmod aes.ko
      # insmod tun.ko
      # insmod ipv6.ko
      # insmod af_key.ko
      # insmod xfrm_user.ko
      # insmod ah4.ko
      # insmod esp4.ko
      # insmod ipcomp.ko
      # insmod xfrm_tunnel.ko
      # insmod ah6.ko
      # insmod esp6.ko
      # insmod ipcomp6.ko
      # insmod tunnel6.ko
      # insmod xfrm6_tunnel.ko
      

    Don't panic even though some of those modules do not exist. Chances are, the missing modules are already embedded in your kernel image. To know whether a certain object is configured as a module or not, refer to the configuration file kamikaze_7.09/target/linux/brcm47xx-2.6/config/default.

Building HIP for OpenWRT on ASUS WL500W

This part is just for ASUS WL500W. For La Fonera, please refer to the section called “Building HIPL for OpenWRT on La Fonera”.

You cannot use Kamikaze 7.09 for ASUS WL500W. Please stick to the latest Kamikaze development version, like r12983, downloading from the subversion repository.

For preparation, refer to the section called “Preparation”.

Additionally, you need to download http://hipl.hiit.fi/hipl/contrib/openwrt/devel/package/iptables/Makefile and replace the iptables Makefile with the new one, to build libipq.a and install it. Without it you cannot build hipl.

For kernel 2.6.25.x. 

  1. If you want to build OpenWRT with kernel 2.6.25.x, e.g. 2.6.25.17, get hipl patches from the userspace branch of hipl.

    $ cd userspace/patches/kernel/2.6.25
    $ ls
    beet-bugfix-2.6.25.patch  ipproto_hip.patch
    hipmod-2.6.25.patch       orchid-router-src-addr-sel.patch
    $ cp beet-bugfix-2.6.25.patch path/to/kamikaze/target/linux/brcm47xx/patches-2.6.25/800-beet-bugfix.patch
    $ cp hipmod-2.6.25.patch path/to/kamikaze/target/linux/brcm47xx/patches-2.6.25/810-hipmod.patch
    $ cp ipproto_hip.patch path/to/kamikaze/target/linux/brcm47xx/patches-2.6.25/820-ipproto_hip.patch
    $ cp orchid-router-src-addr-sel.patch path/to/kamikaze/target/linux/brcm47xx/patches-2.6.25/830-orchid-router-src-addr-sel.patch
    

  2. Fortunately you don't need to add those patches in other configuration files. Those patches are automatically applied during kernel build.

For kernel 2.6.27. 

  1. If you want to build OpenWRT with kernel 2.6.27, do the following steps. NOTE: this instruction is currently not working.

  2. First we need to upgrade kernel from 2.6.25.17 to 2.6.27, because the BEET patch needed for HIPL is natively supported from 2.6.27. Edit target/linux/brcm47xx-2.6/Makefile and set '2.6.27' as LINUX_VERSION.

    LINUX_VERSION:=2.6.27
    

  3. Copy corresponding files for the kernel version 2.6.27.

    $ cd path/to/kamikaze/target/linux/brcm47xx-2.6
    $ cp config-2.6.25 config-2.6.27
    $ cp -r files-2.6.25 files-2.6.27
    $ cp -r patches-2.6.25 patches-2.6.27
    $ cd ../../..
    

  4. Configure kernel options.

    $ make kernel_menuconfig
    

    and also make sure that the below options are included in the configuration.

    Device Drivers  --->
     [*] Network device support  --->
      <*>  Dummy net driver support
    Networking  --->
     Networking support
      Networking options  --->
       TCP/IP networking
        <M>   IP: IPsec BEET mode
        <M>   IPv6: IPsec BEET mode
    

  5. Make sure that the below options are not selected. This causes a compilation error.

    Networking support  --->
     Networking options  --->
      Network packet filtering framework (Netfilter)  --->
       Core Netfilter Configuration  --->
        [ ] "layer7" match support
    Kernel modules  --->
     Netfilter extensions  --->
      [ ] kmod-ipt-filter
     Network support  --->
      [ ] kmod-sched
    

Building the entire tree. 

Now you have finished configuring kernel. Then you need to choose your target profile according to your WiFi interface. You have two options for that: one is using the original Broadcom 4321 wifi card, the another is replacing the existing card with an Atheros card.

For the original Broadcom 4321 Wi-Fi card. 

NOTE: This way is not guaranteed to work. Do it at your own risk!

  1. Run menuconfig and choose the following options.

    Target System (Broadcom BCM947xx/953xx [2.6])
    Target Profile (Broadcom BCM43xx WiFi (default))
    Kernel modules  --->
      Wireless Drivers  --->
        <*> kmod-b43
        <*> kmod-hostap
        <*> kmod-ieee80211-softmac
        <*> kmod-mac80211
    

  2. Build OpenWRT.

    $ make V=99
    

    Then you can get the final image in `bin/openwrt-brcm47xx-squashfs.trx`. Load it on your device. Then you can use ASUS WL-500W with an Atheros card.

For Atheros Wi-Fi card. 

This is the recommended option for you, because Atheros cards are really stable, supported by madwifi device driver. Make sure that you already replaced your existing Broadcom miniPCI card with a new Atheros card.

  1. Run menuconfig and choose the following options.

    Target System (Broadcom BCM947xx/953xx [2.6])
    Target Profile (Atheros WiFi)
    Kernel modules  --->
      Wireless Drivers  --->
        <*> kmod-madwifi
        <*> kmod-hostap
    

  2. Build OpenWRT.

    $ make V=99
    

    Then you can get the final image in bin/openwrt-brcm47xx-squashfs.trx. Load it on your device. Then you can use ASUS WL-500W with an Atheros card.