Imx6 auto start application before login

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Imx6 auto start application before login

960 Views
sergio_dorazio
Contributor IV

Hi ,

I am working IMX6ULL EVK , I have develop my application,

how I can auto start my application at startup before login ?

I see forums that modify /etc/inittab file, but in my file system this file there isn't.

I compile my SD image with 'core-image-base' option.

Do I must append other modules ?

At the moment I put the start of my application inside /etc/profile, but at startup I must put login and than the application start.

Can someone help me ?

Sergio

0 Kudos
7 Replies

801 Views
b36401
NXP Employee
NXP Employee

Please try to add starting your application into /etc/rc.local file.

0 Kudos

800 Views
sergio_dorazio
Contributor IV

Hi Victor,

thank you for answer,

the file /etc/rc.local in my file system not exist. I send you my /etc foulder ls -l :

root@imx6ull14x14evk:/etc# ls -l
-rw-r--r--    1 root     root          5281 Jul 25  2019 asound.conf
drwxr-xr-x    3 root     root          1024 Oct  1  2019 avahi
drwxr-xr-x    2 root     root          1024 Oct  1  2019 bluetooth
-rw-r--r--    1 root     root          2314 Jul 25  2019 busybox.links.nosuid
-rw-r--r--    1 root     root            91 Jul 25  2019 busybox.links.suid
drwxr-xr-x    3 root     root          1024 Oct  1  2019 ca-certificates
-rw-r--r--    1 root     root          6115 Jul 25 12:44 ca-certificates.conf
drwxr-xr-x    3 root     root          1024 Oct  1  2019 dbus-1
drwxr-xr-x    3 root     root          1024 Oct  1  2019 default
drwxr-xr-x    2 root     root          1024 Jul 25  2019 depmod.d
drwxr-xr-x    3 root     root          1024 Oct  1  2019 dnf
-rw-r--r--    1 root     root            38 Jul 25 12:30 filesystems
drwxr-xr-x    2 root     root          1024 Oct  1  2019 firmware
-rw-r--r--    1 root     root           637 Jul 25 12:30 fstab
-rw-r--r--    1 root     root           747 Jul 25 12:32 group
-rw-r--r--    1 root     root           737 Jul 25 12:32 group-
-r--------    1 root     root           630 Jul 25 12:32 gshadow
-r--------    1 root     root           620 Jul 25 12:32 gshadow-
-rw-r--r--    1 root     root            26 Jul 25 12:30 host.conf
-rw-r--r--    1 root     root            16 Jul 25 12:30 hostname
-rw-r--r--    1 root     root           237 Jul 25  2019 hosts
-rw-r--r--    1 root     root          1633 Jul 25  2019 inputrc
-rw-r--r--    1 root     root            41 Jul 25 12:30 issue
-rw-r--r--    1 root     root            38 Jul 25 12:30 issue.net
-rw-r--r--    1 root     root          6577 Jul 25 12:32 ld.so.cache
-rw-r--r--    1 root     root             0 Oct  1  2019 ld.so.conf
drwxr-xr-x    2 root     root          1024 Oct  1  2019 libnl
-rw-r--r--    1 root     root         11595 Jul 26  2019 lighttpd.conf
drwxr-xr-x    2 root     root          1024 Jul 26  2019 lighttpd.d
-rw-r--r--    1 root     root           827 Jul 25  2019 limits
-rw-r--r--    1 root     root          2006 Jul 25  2019 login.access
-rw-r--r--    1 root     root         10929 Jul 25  2019 login.defs
-rw-r--r--    1 root     root            33 Jul 25 12:32 machine-id
drwxr-xr-x    2 root     root          1024 Jul 25  2019 modprobe.d
drwxr-xr-x    2 root     root          1024 Jul 25  2019 modules-load.d
-rw-r--r--    1 root     root             0 Jul 25 12:30 motd
lrwxrwxrwx    1 root     root            12 Jul 25 12:30 mtab -> /proc/mounts
-rw-r--r--    1 root     root           767 Jul 25  2019 netconfig
drwxr-xr-x    5 root     root          1024 Oct  1  2019 network
-rw-r--r--    1 root     root           514 Oct  1  2019 nsswitch.conf
drwxr-xr-x    2 root     root          1024 Oct  1  2019 ofono
lrwxrwxrwx    1 root     root            21 Jul 25 12:40 os-release -> ../usr/lib/os-release
drwxr-xr-x    2 root     root          1024 Oct  1  2019 pam.d
-rw-r--r--    1 root     root          1096 Oct  1  2019 passwd
-rw-r--r--    1 root     root           913 Jul 25 12:33 profile
-rw-r--r--    1 root     root          2932 Jul 25  2019 protocols
drwxr-xr-x    2 root     root          1024 Jul 25 12:32 pulse
lrwxrwxrwx    1 root     root            34 Jul 25  2019 resolv-conf.systemd -> ../run/systemd/resolve/resolv.
conf
lrwxrwxrwx    1 root     root            24 Oct  1  2019 resolv.conf -> /etc/resolv-conf.systemd
-rw-r--r--    1 root     root           895 Jul 25  2019 rpc
-rwxr-xr-x    1 root     root            58 Jul 25  2019 rpcbind.conf
drwxr-xr-x    2 root     root          1024 Oct  1  2019 rpm
-rw-r--r--    1 root     root           340 Oct  1  2019 rpmrc
-r--------    1 root     root          1848 Jul 25 12:40 securetty
-rw-r--r--    1 root     root         19199 Jul 25  2019 services
-r--------    1 root     root           702 Oct  1  2019 shadow
-rw-r--r--    1 root     root            42 Jul 25 12:30 shells
drwxr-xr-x    2 root     root          1024 Oct  1  2019 skel
drwxr-xr-x    4 root     root          1024 Jul 25 12:44 ssl
drwxr-xr-x    2 root     root          1024 Jul 25  2019 sysctl.d
-rw-r--r--    1 root     root            69 Jul 25  2019 syslog.conf
drwxr-xr-x    5 root     root          1024 Oct  1  2019 systemd
drwxr-xr-x    9 root     root          1024 Oct  1  2019 terminfo
-rw-r--r--    1 root     root            15 Oct  1  2019 timestamp
drwxr-xr-x    2 root     root          1024 Oct  1  2019 tmpfiles.d
drwxr-xr-x    4 root     root          1024 Jul 25 12:32 udev
drwxr-xr-x    2 root     root          1024 Oct  1  2019 udhcpc.d
-rw-r--r--    1 root     root            15 Oct  1  2019 version
-rw-------    1 root     root           113 Jul 25  2019 wpa_supplicant.conf
drwxr-xr-x    3 root     root          1024 Oct  1  2019 xdg
root@imx6ull14x14evk:/etc#

Perhaps do some other module need included ?

I have do bitbake with 'core-image-base' option.

Have you an other suggestion ?

Sergio.

0 Kudos

801 Views
b36401
NXP Employee
NXP Employee

Alternativelly you can place your script into /etc/init.d

root@imx8qmmek:/etc/init.d# cat test.sh
#!/bin/sh
echo test > /file.txt
root@imx8qmmek:/etc/init.d# ls -l test.sh
-rwxr-xr-x 1 root root 22 May 25 18:50 test.sh
root@imx8qmmek:/etc/init.d#

and add it into exact runlevel:

root@imx8qmmek:/etc/init.d# runlevel
N 3
root@imx8qmmek:/etc/init.d# cd /etc/rc3.d/
root@imx8qmmek:/etc/rc3.d# ln -s ../init.d/test.sh S50test.sh
root@imx8qmmek:/etc/rc3.d#

0 Kudos

801 Views
sergio_dorazio
Contributor IV

Hi Victor,

your example work well, the file .txt is create at start up automatically.

But when I add or substitute with "echo ./test_software" the program not start. (if I lunch ./test_software after login the program start well).

Have you other suggestion ?

Sergio.

0 Kudos

801 Views
b36401
NXP Employee
NXP Employee

"echo ./test_software" seems to be wrong.
The command echo does not execute its parameter. It only prints it.
You need to use something like "/bin/bash ./test_software" or simply "./test_software".

0 Kudos

801 Views
sergio_dorazio
Contributor IV

Hello Victor,

I have done ./test_software but nothink happening..... 

Have you test this suggestion ?

What permission must have the test_software file ?

Sergio.

0 Kudos

801 Views
turker
Contributor IV

Have you tried running the program by typing its full path? For example instead of ./test_software, try /path/to/binary/test_software.

0 Kudos