How-to add a user space application to uClinux
First as root user goto the uClinux-dist directory.
The examples below are all for an hellowworld applications. Replace helloworld with the wanted application name.
Edit user/Makefile and add the line with "helloworld" exactly as shown below.
dir_ = dir_$(CONFIG_USER_HELLOWORLD_HELLOWORLD) += helloworld dir_$(CONFIG_JFFS_FS) += mtd-utils dir_$(CONFIG_JFFS2_FS) += mtd-utils
Create a directory for the application
$ mkdir user/helloworld
Next add support in the config help file. Edit config/Configure.help and add the helloworld part as shown below. NOTE: there must be two spaces before text in the comments, which cannot be more than seventy characters long.
CONFIG_USER_APPWEB_DYNAMIC Build AppWeb with the ability to dynamically load AppWeb modules. AppWeb modules are a convenient way to add your application code to AppWeb. CONFIG_USER_HELLOWORLD_HELLOWORLD A user space application saying hello to the world. CONFIG_USER_AGETTY_AGETTY Install "agetty" in /bin Approx. binary size: 19k
Edit the fine config/config.in. Add a line as shown below:
bool ' only allow root login' CONFIG_USER_ONLY_ROOT bool 'helloworld' CONFIG_USER_HELLOWORLD_HELLOWORLD bool 'agetty' CONFIG_USER_AGETTY_AGETTY
If the directory contains several binaries another line can be added, where the last "HELLOWORLD" is the name of the binary file to be included.
Next a proper Makefile must be established in user/helloworld.
EXEC = helloworld OBJS = helloworld.o all: $(EXEC) $(EXEC): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) romfs: $(ROMFSINST) /bin/$(EXEC) clean: -rm -f $(EXEC) *.elf *.gdb *.o
If there are more binaries to be produced use the skeleton to create a Makefile
EXECS = helloworld goodbyeworld OBJS = helloworld.o goodbyeworld.o all: $(EXECS) $(EXECS): $(OBJS) $(CC) $(LDFLAGS) -o $@ $@.o $(LDLIBS) romfs: $(ROMFSINST) -e CONFIG_USER_HELLOWORLD_HELLOWORLD /bin/helloworld $(ROMFSINST) -e CONFIG_USER_HELLOWORLD_GOODBYEWORLD /bin/goodbyeworld
Finally create the program.
Now when all this are in place run
$ make menuconfig