Linux+auto-boot+tutorial

__Purpose__
The purpose of this article is to guide the reader through the process of automatically executing a graphical, touch screen-dependent application at the boot-up of DevKit8000.

__Theory - DEPRECATED!!! We now use the systemd init system__
If you're using the modified Angström distribution provided by IHA, you'll find an add-on to the normal boot sequence made by PHM. PHM has created a shell file called initAddonBrd.sh, which is placed in the directory **/etc/init.d/**. This file contains initialization of the ADC on the add-on board along with creation of the matching nodes. The file also contains an out commented DAC-driver and a CPLD-driver.

To simplify this article, we'll be using this file to execute our application from. You can create your own shell-file, but that's not within the scope of this article.

When Linux Angström is booting up, it follows and executes all symbolic links contained in the rcS-directory. The rc-directories are:
 * /etc/rcS.d/
 * /etc/rc1.d/
 * /etc/rc2.d/
 * /etc/rc3.d/
 * /etc/rc4.d/
 * /etc/rc5.d/ (default on this, modified, Angström distribution)
 * /etc/rc6.d/

The rcS-directory contain files executed at Super User level, if you want a shell-file to execute on another level, a symbolic link should be placed in the rc5 folder. Placing it in one of the other rc-folders will not result in a successful boot process. (If you want to know more about the Linux boot process, please go to: http://www.yolinux.com/TUTORIALS/LinuxTutorialInitProcess.html)

If you look careful in **/etc/rcS.d/**, you'll find a symbolic link to initAddonBrd.sh made by PHM. Often you would like to put your shell-script in the /etc/init.d/-directory, and link to it from one (or more) of the rc-directories. If you want a execute an binary at start-up, it is required that you place it in **/sbin/**. (Super User binary files)

All links in the rc-directories follows a naming convention, where all names start with S## (where ## being a two-digit number). The numbers tell which order the links are executed in. The link with the name starting with S01 is executed first, and the link with the name starting with S99 is executed last.

Unfortunately, it's not possible to specify the parameters to a binary in a link; so to execute a Qt-application (where the parameter -qws is needed), the file need to be written in a shell-file, and for that purpose, we'll use the file that already exists in the system: initAddonBrd.sh.

Bonus information: If you would like to access the DevKit8000, from a external computer using USB, while the application is running, you need to execute the application as a separate task. If you skip this step, the application will block for incoming USB-connection requests, and you'll not be able to access it through USB; Instead you can use one of those good old serial cables, and access DevKit8000 before booting.

The touch screen on the DevKit8000 is initialized, when a user logs on by default. The problem is, that we need the touch screen before that happens, therefore we need to add the libraries, which are set up at user-login, to the initAddonBrd.sh too.

When Linux is booting a boot-environment is set up, the applications executed at boot-up is running in this environment. Please notice, that if you connect to the DevKit8000 using SSH, the OS will set up the environment described in specific user's profile file.

__**Step-by-step guide:**__

 * 1) Transfer the binary to DevKit8000
 * 2) Move the binary to /sbin/

From this point there are two ways to get the kit starting up your application at boot-time:
 * A.Start up at login
 * or**
 * B. tart up at boot

__A. Start up at login__
Change directory to **/etc/** on DevKit8000:
 * cd /etc/

Open profile with Visual Editor
 * vi profile

Add the following line of code, in the bottom of profile, just before the umask-statement:
 * /sbin/exampleQtApp –qws &

TIP! Visual Editor commands: Type i to edit the file, type ESC + : + q! + ENTER to exit without saving and type ESC + : + wq + ENTER to save and exit.
 * Reboot the DevKit8000 and log on; The application will start automatically. You can configure Linux to login to a default account at boot time, but that is not covered in this article.

__B. Start up at boot__
Change directory to /etc/init.d/
 * cd /etc/init.d/

Open initAddonBrd.sh with Visual Editor
 * vi initAddonBrd.sh

Write the following in the bottom of initAddonBrd.sh. This configures the touch screen.
 * export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
 * export TSLIB_TSDEVICE=/dev/input/touchscreen0
 * export TSLIB_CONFFILE=/etc/ts.conf
 * export TSLIB_PLUGINDIR=/lib/ts
 * export TSLIB_CALIBFILE=/etc/pointercal
 * export TSLIB_CONSOLEDEVICE=none
 * export TSLIB_FBDEVICE=/dev/fb0
 * export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
 * export TSLIB_FBDEVICE=/dev/fb0
 * export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0

Add the following line of code below the initialization of the touch screen.
 * /sbin/exampleQtApp –qws &

TIP! Visual Editor commands: Type i to edit the file, type ESC + : + q! + ENTER to exit without saving and type ESC + : + wq + ENTER to save and exit.
 * Reboot the DevKit8000. Your application will boot automatically.