Building OpenWrt with the OHGF extensions
-----------------------------------------

1. Prepare the OpenWrt source distribution.

Fetch the main OpenWrt distribution:

  ~/openwrt$ git clone git://git.openwrt.org/openwrt.git trunk

Fetch the LuCI distribution (we'll be modifying this too):

  ~/openwrt$ git clone git://nbd.name/luci.git luci


2. Set up the package feeds.

Create the file trunk/feeds.conf and add the following lines:

  src-link luci /home/USER/openwrt/luci
  src-git packages git://git.openwrt.org/packages.git
  src-git routing git://github.com/openwrt-routing/packages.git


3. Patch the distribution.

Apply the OHGF patches in order:

  ~/openwrt/trunk$ patch -p1 < 0001-Add-transient-sentinel-files.patch
  ~/openwrt/trunk$ patch -p1 < 0002-Add-lightweight-syslog-style-logging.patch
  ~/openwrt/trunk$ patch -p1 < 0003-Add-repackage-option.patch
  ~/openwrt/trunk$ patch -p1 < 0004-Get-cert-name-from-src-name.patch
  ~/openwrt/trunk$ patch -p1 < 0005-DHCP-options-to-discover-the-ISP-s-repo-and-cert.patch
  ~/openwrt/trunk$ patch -p1 < 0006-postinst-scripts-for-6relayd-odhcp6c.patch
  ~/openwrt/trunk$ patch -p1 < 0007-required-packages.patch
  ~/openwrt/trunk$ patch -p1 < 0008-upgrade-safe.patch

Also apply the LuCI patches:

  ~/openwrt/luci$ patch -p1 < 0011-luci-add-option-for-a-patches-directory.patch
  ~/openwrt/luci$ patch -p1 < 0012-luci-display-the-opkg-log.patch


4. Configure OpenWrt.

~/openwrt/ohgf-build$ make menuconfig

- Set the Target System to "Atheros AR71xx"
- Set the Target Profile to "NETGEAR WNDR3700"

- In Base system, unselect 'opkg' and select 'opkg-smime' instead.
- Still in Base system, select 'upgrade-safe' and 'required-packages'.

- In Image configuration, go to Package signing options, and enter the
  paths to an OpenSSL signing key and a self-signed certificate. You
  may optionally also specify a file containing the passphrase for
  the signing key, or choose to enter the passphrase manually during
  the build.

- In Image configuration, go to Version configuration options. Enter a
  Release version nickname of "ohgf", and set the Release repository
  to the URL of your local package repository.

- Go to Network, change 6relayd to <M>, change odhcp6c to <M>
- Go to Network/Firewall, change ip6tables to <M>
- Go to Kernel modules/Netfilter, change kmod-ip6tables to {M}
- Got to Kernel modules/Network support, change kmod-ipv6 to {M}

- Exit and save configuration.


5. Build the system.

  ~/openwrt/ohgf-build$ make -j8 V=s

(Be prepared to wait a while.)
