How to autorun applications in uClinux

Document created by sonic Employee on Nov 12, 2012
Version 1Show Document
  • View in full screen mode

Good day to all,

Hi, in my previous question I asked how one can configure u-boot to automatically load the kernel (uimage) after booting in my BF537 board. Thanks to the help that I received I was able to do so. However, another problem arose. After doing some research and readings from different sources, I still haven't found the answer to how one can configure the uimage to automatically run the application I have done. As an example, say I want to run the simple "Hello World" application written in C, I need to do lrz to transfer it to the board then run ./helloworld (or whatever file name I have set it); now I am wondering what are the methods I need to do in order for my "Hello World" application to run after the uimage has boot without me having to manually input the commands to run it.

 

As added info, I believe that one can incorporate the application to the image file through 'make', but still the question remains how I can have that application run automatically. Also, I am unsure if etc/rc or etc/inittab is the right way to go, if so are there any documents that can guide me to set this up? Any form of help would be greatly appreciated!

 

Thank you in advance!

-Angelo

 

Angelo,

 

You can use /etc/rc to run your application.  The init application needs to be setup; and usually isn't used or defaults to the command shell for start-up.

Some notes:

a)  If you want a blocking process, or one that takes a long time, to run in the background use the '&' postfix to the command to spawn it in the background.

b)  Path and environment variables usually are not visible in /etc/rc; so, you need to specify the full path for most commands.

c)  You can also include the application as part of the image (uImage) file as well.  Look in the uclinux/Documentation/Adding-User-Apps-HOWTO file.

 

Look in the uclinux/Documentation/Adding-Platforms-HOWTO and the uclinux/vendors directory... you will see a directory for AnalogDevices there.  in AnalogDevices/common there is the rc file that gets loaded for all the AnalogDevices boards.  But, I'm assuming you are using an AnalogDevices board.

 

 

You can't use relative paths to run your application.

 

The only exception seems to be if it is installed in /bin directory.

So if you have the executable installed to /home/angelo/hello you need:

     /home/angelo/hello

to start the application.

 

the 2 documents I pointed out are good references to get started on getting the user application and building a vendor point (which may or may not be needed).

The rc script when run in alongside the busybox command shell that environment variables that set the time-zone, search path, and etc are not properly exported to the applications that run from the rc script file.  I haven't been able to find a good solution for this other than it is a known issue with busybox implementation.

 

Even if you aren't a vendor, it helps to keep your stuff separate from changes upstream.  But, it does mean you may have to make changes as upstream changes.

 

James

 

This FAQ was generated from the following discussion: How to autorun applications in uClinux

Attachments

    Outcomes