Difference between revisions of "How-to add a user space application to uClinux"
Line 84: | Line 84: | ||
$(ROMFSINST) -e CONFIG_USER_HELLOWORLD_GOODBYEWORLD /bin/goodbyeworld | $(ROMFSINST) -e CONFIG_USER_HELLOWORLD_GOODBYEWORLD /bin/goodbyeworld | ||
</source> | </source> | ||
+ | |||
+ | '''NOTE:''' Remember not to copy directly from this page. All indentations are done with tab's not spaces! | ||
Finally create the program. | Finally create the program. |
Revision as of 14:55, 13 February 2011
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:
mainmenu_option next_comment comment 'Miscellaneous Applications' bool 'helloworld' CONFIG_USER_HELLOWORLD_HELLOWORLD bool '7za' CONFIG_USER_P7ZIP_7ZA
The application can now be found in top of the Miscellaneous Application menu 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
NOTE: Remember not to copy directly from this page. All indentations are done with tab's not spaces!
Finally create the program.
Now when all this are in place run
$ make menuconfig