| | 4 | ======================= |
| | 5 | |
| | 6 | So, you want to run wifidog on one of linksys' WRT wireless routers! |
| | 7 | |
| | 8 | OpenWRT is the embedded linux-gnu bundle that runs on the linksys wrt |
| | 9 | series routers. |
| | 10 | |
| | 11 | OpenWRT's home page is http://www.openwrt.org |
| | 12 | |
| | 13 | To build wifidog so that it may be run on the linksys wrt routers you |
| | 14 | must first obtain the OpenWRT toolchain. This toolchain is a set of |
| | 15 | compilers and other software development tools that will allow you, |
| | 16 | running on your intel/pentium/mac computer to compile and develop software |
| | 17 | that is to run on the mips based linksys wrt series routers, which is |
| | 18 | based on another computer cpu chip entirely. |
| | 19 | |
| | 20 | You have four options for building wifidog using the OpenWRT toolchain. |
| | 21 | |
| | 22 | 1. get the prebuilt, minimal OpenWRT toolchain. |
| | 23 | wget http://downloads.openwrt.org/whiterussian/newest/OpenWrt-SDK-Linux-i686-1.tar.bz2 |
| | 24 | ... unpack the tarball, etc |
| | 25 | ... the full path to the OpenWrt-SDK-Linux-i686-1 directory is your BUILDROOT |
| | 26 | |
| | 27 | cd wifidog directory (where this README is) |
| | 28 | ipkg/rules-rc4-sdk BUILDROOT=<Full Path to OpenWrt SDK> |
| | 29 | |
| | 30 | If it works (!) you will have an ipkg file in your wifidog directory |
| | 31 | with the wifidog package in it. You can then boot up your OpenWrt |
| | 32 | router, copy the ipkg to it, and install it using the ipkg commands. |
| | 33 | |
| | 34 | You should also make sure that the wifidog prereqs are already |
| | 35 | installed on the router before you go to run wifidog. |
| | 36 | |
| | 37 | The prereqs are: |
| | 38 | * iptables command and modules mac, mark and MARK |
| | 39 | * iptables kernel module mac |
| | 40 | * libpthread |
| | 41 | |
| | 42 | These are all packages you can install on your running OpenWrt router |
| | 43 | using the ipkg commands. If the router is on the net, the ipkg |
| | 44 | commands can download the packages from www.openwrt.org, just like |
| | 45 | debian apt-get or fedora yum or up2date. |
| | 46 | |
| | 47 | 2. checkout the stable release of the full OpenWRT toolchain. |
| | 48 | This will let you build your own flash image for the router. |
| | 49 | Since the above minimal toolchain isn't precompiled for all |
| | 50 | computers, this is the way to go if you want to use the toolchain |
| | 51 | on a non-intel computer, like a Mac. |
| | 52 | |
| | 53 | svn checkout https://svn.openwrt.org/openwrt/branches/whiterussian OpenWrt-ToolChain-Linux |
| | 54 | ... follow the instructions in the README, INSTALL |
| | 55 | ... typically, ./configure; make; make install |
| | 56 | ... the full path to the OpenWrt-ToolChain-Linux directory is your BUILDROOT |
| | 57 | |
| | 58 | So, you've got your toolchain built (with it's version of gcc, ld, |
| | 59 | etc etc). Now on to compiling wifidog: |
| | 60 | |
| | 61 | cd wifidog directory (where this README is) |
| | 62 | ipkg/rules-rc4 BUILDROOT=<Full Path to OpenWrt toolchain> |
| | 63 | |
| | 64 | If it works (!) you will have an ipkg file in your wifidog directory |
| | 65 | with the wifidog package in it and all the prereqs. You can then boot |
| | 66 | up your OpenWrt router, copy the ipkg to it, and install it using the |
| | 67 | ipkg commands. |
| | 68 | |
| | 69 | The advantage with this method is that the wifidog build process will |
| | 70 | draw into itself all it's openwrt prereqs. |
| | 71 | |
| | 72 | The other big plus is that you can cut your own custom openwrt flash |
| | 73 | image that has all the things you want in it, like asterisk or java, |
| | 74 | and of course including wifidog. |
| | 75 | |
| | 76 | 3. checkout the bleeding edge release of the full OpenWRT toolchain |
| | 77 | Careful, you may brick your router. |
| | 78 | Currently, if you want to run linux 2.6, this is the only way to go. |
| | 79 | Plus, there are new tools, apps, and a better build process. |
| | 80 | |
| | 81 | svn checkout https://svn.openwrt.org/openwrt/trunk OpenWrt-ToolChain-Linux |
| | 82 | ... follow the instructions in the README, INSTALL |
| | 83 | ... typically, ./configure; make; make install |
| | 84 | ... the full path to the OpenWrt-ToolChain-Linux directory is your BUILDROOT |
| | 85 | |
| | 86 | The rest of this recipe is just like 2. |
| | 87 | |
| | 88 | 4. you want to use a pre-rc4 version of the OpenWRT toolchain. |
| | 89 | You have to work with the full toolchain, so the recipe is like 2. |
| | 90 | except for the build of wifidog: |
| | 91 | |
| | 92 | cd wifidog directory (where this README is) |
| | 93 | ipkg/rules BUILDROOT=<Full Path to pre-rc4 OpenWrt toolchain> |
| | 94 | |
| | 95 | This builds wifidog using the older OpenWRT. |
| | 96 | |
| | 97 | |
| | 98 | ---- How to integrate wifidog with the OpenWRT flash image build process ---- |
| | 99 | |
| | 100 | Go to the OpenWRT build root. This is the top level directory |
| | 101 | from the tarball or from the svn checkout. You should find a README or |
| | 102 | README.SDK file there, and most importantly a "package" directory. |
| | 103 | |
| | 104 | You'll notice that under the package subdirectory are specifications for all |
| | 105 | the applications available under OpenWRT. As of RC4, wifidog is not yet there. |
| | 106 | To integrate wifidog into the build process you'll need to add a specification |
| | 107 | for wifidog into the package directory, and add wifidog to the build list. |
| | 108 | |
| | 109 | BUILDROOT=<OpenWRT build root> |
| | 110 | mkdir $BUILDROOT/package/wifidog |
| | 111 | mkdir $BUILDROOT/package/wifidog/ipkg |
| | 112 | mkdir $BUILDROOT/package/wifidog/patches |
| | 113 | |
| | 114 | Create a wifidog Config.in file. This will define wifidog to the OpenWRT build process. |
| | 115 | When configuring OpenWRT you run "make menuconfig". This compiles a few things, and |
| | 116 | then presents a menu textual-ui that allows you select various options for the build. |
| | 117 | Among other things you can choose the application packages that are part of the build. |
| | 118 | A wifidog Config.in file will put an entry for wifidog in the menu ui. |
| | 119 | |
| | 120 | cp package/wifidog/Config.in $BUILDROOT/package/wifidog/Config.in |
| | 121 | |
| | 122 | Create a Makefile. This will be used by the OpenWRT build process to obtain (download) |
| | 123 | configure and build wifidog. |
| | 124 | |
| | 125 | cp package/wifidog/Makefile $BUILDROOT/package/wifidog/Makefile |
| | 126 | |
| | 127 | Create a debian package file. This will be used by the OpenWRT build process to make |
| | 128 | an ipkg file. |
| | 129 | |
| | 130 | cp package/wifidog/ipkg/wifidog.control $BUILDROOT/package/wifidog/ipkg/wifidog.control |
| | 131 | |
| | 132 | Create a list of the config files that will be installed |
| | 133 | |
| | 134 | cp package/wifidog/ipkg/wifidog.conffiles $BUILDROOT/package/wifidog/ipkg/wifidog.conffiles |
| | 135 | |
| | 136 | Create an initialization script that will start up wifidog |
| | 137 | |
| | 138 | cp scripts/init.d/wifidog $BUILDROOT/package/wifidog/ipkg/wifidog.init |
| | 139 | |
| | 140 | Edit the OpenWRT package Config.in to add wifidog to the list of packages |
| | 141 | |
| | 142 | vi $BUILDROOT/package/Config.in |
| | 143 | |
| | 144 | Add the following line to the "Network" section: |
| | 145 | |
| | 146 | source "package/wifidog/Config.in" |
| | 147 | |
| | 148 | Save it. |
| | 149 | |
| | 150 | Edit the OpenWRT package Makefile add wifidog to the list of packages |
| | 151 | |
| | 152 | vi $BUILDROOT/package/Makefile |
| | 153 | |
| | 154 | Add the following line with the rest of the lines like that: |
| | 155 | |
| | 156 | package-$(BR2_PACKAGE_WIFIDOG) += wifidog |
| | 157 | |
| | 158 | Add the following line to the dependency section: |
| | 159 | |
| | 160 | wifidog-compile: libpthread-compile iptables-compile |
| | 161 | |
| | 162 | Save it. |