[OLSR-users] patch to olsrd-current to include full openwrt building

Paul Wouters (spam-protected)
Wed Feb 9 04:19:47 CET 2005


Hi guys,

Attached is a patch that adds support for cross compiling to the openwrt
platform, and includes ipkg package building.

eg:

[(spam-protected) olsrd-paul]# make openwrt
Please use OPENWRT, eg: make OPENWRT=/usr/local/openwrt openwrt
[(spam-protected) olsrd-paul]# make OPENWRT=/usr/local/movies/openwrt openwrt

[ normal build process, but then: ]

Packaging
Building olsrd_cvs20050208_mipsel.ipk
Building olsrd-httpinfo_cvs20050208_mipsel.ipk
done
total 112
-rw-r--r--  1 root root 80434 Feb  9 03:48 olsrd_cvs20050208_mipsel.ipk
-rw-r--r--  1 root root 18266 Feb  9 03:48 olsrd-httpinfo_cvs20050208_mipsel.ipk

The openwrt building script is in packaging/openwrt/

I will also give you a spec file for package building for Fedora Core:
(eg: packaging/fedora/olsrd.spec)



-------------- next part --------------
diff -c -N -r olsrd-current/Makefile olsrd-paul/Makefile
*** olsrd-current/Makefile	2005-02-09 03:34:51.905998688 +0100
--- olsrd-paul/Makefile	2005-02-09 03:38:22.861928512 +0100
***************
*** 202,208 ****
  $(CFGOBJS):
  		$(MAKE) -C $(CFGDIR)
  
! .PHONY: help libs clean_libs clean uberclean install_libs install_bin install
  
  help:
  	@echo
--- 202,208 ----
  $(CFGOBJS):
  		$(MAKE) -C $(CFGDIR)
  
! .PHONY: help libs clean_libs clean uberclean install_libs install_bin install openwrt
  
  help:
  	@echo
***************
*** 225,230 ****
--- 225,233 ----
  	@echo '************************************'
  	@echo
  
+ openwrt:
+ 		@./packaging/openwrt/build-openwrt.sh
+ 
  clean:
  		rm -f $(OBJS) olsrd olsrd.exe
  		$(MAKE) -C src/cfgparser clean
***************
*** 233,238 ****
--- 236,242 ----
  		rm -f $(DEPFILE) $(DEPFILE).bak *~
  		rm -f src/*[o~] src/linux/*[o~] src/unix/*[o~] src/win32/*[o~]
  		rm -f src/bsd/*[o~] 
+ 		rm -rf ipkg
  		$(MAKE) -C src/cfgparser uberclean
  
  install_bin:
***************
*** 304,306 ****
--- 308,311 ----
  		$(TAGCMD) -o $(TAGFILE) $(SRCS) $(HDRS) $(wildcard src/cfgparser/*.c) $(wildcard src/cfgparser/*.h)
  
  sinclude	$(DEPFILE)
+ 
diff -c -N -r olsrd-current/packaging/openwrt/build-openwrt.sh olsrd-paul/packaging/openwrt/build-openwrt.sh
*** olsrd-current/packaging/openwrt/build-openwrt.sh	1970-01-01 01:00:00.000000000 +0100
--- olsrd-paul/packaging/openwrt/build-openwrt.sh	2005-02-09 03:32:07.007067000 +0100
***************
*** 0 ****
--- 1,95 ----
+ #!/bin/sh
+ 
+ SRCROOT=`pwd`
+ 
+ if [ -z $OPENWRT ]
+ then
+ 	echo "Please use OPENWRT, eg: make OPENWRT=/usr/local/openwrt openwrt"
+ 	exit
+ fi
+ CROSS=$OPENWRT/buildroot/build_mipsel/staging_dir/mipsel-linux-uclibc/bin
+ CC=$CROSS/gcc
+ LD=$CROSS/ld
+ RANLIB=$CROSS/ranlib
+ AR=$CROSS/ar
+ STRIP=$CROSS/strip
+ ARCH=mips
+ 
+ if [ ! -f $CC ]
+ then
+ 	echo "gcc not found at $CC, aborted."
+ 	exit
+ fi
+ 
+ echo "Building olsrd"
+ make OS=linux
+ #echo "Building modules"
+ #for i in lib/*
+ #do
+ #   cd $SRCROOT/$i
+ #   make OS=linux
+ #done
+ echo "Building httpinfo"
+ cd $SRCROOT/lib/httpinfo
+ make OS=linux
+ 
+ echo "Packaging"
+ cd $SRCROOT
+ echo "Building olsrd_cvs20050208_mipsel.ipk"
+ mkdir -p $SRCROOT/ipkg/olsrd
+ install -d $SRCROOT/ipkg/olsrd/etc $SRCROOT/ipkg/olsrd/usr/sbin
+ cp files/olsrd.conf.default $SRCROOT/ipkg/olsrd/etc/olsrd.conf
+ cp olsrd $SRCROOT/ipkg/olsrd/usr/sbin
+ touch $SRCROOT/ipkg/olsrd/postinst
+ echo "2.0" > $SRCROOT/ipkg/olsrd/debian_binary
+ echo "/etc/olsrd.conf" >  $SRCROOT/ipkg/olsrd/conffiles
+ cat  << EOF >> $SRCROOT/ipkg/olsrd/control
+ Package: olsrd
+ Priority: optional
+ Section: Communications
+ Version: cvs20050208
+ Architecture: mipsel
+ Maintainer: Paul Wouters <(spam-protected)>
+ Description: OLSRD daemon
+ Source: cvs.sourceforge.net:/cvsroot/olsrd
+ EOF
+ cd $SRCROOT/ipkg/olsrd
+ tar zcf control.tar.gz ./control ./postinst ./conffiles
+ tar zcf data.tar.gz usr/sbin/olsrd
+ tar zcf ../olsrd_cvs20050208_mipsel.ipk ./debian_binary ./data.tar.gz ./control.tar.gz
+ rm -r  $SRCROOT/ipkg/olsrd
+ 
+ cd $SRCROOT
+ echo "Building olsrd-httpinfo_cvs20050208_mipsel.ipk"
+ mkdir -p $SRCROOT/ipkg/olsrd-httpinfo
+ echo "2.0" > $SRCROOT/ipkg/olsrd-httpinfo/debian_binary
+ install -d $SRCROOT/ipkg/olsrd-httpinfo/usr/lib
+ cp $SRCROOT/lib/httpinfo/olsrd_httpinfo.so.0.1 $SRCROOT/ipkg/olsrd-httpinfo/usr/lib
+ 
+ touch $SRCROOT/ipkg/olsrd-httpinfo/conffiles
+ cat  << EOF >> $SRCROOT/ipkg/olsrd-httpinfo/control
+ Package: olsrd_httpinfo
+ Priority: optional
+ Section: Communications
+ Version: cvs20050208
+ Architecture: mipsel
+ Maintainer: Paul Wouters <(spam-protected)>
+ Description: OLSRD http info plugin
+ Source: cvs.sourceforge.net:/cvsroot/olsrd
+ EOF
+ 
+ cat  << EOF >> $SRCROOT/ipkg/olsrd-httpinfo/postinst
+ cat << INNEREO >> /etc/olsrd.conf
+ LoadPlugin "/usr/lib/olsrd_httpinfo.so.0.1"
+ {
+ PlParam "Port" "8080"
+ }
+ INNEREO
+ EOF
+ cd $SRCROOT/ipkg/olsrd-httpinfo
+ tar zcf control.tar.gz ./control ./postinst ./conffiles
+ tar zcf data.tar.gz usr/lib/olsrd_httpinfo.so.0.1
+ tar zcf ../olsrd-httpinfo_cvs20050208_mipsel.ipk ./debian_binary ./data.tar.gz ./control.tar.gz
+ rm -r  $SRCROOT/ipkg/olsrd-httpinfo
+ 
+ echo "done"
+ cd $SRCROOT
+ ls -l ipkg


More information about the Olsr-users mailing list