OpenWrt Forum Archive

Topic: Help adding custom package to OpenWRT.

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,
I need to add a custom package to OpenWRT.I have downloaded OpenWRT SDK but i don't understand how to edit the Makefile to let the make command compile my package.

First of all,the package i have to add is a custom version of olsrd..I've downloaded the source files via git and modified what i needed.Then i ve red a guide that told me to put the "olsrd" dir into the package dir of OpenWRT-SDK and to create a new Makefile to build the package.
The problem is that my olsrd package comes with a premade Makefile,do I have to edit this Makefile or should I create a new one?Let me explain,i have:

- A Makefile in Desktop/OpenWRT-SDK/package
- A Makefile in Desktop/OpenWRT-SDK/package/olsrd

I guess that the first one has general info to build the different packages in the package dir,the second one has specific info for the package.Imo i should edit the first..but how?
I hope that u will understand what I wrote,I'm sorry but english is not my main language sad.

Thanks in advance.

I understand this from your explanation..
You have a package in the package folder. somewhere ( existing one).
lets take for example the ppp package.
on my machine its on.. /home/mohnkhan/wrttrunk/trunk/package/ppp

The openwrt first looks for the file in the below given directory.

/home/mohnkhan/wrttrunk/trunk/dl

look at the make file in the ppp
/home/mohnkhan/wrttrunk/trunk/package/ppp/Makefile

#
# Copyright (C) 2006-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=ppp
PKG_VERSION:=2.4.4
PKG_RELEASE:=4

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.samba.org/pub/ppp/
PKG_MD5SUM:=183800762e266132218b204dfb428d29


modify this md5 sum to reflect your files md5 sum.

for this place ur modified ppp file in /home/mohnkhan/wrttrunk/trunk/dl/ppp-2.4.4.tar.gz
now do a MD5 sum for this file..
[mohnkhan@localhost dl]$ md5sum ppp-2.4.4.tar.gz
183800762e266132218b204dfb428d29  ppp-2.4.4.tar.gz
[mohnkhan@localhost dl]$

notice both the md5sum in the make file and the one on the commad shell should be same..

no go forward and compile it..

You can modify this method for your package..
if you still face difficulties.. just drop another message..
me or somebody else will be able to help you out..

Hope this helps

Regards

First of all,ty very much for helping me!I've done what u told me and have started making the vmware image that i need via the make command in the main directory of OpenWRT.Unfortunately i encounter an error message when "make" starts to work on my package,it says:

make[3] -C package/olsrd compile
make -r world: build failed. Please re-run make with V=99 to see what's going on
make: *** [world] Error 1

So i've tried to do:

vittorio@vittorio-laptop:~/Scrivania/SRC_WRT/8.09$ make package/olsrd
make: «package/olsrd» è aggiornato. ( <-It means "Is up-to-date")

What should I do?

Regards smile

[quote=VittorioUnfortunately i encounter an error message when "make" starts to work on my package,it says:

make[3] -C package/olsrd compile
make -r world: build failed. Please re-run make with V=99 to see what's going on
make: *** [world] Error 1

If you run "make world V=99" you'll see all the output that compiling the package by hand would produce.

a standard "make" or "make world" hides all the detail.

If you try compiling the package normally from source (not within the openwrt build environment) does it compile ?

Post #5

Yes it compiles and work.Btw I've solved the problem with "make"(i guess it was only a name mismatch between my package and the name of the file targetted by the Makefile) and finally my OpenWRT image contains the olsrd package and it works ^^!

Ty very much to all of you that helped me smile!

Best regards

The discussion might have continued from here.