cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Moldan
Observer
Observer
190 Views
Registered: ‎02-18-2021

ZC702, Auto run app in Petalinux at board boot terminates itself

Jump to solution

I am using Vivado 2019.2 and Vitis 2020.2.

I have made a custom app for Linux which runs correctly through Vitis 2019.2 debug with TCF agent.

Now i want to put my app on SD card and run it automatically when i switch on zc702 evaluation kit.

I follow Petalinux guide:

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2020_2/ug1144-petalinux-tools-reference-guide.pdf

So i can build system image.

Following:

Application Auto Run at Startup (page 123) of ug1144

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2020_2/ug1144-petalinux-tools-reference-guide.pdf

I am able to include my app in Petalinux image, in different locations depending how i initialize: myapp-init.bb:

/usr/bin or /etc/init.d.

Following Guide, it will only go to /etc/init.d, but if i use autocreation for my app:

petalinux-create -t apps --template install -n myapp-init --enable

it will be installed in /usr/bin.

Lets assume i follow guide. I put my board switches in SD start method, copy BOOT.BIN, image.ub and boot.sc created with Petalinux in my SD

and switch on the board.

What i obtain is (at a point of the Log):

-----------------

random: dd: uninitialized urandom read (512 bytes read)
Starting myapp-init <-- First line of my app
Configuring packages on first boot....
(This may take several minutes. Please do not power off the machine.)
Running postinst /etc/rpm-postinsts/100-sysvinit-inittab...
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
Removing any system startup links for run-postinsts ...
/etc/rcS.d/S99run-postinsts

----------------------

And afterwards, it accesses Petalinux console (user-pass..).

It seems that my app started, but was terminated as soon (was launched once and stopped).

I would like to keep App alive.

Some considerations to be done:

User manual  App is onyl installed on:

/etc/init.d

It is strange that myapp-init first lines refer to:

#!/bin/sh

DAEMON=/usr/bin/myapp-init

start ()

As that, does not simply exist.

Because of it, i simply changed it with:

DAEMON=/usr/bin/server-app

So that DAEMON executes an existing app.

If i   cd  /etc/init.d  ./myapp-init

it will correctly launch server-app (altough printf will not be seen in my console, but that is not the main problema now).

-----

So, why does my app configured to start at boot keep deactivating itself?

I have followed, additionally, this post (which marks ug1144 document as incorrect at that point):

https://forums.xilinx.com/t5/Embedded-Linux/UG1144-Application-Auto-Run-at-Startup-difficulty/m-p/1213439#M49126

But output is the same.

 

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
stephenm
Moderator
Moderator
165 Views
Registered: ‎09-12-2007
0 Kudos
3 Replies
stephenm
Moderator
Moderator
166 Views
Registered: ‎09-12-2007
0 Kudos
Moldan
Observer
Observer
145 Views
Registered: ‎02-18-2021

Thanks man! I have been blind for a while thinking my problem was i could not execute an app on boot, when problem was other one. My app configures a TCP server which stays listening in an specific IP. This static IP is specified with Petalinux tool:

petalinux-config

Subsystem AUTO Hardware Settings->Ethernet Settings

Problem is boot order:

1- Petalinux boots and loads some config

2- My app starts

3- Petalinux loads ethernet config

This brought My app failing and terminating itself, as the IP i wanted was not configured yet.

I will look for an existing thread on regards of this issue, or start a new one.

The solution you provide is very welcome!

0 Kudos
stephenm
Moderator
Moderator
82 Views
Registered: ‎09-12-2007

@Moldan    You can change the initlevel in your bootscript.bb file. For example, in your case you want this to be run with a runlevel of 99 in initlevel 5:

INITSCRIPT_PARAMS = "start 99 5 . stop 20 0 1 6 ."

 

reference:

https://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#var-INITSCRIPT_PARAMS

 

I have tested this real quick, and it works for me:

runlevel.PNG