Hi
Brecht Vermeulen
brecht.vermeulen at rug.ac.be
Thu Jun 21 00:58:08 EDT 2001
Hi Robert,
we have also written some elements within an own package (as in
etc/package), this is not in elements/local, but maybe it can help :
1) the element has to announce itself with
EXPORT_ELEMENT(CopyDSCP)
in the .cc file (see the other elements)
maybe this solves already your problem
2) our Makefile looks like :
# Change these if needed
LINUXDIR = /usr/src/linux
CLICKDIR = /usr
CLICK_INCLUDE = $(CLICKDIR)/include
# needed for click-buildtool
CLICK_BIN = $(CLICKDIR)/bin
############
# {TARGET} #
############
PACKAGE = harmonics
TARGETS = $(PACKAGE).ko
all: $(TARGETS)
##############
# {ELEMENTS} #
##############
ELEMENTS = copydscp.cc lookuponu.cc
copydscp.ko: copydscp.hh
lookuponu.ko: lookuponu.hh
K_OBJS = $(ELEMENTS:.cc=.ko) kpackage.ko kernelversion.ko
#####################
# {COMPILER THINGS} #
#####################
K_CC = gcc -Wall
K_CXX = c++ -Wp,-w -W -Wall -w
K_CPPFLAGS = -MD -DCLICK_LINUXMODULE -DCLICK_PACKAGE
CFLAGS = -O2
CXXFLAGS = -fno-exceptions -fno-rtti -fvtable-thunks -O2
K_INCLUDES = -I. -I$(LINUXDIR)/include -I$(CLICK_INCLUDE)
K_CXXCOMPILE = $(K_CXX) $(K_INCLUDES) $(K_CPPFLAGS) $(CXXFLAGS)
K_COMPILE = $(K_CC) $(K_INCLUDES) $(K_CPPFLAGS) $(CFLAGS) -D__KERNEL__
##############
# {SUFFIXES} #
##############
# This deletes all default suffixes
.SUFFIXES:
# use only suffixes for these
.SUFFIXES: .c .cc .o .ko
.c.ko:
$(K_COMPILE) -c $< -o $@
@sed 's/\.o:/\.ko:/' < $*.d > $*.kd; /bin/rm -f $*.d
.cc.ko:
$(K_CXXCOMPILE) -c $< -o $@
@sed 's/\.o:/\.ko:/' < $*.d > $*.kd; /bin/rm -f $*.d
#################
# {COMPILATION} #
#################
$(TARGETS): $(K_OBJS)
ld -r -o $(PACKAGE).ko $(K_OBJS)
strip -g $(PACKAGE).ko
kpackage.cc: $(ELEMENTS)
echo "$(ELEMENTS) kernelversion.c" |
$(CLICK_BIN)/click-buildtool elem2package $(PACKAGE) > kpackage.cc
@rm -f kpackage.kd
clean:
-rm -f $(PACKAGE).ko $(K_OBJS) kernelversion.kd kpackage.kd
kpackage.cc $(ELEMENTS:.cc=.kd)
.PHONY: all clean
3) for this module, you have to insmod the .ko file before
install_config
As written your mail, it seems as you have developed some MPLS elements,
are you going to share them with the Click router project, there is also
some interest at our premises for that I think.
best regards,
Brecht
"GARDNER,ROBERT (A-Scotland,ex1)" wrote:
>
> Hi there,
>
> I'm enjoying using your excellent Click router.
> I'm now trying to add my own node - but have hit a snag!
>
> After editing the Makefile to ensure that the /elements/local
> directory gets compiled, I get faced with an error when
> installing my configuration...
>
> #./click-install newconf/mplsencap.click
> newconf/myconf.click:9: unknown element class `XXX'
> Router could not be initialized!
>
> I'm sure I just have to edit some file somewhere to
> make my new element known! I'd be very grateful if
> you could help out?
>
> Perhaps a short step-by-step guide to adding your own elements
> would be a good addition to your documentation - or have I just
> missed it?
>
> best wishes
>
> Robert Gardner
More information about the click
mailing list