Use PetaLinux Tools to Add a Script that Will Execute at Boot

May 3, 2018

 This post lists how to install an initscript into a build using PetaLinux Tools.


Looking for PetaLinux help? Email today to schedule a 30-min consult for $99.00



  • This write up was done using PetaLinux Tools 2017.4.

  • If you need help installing PetaLinux Tools check out link

  • The write up follows 




1. cd into your PetaLinux project directory


2. Run:

Changes to the PetaLinux project from this command:

These files are also created automatically:





All variables are defined below.




3. Edit project-spec/meta-user/recipes-apps/bootscript/files/bootscript


 Add a :)

4. Edit project-spec/meta-user/recipes-apps/bootscript/


Add the following (listed in diff form, add the lines with '+', remove the lines with '-'):


5. Run:

Note: I had to run all three of these commands, in this order, to have bootscript installed into the rootfs.


6. Boot the rootfs:



  • The Xilinx + Yocto graphic is an amalgamation of Xilinx and Yocto icons

  • Free Online HTML Escape / Unescape @ link

  • PetaLinux Tools 2017.4 Reference Guide UG1144 (v2017.4) December 20, 2017 @ link

  • Yocto Project Mega-Manual 2.2.3 @ link

    • Note: using 2.2.3 because PetaLinux Tools 2017.4 is built on Yocto 2.2.3


Additional Info


All definitions listed from the Yocto Mega Manual.




The pathname of the work directory in which the OpenEmbedded build system builds a recipe. This
directory is located within the TMPDIR directory structure and is specific to the recipe being built
and the system for which it is being built.

The WORKDIR directory is defined as follows:

The actual directory depends on several things:


• TMPDIR: The top-level build output directory

• MULTIMACH_TARGET_SYS: The target system identifier

• PN: The recipe name

• EXTENDPE: The epoch - (if PE is not specified, which is usually the case for most recipes, then EXTENDPE is blank)

• PV: The recipe version

• PR: The recipe revision


As an example, assume a Source Directory top-level folder name poky, a default Build Directory at poky/build, and a qemux86-poky-linux machine target system. Furthermore, suppose your recipe is named In this case, the work directory the build system uses to build the package would be as follows:




inherit update-rc.d


The OpenEmbedded build system provides support for starting services two different ways:


SysVinit: SysVinit is a system and service manager that manages the init system used to control the very basic functions of your system. The init program is the first program started by the Linux kernel when the system boots. Init then controls the startup, running and shutdown of all other programs.


To enable a service using SysVinit, your recipe needs to inherit the update-rc.d class. The class helps facilitate safely installing the package on the target.


You will need to set the INITSCRIPT_PACKAGES, INITSCRIPT_NAME, and INITSCRIPT_PARAMS variables within your recipe.


systemd: System Management Daemon (systemd) was designed to replace SysVinit and to provide enhanced management of services. For more information on systemd, see the systemd homepage at


To enable a service using systemd, your recipe needs to inherit the systemd class. See the systemd.bbclass file located in your Source Directory. section for more information.





The filename of the initialization script as installed to ${sysconfdir}/init.d.


This variable is used in recipes when using update-rc.d.bbclass. The variable is mandatory.





Specifies the options to pass to update-rc.d. Here is an example:

     INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ."
In this example, the script has a runlevel of 99, starts the script in initlevels 2 and 5, and stops the script in levels 0, 1 and 6.


The variable's default value is "defaults", which is set in the update-rc.d class.


The value in INITSCRIPT_PARAMS is passed through to the update-rc.d command. For more information on valid parameters, please see the update-rc.d manual page at





The destination directory. The location in the Build Directory where components are installed by the do_install task. This location defaults to:

Tasks that read from or write to this directory should run under fakeroot.











This variable can have two separate functions depending on the context: a recipe name or a resulting
package name.

PN refers to a recipe name in the context of a file used by the OpenEmbedded build system as input
to create a package. The name is normally extracted from the recipe file name. For example, if the
recipe is named, then the default value of PN will be "expat".

The variable refers to a package name in the context of a file created or produced by the
OpenEmbedded build system.

If applicable, the PN variable also contains any special suffix or prefix. For example, using bash to
build packages for the native machine, PN is bash-native. Using bash to build packages for
the target and for Multilib, PN would be bash and lib64-bash, respectively.


Please reload

Our Recent Posts

DOE PAMS Specialties

September 5, 2020

Good Link for HOWTO Bring an Off-Screen Window Back Onto Screen for Windows 10, 8, 7, and Vista

September 5, 2020

Connect to and Control a Synaccess NPC-22 netCommander from Ubuntu 16.04.3 Running in a VirtualBox VM via a Prolific Technology Inc. USB to Serial Port Converter to Turn a Target On and Off

September 4, 2020

Please reload


Please reload


©2020 by Zach Pfeffer