cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
neels
Visitor
Visitor
272 Views
Registered: ‎06-29-2021

Application auto run at Start up for sources spread across multiple directories.

I am trying to run my application to auto run at Startup.

As a starting point I ran a simple hello world program in the /bin folder and it ran and did as expected.

Then I slowly adapted it to fit my needs. Currently I have my prebuilds/sources split across three folders (/etc, /opt and /sdcard).

Below is my .bb file, I am not sure if I am missing something or not using the right path.

#
# This file is the opt recipe.
#

SUMMARY = "Simple opt application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://etc/* \
	   file://opt/* \
	   file://sdcard/* \
	"

S = "${WORKDIR}"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

inherit update-rc.d

#INITSCRIPT_NAME = "boot.sh"
INITSCRIPT_NAME = "S99init.sh"
INITSCRIPT_PARAMS = "start 99 S ."

do_install() {
	     install -d ${S}/etc ${D}/${sysconfdir}
	     install -d ${D}/${sysconfdir}/init.d
	     install -d ${D}/${sysconfdir}/rc5.d
	     install -d ${D}/opt
	     install -d ${D}/sdcard
	     install -d ${S}/opt ${D}/opt
	     install -d ${S}/sdcard ${D}/sdcard
	     install -m 0755 ${S}/etc/init.d/init.sh ${D}/${sysconfdir}/init.d/init.sh
	     #install -m 0755 ${S}/etc/init.d/boot.sh ${D}/${sysconfdir}/init.d/boot.sh
	     install -m 0755 ${D}/${sysconfdir}/init.d/init.sh ${D}/${sysconfdir}/rc5.d/S99init.sh

	     #install -d ${D}/${bindir}
	     #install -m 0755 ${S}/opt ${D}/${bindir}
}

FILES_${PN} += "${sysconfdir}/*"
FILES_${PN} += "opt/*"
FILES_${PN} += "sdcard/*"

 When I try to build my app, I hit the following error.

ERROR: opt-1.0-r0 do_package: QA Issue: opt: Files/directories were installed but not shipped in any package:
  /opt
  /sdcard
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
opt: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: opt-1.0-r0 do_package: Fatal QA errors found, failing task.
ERROR: Logfile of failure stored in: /tmp/2020_peta_fresh/flexi/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/opt/1.0-r0/temp/log.do_package.22856
ERROR: Task (/tmp/2020_peta_fresh/flexi/project-spec/meta-user/recipes-apps/opt/opt.bb:do_package) failed with exit code '1'

I have been looking at

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2020_2/ug1144-petalinux-tools-reference-guide.pdf (pg 123), but it doesn't exactly cover my case.

Any help or pointers is highly appreciated. Thanks for your time.

0 Kudos
4 Replies
rambati
Xilinx Employee
Xilinx Employee
211 Views
Registered: ‎06-10-2021

0 Kudos
neels
Visitor
Visitor
199 Views
Registered: ‎06-29-2021

Hi @rambati ,

I am unable to gain access to the content with the link you shared. I get "Security constraints prevent access to requested page". I am not sure if the link can be accessed by people outside xilinx. So could you please share the contents of the page or any relevant information.

 

To simplify my question (can ask as a separate question in the forum), can we create a folder /opt inside the rootfs of the petalinux image and add some custom scripts. 

If so, how can we do it (an example .bb file would be useful). I have went through countless suggestion on forums and referred to ug1144 and the suggestion have not succeeded in my case.

Thanks,

Neels

 

0 Kudos
sandeepg
Moderator
Moderator
151 Views
Registered: ‎04-24-2017

Hi @neels ,

@rambati  was trying to point to AR #707177 using internal link sorry about that. Here is the external one https://www.xilinx.com/support/answers/70177.html

From your recipe there are few things which is not correct.

  1. Never use wildcard character(*) for SRC_URI variables, this could lead to build havoc when you run cleansstate and run incremental build changes will not be reflected.
  2. Do you have any pre-built libraries like .so.x or .so files in /opt or /sdcard files?

 

 

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
neels
Visitor
Visitor
130 Views
Registered: ‎06-29-2021

Thanks @sandeepg,

Thanks for the clarification, I am using petalinux 2020.2. As you might have seen, I already have the FILES_${PN} += assigned to the appropriate directory as suggested in my first post.

Regarding your questions,

1. I will make sure I will add the file in full instead of using wildcard character. I have already tried it but the error persists.

2. I have some prebuild binaries of custom software that was developed inhouse along with some configuration files (.conf) in /opt and /sdcard is a placeholder. We don't use any prebuilt libraries  

with  .so.x or .so extensions.

Going back again to my previous question on a simplified system. If I have an opt folder with hello.sh in my project-spec/meta-user/recipes-apps/{myapp}/files/, can you confirm if the following .bb is sufficient to the add my local opt folder to the /opt folder in rootfs ?

 

#
# This file is the opt recipe.
#

SUMMARY = "Simple opt application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://opt/hello.sh \
	"

S = "${WORKDIR}"

do_install() {
             # create teh /opt directory in rootfs
	     install -d ${D}/opt
             # copy the content of /opt in source to dest rootfs  
	     install -d ${S}/opt ${D}/opt

	     #install -d ${D}/sdcard
	     #install -d ${S}/sdcard ${D}/sdcard
}
FILES_${PN} += "/opt/*"

 

0 Kudos