Re: [uClinux-dev] mini-HOWTO for adding user apps.

From: Greg Ungerer (gerg@snapgear.com)
Date: Mon Dec 10 2001 - 18:39:45 EST


Hi D.P.,

"D. Peter Siddons" wrote:
>    Some time ago there was a thread about adding applications into the
> user directory and having them built through the config process. I just
> revisited that task, and wrote down what I did. Maybe the experts can
> tell me if it is right! When suitably corrected, it might be nice to
> have it included with the distribution to save newbies like me from
> having to work it out again every time. Here it is:
> 
> Mini-HOWTO for adding user apps to the uClinux build tree.

Looks pretty good to me. I have put it in my local tree for
inclusion in the next full distrobution release. There is now
a top level "Documenation" directory for this sort of stuff.
(Similar to the one for the linux kernels).

Regards
Greg



> D. P. Siddons
> 9th Dec. 2001
> 
> This document gives simple instructions for adding a user-written
> application to
> the uClinux configuration system. Entries must be added to three files,
> and an
> apropriate Makefile must exist in the user application source directory,
> which
> must be put in /user (all directory names here are given relative to the
> uClinux
> top directory. In my system this is /home/peter/uClinux-dist).
> 
> Files to edit:
> 
> user/Makefile
>    Add a line to the file like
> 
>    dir_$(CONFIG_USER_FOO_FOO)            += foo
> 
>    This adds the directory 'foo' to the list of directories to be built.
> I added
>    mine in alphabetical order. The order doesn't seem to matter.
> 
> config/Configure.help
>    This file contains the text which is presented on request during the
> config.
>    Add a block like
> 
>    CONFIG_USER_FOO_FOO
>      This program does fooey things to your bars.
> 
>    The text must be indented two spaces, and there must be no empty
> lines. Lines
>    should be <70 chars long.
> 
> config/config.in:
>    Add a line in the apropriate menu section (i.e. in the program group
> you want
>    your app to show up in during 'make config'; I used 'misc'), like
> 
>    bool 'foo'           CONFIG_USER_FOO_FOO
> 
>    The repetition of FOO allows for directories which contain multiple
>    executables. Thus, if the user directory 'foo' contained code to make
> 'foo'
>    and 'bar', each gets its own config line if an additional entry is
> made like
> 
>    bool 'bar'           CONFIG_USER_FOO_BAR
> 
> 
> Next, there needs to be a proper /user/foo/Makefile. The Makefile should
> follow
> the following template:
> 
>    --------------------------------------------
>    EXEC = foo
>    OBJS = foo.o
> 
>    all: $(EXEC)
> 
>    $(EXEC): $(OBJS)
>         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
> 
>    romfs:
>         $(ROMFSINST)    /bin/$(EXEC)
> 
>    clean:
>         -rm -f $(EXEC) *.elf *.gdb *.o
>    ---------------------------------------------
> 
>    If more than one executable is built in the foo directory, as above,
> then the
>    Makefile should look like
> 
>    ------------------------------------------------------------
>    EXECS = foo bar
>    OBJS = foo.o bar.o
> 
>    all: $(EXECS)
> 
>    $(EXECS): $(OBJS)
>         $(CC) $(LDFLAGS) -o $@ $@.o $(LDLIBS)
> 
>    romfs:
>         $(ROMFSINST) -e CONFIG_USER_FOO_FOO             /bin/foo
>         $(ROMFSINST) -e CONFIG_USER_FOO_BAR             /bin/bar
>    --------------------------------------------------------------
> 
>    More complex makefiles are of course possible. The reader is
> encouraged to
>    browse the /user tree for examples.
> 
>    When all this is set up, doing the standard 'make xconfig; make dep;
> make'
>    should build the app and install it in romfs and hence in the target
> system
>    image.bin.
> This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Wizard        EMAIL:  gerg@snapgear.com
SnapGear                                       PHONE:    +61 7 3435 2888
825 Stanley St,                                  FAX:    +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia              WEB:   www.snapgear.com
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/


This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:20:35 EDT