OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / Documentation / Adding-User-Apps-HOWTO
1 Adding User Applications to the uClinux Distribution
2 ----------------------------------------------------
3
4 D. P. Siddons
5 9th Dec. 2001
6
7 H. Michelfelder
8 20th June 2008
9
10
11 This document gives simple instructions for adding a user-written application to
12 the uClinux configuration system. Entries must be added to three files, and an
13 apropriate Makefile must exist in the user application source directory, which
14 must be put in user (all directory names here are given relative to the uClinux
15 top directory. In my system this is /home/peter/uClinux-dist).  
16
17 Files to edit:
18
19 user/Makefile
20    Add a line to the file like
21    
22    dir_$(CONFIG_USER_FOO_FOO)            += foo
23    
24    This adds the directory 'foo' to the list of directories to be built. I added
25    mine in alphabetical order. The order doesn't seem to matter.
26   
27 user/Kconfig
28    Add lines to the file like
29
30 config USER_FOO_FOO
31     bool "foo"
32     help
33       This program does fooey things to your bars.
34
35 Next, there needs to be a proper /user/foo/Makefile. The Makefile should follow
36 the following template:
37
38    --------------------------------------------   
39    EXEC = foo
40    OBJS = foo.o
41
42    all: $(EXEC)
43
44    $(EXEC): $(OBJS)
45         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
46
47    romfs:
48         $(ROMFSINST)    /bin/$(EXEC)
49
50    clean:
51         -rm -f $(EXEC) *.elf *.gdb *.o
52    ---------------------------------------------
53    
54    If more than one executable is built in the foo directory, as above, then the
55    Makefile should look like
56    
57    ------------------------------------------------------------
58    EXECS = foo bar
59    OBJS = foo.o bar.o
60
61    all: $(EXECS)
62
63    $(EXECS): $(OBJS)
64         $(CC) $(LDFLAGS) -o $@ $@.o $(LDLIBS)
65
66    romfs:
67         $(ROMFSINST) -e CONFIG_USER_FOO_FOO             /bin/foo
68         $(ROMFSINST) -e CONFIG_USER_FOO_BAR             /bin/bar
69    --------------------------------------------------------------
70    
71    More complex makefiles are of course possible. The reader is encouraged to
72    browse the user tree for examples.
73    
74    When all this is set up, doing the standard 'make xconfig; make dep; make'
75    should build the app and install it in romfs and hence in the target system
76    image.bin.
77