Skip to content

Commit

Permalink
* Integrate with OpenWRT kamikaze build system
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitg committed Mar 25, 2008
1 parent b57ab16 commit 6e7de29
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 22 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# $Id$
2008-03-24 Benoit Gr�goire <[email protected]>
* Integrate with OpenWRT kamikaze build system

2007-11-01 Benoit Gr�goire <[email protected]>
* Apply portability patches by David Young <[email protected]>. These have been reviewed, but not tested.

Expand Down
15 changes: 12 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ EXTRA_DIST = \
doc:
$(MAKE) -C doc doc

.PHONY: ipk
ipk: dist
.PHONY: whiterussianipk
whiterussianipk: dist
make -C $(OPENWRTSDK) distclean
mkdir -p $(OPENWRTSDK)/dl
cp -f ${srcdir}/wifidog-@[email protected] $(OPENWRTSDK)/dl/
make -C ${srcdir}/contrib/build-openwrt-ipk/wifidog TOPDIR=$(OPENWRTSDK) PKG_MD5SUM= V=99
make -C ${srcdir}/contrib/build-openwrt-whiterussianipk/wifidog TOPDIR=$(OPENWRTSDK) PKG_MD5SUM= V=99
@echo DONE. If there were no errors, your package should be in: $(OPENWRTSDK)/bin/packages/

.PHONY: kamikazeipk
kamikazeipk: dist
make -C $(OPENWRTSDK) distclean
mkdir -p $(OPENWRTSDK)/dl
cp -f ${srcdir}/wifidog-@[email protected] $(OPENWRTSDK)/dl/
make -C ${srcdir}/contrib/build-openwrt-kamikazeipk/wifidog TOPDIR=$(OPENWRTSDK) PKG_MD5SUM= V=99 SDK=1 DEVELOPER=1
@echo DONE. If there were no errors, your package should be in: $(OPENWRTSDK)/bin/packages/

.PHONY: rpm
rpm: dist
cp ${builddir}wifidog.spec /usr/src/RPM/SPECS
Expand Down
60 changes: 46 additions & 14 deletions README.openwrt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ $Id$
OpenWRT specific README
=======================

So, you want to run wifidog on one of linksys' WRT wireless routers!
So, you want to run wifidog on one of linksys's WRT wireless routers!

OpenWRT is the embedded linux-gnu bundle that runs on the linksys wrt
series routers.
OpenWRT is the embedded linux-gnu bundle that runs on the linksys WRT
series routers (among numerous others).

OpenWRT's home page is http://www.openwrt.org
OpenWRT's home page is http://openwrt.org/

---- I just want to RUN the thing: ----
-DO NOT use the wifidog packages distributed by OpenWRT (you are asking for trouble, they are broken in various ways; you will get no support if you do)
-Use the official wifidog packages on sourceforge (currently only available for whiterussian.

---- I want to develop and test on OpenWRT ----

To build wifidog so that it may be run on the linksys wrt routers you
must first obtain the OpenWRT toolchain. This toolchain is a set of
Expand All @@ -17,21 +23,31 @@ running on your intel/pentium/mac computer to compile and develop software
that is to run on the mips based linksys wrt series routers, which is
based on another computer cpu chip entirely.

You have four options for building wifidog using the OpenWRT toolchain.
You have several options for building wifidog using the OpenWRT toolchain.

Option 1. get the prebuilt, minimal OpenWRT toolchain (The OpenWRT SDK), and give the makefile it's path. This is the best option, assuming you have a x86_64 Os (the SDK is distributed only for x86_64).

1. get the prebuilt, minimal OpenWRT toolchain, and give the makefile it's path:
For OpenWRT 0.9 (Whiterussian):
cd ~
wget http://downloads.openwrt.org/whiterussian/newest/OpenWrt-SDK-Linux-i686-1.tar.bz2
tar -jxvf OpenWrt-SDK-Linux-i686-1.tar.bz2
make ipk OPENWRTSDK=~/OpenWrt-SDK-Linux-i686-1/
cd wifidog
make whiterussianipk OPENWRTSDK=~/OpenWrt-SDK-Linux-i686-1/

If it works (!) you will have an ipkg file in $(OPENWRTSDK)/bin/packages/bin/packages/
For OpenWRT Kamikaze:
cd ~
wget http://downloads.openwrt.org/kamikaze/7.09/brcm-2.4/OpenWrt-SDK-brcm-2.4-for-Linux-x86_64.tar.bz2
tar -jxvf OpenWrt-SDK-brcm-2.4-for-Linux-x86_64.tar.bz2
cd wifidog
make kamikazeipk OPENWRTSDK=~/OpenWrt-SDK-brcm-2.4-for-Linux-x86_64

If it works (!) you will have an ipkg file in $(OPENWRTSDK)/bin/packages/
You can then boot up your OpenWrt
router, copy the .ipk to it, and install it using the ipkg commands.

You should also make sure that the wifidog prereqs are already
installed on the router before you go to run wifidog. Note that the
package will check this for you.
installed on the router before you try to run wifidog. Note that if you build the
packages with the instructions above, they will download the required dependencies auomatically (if you have an internet connecion on yout router) and will refuse to install without them.

The prereqs are:
* iptables command and modules mac, mark and MARK
Expand All @@ -43,9 +59,25 @@ You have four options for building wifidog using the OpenWRT toolchain.
commands can download the packages from www.openwrt.org, just like
debian apt-get or fedora yum or up2date.

---- How to integrate wifidog with the OpenWRT flash image build process ----
Option 2. Build your own SDK (or find someone to do it for you)
cd ~
wget http://downloads.openwrt.org/kamikaze/7.09/kamikaze_7.09.tar.bz2
tar -jxvf kamikaze_7.09.tar.bz2
cd kamikaze_7.09
make menuconfig #(Make sure you build the SDK in "special targets")
make #(could take hours downloading and compiling all dependencies)
Follow the instructions in Option 1, using the SDK you build instead of downloading it.

Option 3. Use the full buildroot directly (time consuming...)
cd wifidog
make dist
cd ~
wget http://downloads.openwrt.org/kamikaze/7.09/kamikaze_7.09.tar.bz2
tar -jxvf kamikaze_7.09.tar.bz2
cp -R wifidog/contrib/build-openwrt-kamikazeipk/wifidog kamikaze_7.09/package/
cp wifidog/wifidog-1.1.5.tar.gz kamikaze_7.09/dl/
cd kamikaze_7.09
make menuconfig #(Follow instructions on OpenWRT's site to setup your buildroot for your platform)
make #(could take hours downloading and compiling all dependencies)

Download the OpenWRT imagebuilder
-Add the ipkg you built above in the /packages directory
-Add the line "wifidog" in the various files in /lists

5 changes: 2 additions & 3 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AC_SUBST(BUILDROOT)

WIFIDOG_MAJOR_VERSION=1
WIFIDOG_MINOR_VERSION=1
WIFIDOG_MICRO_VERSION=4
WIFIDOG_MICRO_VERSION=5
WIFIDOG_VERSION=$WIFIDOG_MAJOR_VERSION.$WIFIDOG_MINOR_VERSION.$WIFIDOG_MICRO_VERSION

AC_SUBST(WIFIDOG_MAJOR_VERSION)
Expand Down Expand Up @@ -81,8 +81,7 @@ AC_SUBST(enable_html_docs)
AC_SUBST(enable_latex_docs)
])

# check for doxygen
# ----------------------------------------------------------------------------
# Acutally perform the doxygen check
BB_ENABLE_DOXYGEN

# check for pthread
Expand Down
61 changes: 61 additions & 0 deletions contrib/build-openwrt-kamikazeipk/wifidog/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# Copyright (C) 2006,2008 OpenWrt.org
# Copyright (C) 2008 Technologies Coeus inc.
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$

include $(TOPDIR)/rules.mk

PKG_NAME:=wifidog
PKG_VERSION:=1.1.5
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:= @SF/$(PKG_NAME)
PKG_MD5SUM:=

PKG_FIXUP = libtool

include $(INCLUDE_DIR)/package.mk

define Package/wifidog
SUBMENU:=Captive Portals
SECTION:=net
CATEGORY:=Network
DEPENDS:=+kmod-ipt-extra +kmod-ipt-ipopt +kmod-ipt-nat +libpthread
TITLE:=A wireless captive portal solution
URL:=http://www.wifidog.org
endef

define Package/wifidog/description
The Wifidog project is a complete and embeddable captive
portal solution for wireless community groups or individuals
who wish to open a free Hotspot while still preventing abuse
of their Internet connection.
endef

define Package/wifidog/conffiles
/etc/wifidog.conf
endef

MAKE_FLAGS += \
DESTDIR="$(PKG_INSTALL_DIR)" \
all install

define Package/wifidog/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/init.d/wifidog $(1)/usr/bin/wifidog-init
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wifidog $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wdctl $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttpd.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) $(PKG_BUILD_DIR)/wifidog.conf $(1)/etc/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/wifidog
endef

$(eval $(call BuildPackage,wifidog))
12 changes: 12 additions & 0 deletions contrib/build-openwrt-kamikazeipk/wifidog/files/wifidog.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50

start() {
/usr/bin/wifidog-init start
}

stop() {
/usr/bin/wifidog-init stop
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- wifidog.org/wifidog.conf 2008-03-23 16:24:48.000000000 -0400
+++ wifidog/wifidog.conf 2008-03-23 16:26:10.000000000 -0400
@@ -30,7 +30,7 @@
# Set this to the internal interface (typically your wifi interface).
# Typically br0 for OpenWrt, and eth1, wlan0, ath0, etc. otherwise

-GatewayInterface br0
+GatewayInterface br-lan

# Parameter: GatewayAddress
# Default: Find it from GatewayInterface
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ http_callback_404(httpd *webserver, request *r)

memset(tmp_url, 0, sizeof(tmp_url));
/*
* XXX Note the code belows assume that the client's request is a plain
* XXX Note the code below assumes that the client's request is a plain
* http request to a standard port. At any rate, this handler is called only
* if the internet/auth server is down so it's not a huge loss, but still.
*/
Expand Down Expand Up @@ -140,7 +140,7 @@ http_callback_status(httpd *webserver, request *r)
http_wifidog_footer(r);
free(status);
}
/** @brief Convenience function to redirect the web browser to the authe server
/** @brief Convenience function to redirect the web browser to the auth server
* @param r The request
* @param urlFragment The end of the auth server URL to redirect to (the part after path)
* @param text The text to include in the redirect header ant the mnual redirect title */
Expand Down

0 comments on commit 6e7de29

Please sign in to comment.