

Disclaimer
==========
I describe here my way to do it.

I do not claim that my way is the best way.
If you see some grave drawbacks, then drop me a note.




General approach for building OpenWrt for Horst
===============================================

1. Get the OpenWrt development trees for 'trunk' and 'packages'.

2. Incorporate inofficial OpenWrt packages usefull for Horst
   into your OpenWrt development tree.

3. Adjust your desired target configuration via 'make menuconfig'
   setting. Build your system.

4. Apply my linux kernel patches specific for OpenWrt on Horst,
   and rebuild.




1. Get the OpwnWrt development trees for 'trunk' and 'packages'
===============================================================

Boldly I always use the bleeding edge development branches.
See  https://dev.openwrt.org/wiki/GetSource  for instructions
of how to download the code.

This provides me with two file trees, whose roots I call
trunk_rootdir and packages_rootdir.

trunk_rootdir already contains required or typically used  packages.
You find them in trunk_rootdir/packages.

packages_rootdir contains many extra packages. In order to make them
available to the OpenWrt development system, I create soft links in
trunk_rootdir/packages, which point to the apropriate directories in
the packages_rootdir tree.

Typically I do not want to see all extra packages in the trunk tree,
because this just shows too many packages to choose from when running
'make menuconfig'.

The extra packages from the 'libs' section, however, I always want
to incorporate. These packages are selected automatically when
required by some other package, i.e. I rarely choose from them manually.
So I do:
	cd trunk_rootdir/package
	ln -s  packages_rootdir/libs/*  .
And furthermore the links for specific packages I am interested in, e.g.:
	ln -s  packages_rootdir/net/asterisk-1.8.x  .
	...



2. Incorporate inofficial OpenWrt packages
==========================================
To be used on my HorstBox, I have created some OpenWrt packages, which are
not in the official OpenWrt distribution. You find them in
http://arny.tjps.eu/OpenWrt/horst/arny_packages

You may download and untar these packages. Either place them in
trunk_rootdir/package/, or create softlinks to them in
trunk_rootdir/package/.



3. Adjust configuration via 'make menuconfig'. Build your system.
=================================================================
OpenWrt configuration settings may be adjusted by
	cd trunk_rootdir
	make menuconfig

As Horst is not used as router or access point, I generally deselect all corresponding
settings (WLAN/wireless, ppp, firewalling/netfilter/iptables, dnsmasq, ...).

Here are some settings required or recommended for Horst:

   TARGET_ixp4xx                         Target System->Intel IXP4xx

   CONFIG_TARGET_ixp4xx_generic          Subtarget->Generic

   TARGET_ROOTFS_SQUASHFS                Target images->squashfs
	I recommended to use squashfs as root filesystem type.
	jffs2 would also be possible. For squashfs, OpenWrt creates an overlay
	filesystem on top of the squashfs root system. So changes on the running
	system are possible even with squashfs.

   CONFIG_PACKAGE_ixp4xx-microcode       Network->ixp4xx-microcode
	This package contains i.a. firmware required by the ethernet driver kmod-ixp4xx-eth

   CONFIG_PACKAGE_kmod-crypto-core       Kernel modules->Cryptographic API->kmod-crypto-core
   CONFIG_PACKAGE_kmod-crypto-hw-ixp4xx  Kernel modules->Cryptographic API->module->kmod-crypto-hw-ixp4xx
  	Optional. Crypto options on Horst have never been used/tested by me.

   CONFIG_PACKAGE_kmod-hfcpci            Kernel modules->Network Devices->kmod-hfcpci
	mISDN V2 Driver for ISDN ports of Horst.

   CONFIG_PACKAGE_kmod-ixp4xx-eth        Kernel modules->Network Devices->kmod-ixp4xx-eth

   CONFIG_PACKAGE_kmod-hbxntpower        Kernel modules->Other modules->kmod-hbxntpower
	This package provides a driver for controlling the power on the ISDN connector labeled 'S0 int'
	of Horst. It is not/not yet part of the official OpenWrt. You must copy the hbxntpower package
	to your trunk_rootdir/package directory in order for this option to show up.

   CONFIG_PACKAGE_kmod-ixp4xx-beeper     Kernel modules->Other modules->kmod-ixp4xx-beeper
	Optional. Beeper has never been used/tested by me. Don't know if it really exists on Horst.

   CONFIG_PACKAGE_kmod-usb-ohci          Kernel modules->USB Support->kmod-usb-ohci

   CONFIG_PACKAGE_kmod-usb2              Kernel modules->USB Support->kmod-usb2

   different                             Network->Telephony
	Several optional packages relating to telephony.


After having exited from 'make menuconfig', simple use 'make' to build an
incomplete (some kernel patches missing) version of your Horst firmware.
This will also generate the file tree trunk_rootdir/build_dir, which
is required for the last step #4.



4. Linux kernel patches for OpenWrt on Horst, and Rebuilding
============================================================

You may download a patch file for Horst specific adjustment to the kernel
used by Openwrt from  http://arny.tjps.eu/OpenWrt/horst/kernelpatch/

To apply this patchfile, follow these steps:

 * cd into the kernel root directory:

	cd  trunk_rootdir/build_dir/linux-ixp4xx_generic/linux-3.3.8

 * Apply the kernel patches. A dry run is recommended, so any patch problems
   will be detected before any changes are made:

	patch -p1 --dry <dir_of_patchfile/horstkernel.patch

 * If no errors were reported previously, do the real patching:

	patch -p1 <dir_of_patchfile/horstkernel.patch

 * Recall 'make' to build the OpenWrt system with the new patches:

 	cd  trunk_rootdir
	make


BTW, patching the kernel is done JUST ONCE. At any later time, however,
you can do a 'make menuconfig', 'make' again to change your configuration
and recreate the Horst firmware.


