[Click] How to port Click to the Kamikaze openwrt OS ?

Jonathan Kirchhoff kirchho at cs.uni-bonn.de
Wed Oct 14 06:06:33 EDT 2009


Am 14.10.09 05:02, schrieb Dennis D.J.:
> hi, I'm tyring to do the same thing about complie click as a module of kamikaze(OpenWrt OS), I wonder what's the step of cross complie. I have managed to crosscomplie the kamikaze 8.09 in my x86 PC, but  I got no idea how to compile a module for a embeded linux. Is there anybody who can tell m? Thx a lot!
>
> 2009-10-14
>
>
>
> Dennis D.J.
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>    
Hi,

a few months ago, we were facing the same problem.

Crosscompiling Click Userlevel for OpenWRT (in our case it was for a 
Mipsel based Asus WL500GP) is possible, but it might be tricky if you 
have never used the buildroot before.

Once you have figured out how to build packages using the OpenWRT 
Buildroot, all you need is a proper makefile. This is the Makefile we used:

#
# Click 1.7.0rc1
#
# OpenWRT 8.09 Kamikaze
#

include $(TOPDIR)/rules.mk

PKG_NAME:=click
PKG_VERSION:=1.7.0rc1
PKG_RELEASE:=1

PKG_SOURCE_URL:=http://read.cs.ucla.edu/click/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

include $(INCLUDE_DIR)/package.mk

define Package/click
   SECTION:=net
   CATEGORY:=Network
   DEPENDS:=@BROKEN
   MENU:=1
   TITLE:=The Click Modular Router
   URL:=http://www.read.cs.ucla.edu/click/
endef

define Package/click/description
The Click Modular Router
endef

BUILDOPTS = \
         BUILD_CXX="g++ -I $(PKG_BUILD_DIR)/include-host" \
         BUILD_DL_LIBS="-ldl"

define Build/Configure
     (cd $(PKG_BUILD_DIR); \
         rm -rf config.{cache,status} ; \
         CONFIG_SITE= \
         ./configure; \
         rm -rf include-host; \
         $(CP) include include-host; \
         rm -rf config.{cache,status} ; \
         $(TARGET_CONFIGURE_OPTS) \
         CXXFLAGS="-static -Os -MD" \
         CFLAGS="-static -MD" \
         CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
         LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
         $(BUILDOPTS) \
         ./configure \
           --prefix=/usr \
           --target=$(GNU_TARGET_NAME) \
           --host=$(GNU_TARGET_NAME) \
           --build=$(GNU_HOST_NAME) \
           --enable-wifi \
           --disable-linuxmodule \
           --enable-tools=mixed \
              --disable-dynamic-linking \
     )
endef

define Build/Compile
     rm -rf $(PKG_INSTALL_DIR)
     mkdir -p $(PKG_INSTALL_DIR)
     $(CONF_OPTS) \
     $(MAKE) -C $(PKG_BUILD_DIR) \
         $(BUILDOPTS)
endef

define Package/click/install
     $(INSTALL_DIR) $(1)/usr/bin
     $(CP) $(PKG_BUILD_DIR)/userlevel/click $(1)/usr/bin/click
     $(CP) $(PKG_BUILD_DIR)/tools/click-align/click-align 
$(1)/usr/bin/click-align
endef

$(eval $(call BuildPackage,click))

The buildroot documentation helps a lot, so be sure to have a look:
http://downloads.openwrt.org/docs/buildroot-documentation.html

Another website, that might be interesting:
http://sarwiki.informatik.hu-berlin.de/Hacking_the_Netgear_wgt634u#Compiling_Click

Regards
Jonathan


More information about the click mailing list