Adding custom applications in SnapGear


2012-02-17Publicerad av Sven-Åke Andersson

Introduction


Custom applications can be added into the SnapGear projects in several ways, the simplest ways is to add the source code to the already prepared custom directory, snapgear-pxx/user/custom. It is also rather easy to modify the menu of the SnapGear Application menu and add a new application to the GUI. It also possible to copy a binary compiled outside of the SnapGear distribution folders. This chapter shows the simplest possible alternative, adding an application to the user/custom directory.

Our application


We will add a c-program that calculates all prime numbers from 1 to 5000. Here is the code:





We copy the file PrimeNumbers.c to to the user/custom directory.






 
We edit the Makefile and remove all other applications and add our PrimeNumbers application. It will look like this:



 


 

Including the application in the file system

 
We will use the configuration tool to add our application to "Core Applications". Start xconfig and enable "Customize Vendor/User Settings":

make xconfig

 

 

Save and exit and the tool will restart:

 

 

Select Core Applications and enable "custom tests app". Save and exit.

 


 
Build the new image and use GRMON to load it (see previous chapter for more information). Boot Linux and execute the command PrimeNumbers.

 

 


The executable file is stored in the bin directory.