Running Application at the bootup of JTK1

Hello All,

I am trying to run application at the bootup of JTK1 so for that as mentioned in
http://elinux.org/Jetson/Performance link

i have added startup.sh script in /etc directory and made owner as root and executable using

  1. chown root startup.sh
  2. chmod +x startup.sh

and added following line in /etc/rc.local before exit statement,
sh startup.sh

if i run sh /etc/rc.local from terminal after boot up it runs my application fine but i am not able to
run it automatically at startup…

I feel somehow /etc/rc.local script is not getting executed at startup…any insight in this issue would be great.

Shells can be a pain in subtle ways. Here are some scripts I added in /usr/local/bin/:

# cat performance_ls
#!/bin/bash

echo -n "CPUquiet: ";
cat /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable
echo -n "Scaling Governor: ";
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo -n "CPU 0 online: ";
cat /sys/devices/system/cpu/cpu0/online
echo -n "CPU 1 online: ";
cat /sys/devices/system/cpu/cpu1/online
echo -n "CPU 2 online: ";
cat /sys/devices/system/cpu/cpu2/online
echo -n "CPU 3 online: ";
cat /sys/devices/system/cpu/cpu3/online
# cat performance_set_max
#!/bin/bash

echo '0' > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable

g_ONLINE="$(cat /sys/devices/system/cpu/cpu0/online)";
if [[ "${g_ONLINE}" != '1' ]]; then
   echo '1' > /sys/devices/system/cpu/cpu0/online
fi

g_ONLINE="$(cat /sys/devices/system/cpu/cpu1/online)";
if [[ "${g_ONLINE}" != '1' ]]; then
   echo '1' > /sys/devices/system/cpu/cpu1/online
fi

g_ONLINE="$(cat /sys/devices/system/cpu/cpu2/online)";
if [[ "${g_ONLINE}" != '1' ]]; then
   echo '1' > /sys/devices/system/cpu/cpu2/online
fi

g_ONLINE="$(cat /sys/devices/system/cpu/cpu3/online)";
if [[ "${g_ONLINE}" != '1' ]]; then
   echo '1' > /sys/devices/system/cpu/cpu3/online
fi

echo 'performance' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# cat performance_set_default
#!/bin/bash

echo '1' > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable

g_ONLINE="$(cat /sys/devices/system/cpu/cpu0/online)";
if [[ "${g_ONLINE}" != '1' ]]; then
   echo '1' > /sys/devices/system/cpu/cpu0/online
fi

g_ONLINE="$(cat /sys/devices/system/cpu/cpu1/online)";
if [[ "${g_ONLINE}" != '0' ]]; then
   echo '0' > /sys/devices/system/cpu/cpu1/online
fi

g_ONLINE="$(cat /sys/devices/system/cpu/cpu2/online)";
if [[ "${g_ONLINE}" != '0' ]]; then
   echo '0' > /sys/devices/system/cpu/cpu2/online
fi

g_ONLINE="$(cat /sys/devices/system/cpu/cpu3/online)";
if [[ "${g_ONLINE}" != '0' ]]; then
   echo '0' > /sys/devices/system/cpu/cpu3/online
fi

echo 'interactive' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Within rc.local I have this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/bin/echo "-1" > /sys/module/usbcore/parameters/autosuspend

/usr/local/bin/performance_set_max

exit 0

Yes Correct…

i am able to run my application after Display is loaded(Actual Home screen)…

I have added it in Startup Applications from dash…

What else i have tried is add the command to run application in /etc/init.d/rc.local and create the soft link for this file inside folder /etc/rcS.d/ but the problem is while booting linux i can see it’s trying to launch my application but error pop up GTK Warning : can not open Display…

What i understand from this is i need to have display to run my application…

My application is it does some image processing and display it using OpenGL.

Now i wish at least i disable this Ubuntu Home screen and i should be able to run my application…
Any idea on how to disable display and should be able to run application…

One thing I forgot about in my first post is the script “/etc/init.d/ondemand”. When you mentioned what amounts to be the performance scripts being mysteriously changed back to old settings I remembered this thread:
https://devtalk.nvidia.com/default/topic/897506/jetson-tk1/jetson-tk1-cpu-scaling-governor-settings-not-sticking/

To stop automated interference with your manual settings of performance, run this:

update-rc.d -f ondemand remove

Once this is done, entering or leaving X11 graphical mode should not change performance settings which have been previously set. Adding scripts via /etc/rc.local should then be sufficient.

I am unsure of the rest of the question. Are you asking about how to set your OpenGL application to run by default, without running a full X11 graphical desktop?

Yes Correct …
i want to set my OpenGL application to run by default, without running a full X11 graphical desktop.

I have not tried to do this myself (I probably will one of these days, I know I’m going to need to), so I can’t give you a real/solid answer to running a GUI app in place of all the usual X11 and window manager stuff. But what it comes down to is that the display manager runs on a particular virtual terminal when it hits a particular run level in init. The display manager has as its only job handing off to a window manager after dealing with login details, then the window manager runs and allows a user to spawn simultaneous GUI apps in a decorated environment.

If you find where the display manager is being run, and then replace this with your application, then theory is that your app will take over that virtual terminal instead of a display manager (and in turn instead of a window manager environment). Unless you modified the user name running the app the app would probably run as root authority (this is because “init” runs with root authority). So you may have to do the reverse of using sudo to gain root authority…you may need to sudo when you launch your app to dump root authority and run as just “ubuntu” or some user you’ve created to run the app as.

Or if lucky, perhaps someone here has already done this and can give actual details.

I think it’s just a matter of not starting lightdm (Ubuntu’s desktop manager) and starting X instead to run the OpenGL X application.

I haven’t tried doing anything like this but this seems to be a good start on the process: http://askubuntu.com/questions/192432/how-to-start-graphical-applications-without-lightdm-running