<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yoctoproject.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Keylevel</id>
	<title>Yocto Project - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yoctoproject.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Keylevel"/>
	<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/Special:Contributions/Keylevel"/>
	<updated>2026-04-09T01:00:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.yoctoproject.org/wiki/index.php?title=Cookbook:Appliance:Startup_Scripts&amp;diff=4090</id>
		<title>Cookbook:Appliance:Startup Scripts</title>
		<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/index.php?title=Cookbook:Appliance:Startup_Scripts&amp;diff=4090"/>
		<updated>2011-11-19T00:17:31Z</updated>

		<summary type="html">&lt;p&gt;Keylevel: Created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;NOTE : THIS IS WORK IN PROGRESS&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This cookbook item explains how to add startup scripts to a Yocto image.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
It is assumed that the following scripts have been written and are to be used by the target:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   startup-script --- A script to run at system boot (e.g. to restore persistent state)&lt;br /&gt;
   run-script     --- A script used to start the main appliance application at runlevel 5&lt;br /&gt;
   support-script --- A support script required by the above&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BitBake Recipe ==&lt;br /&gt;
&lt;br /&gt;
The addition of the scripts to the image and their interaction with the various &#039;&#039;init&#039;&#039; runlevels is controlled be means of a BitBake recipe. A template is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DESCRIPTON = &amp;quot;Startup scripts&amp;quot;&lt;br /&gt;
LICENSE = &amp;quot;MIT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Recipe revision - don&#039;t forget to &#039;bump&#039; when a new revision is created !&lt;br /&gt;
PR = &amp;quot;r0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Runtime dependencies&lt;br /&gt;
#&lt;br /&gt;
# Add a line similar to the following to ensure any packages needed for the scripts to run are installed in the image.&lt;br /&gt;
#&lt;br /&gt;
# RDEPENDS_${PN} = &amp;quot;parted&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# SRC_URI specifies the files that are to be used as the scripts.&lt;br /&gt;
#&lt;br /&gt;
# Any valid src_uri format can be used - this example assumes the&lt;br /&gt;
# scripts are stored in the &#039;files&#039; directory below the one in&lt;br /&gt;
# which this file is located.&lt;br /&gt;
#&lt;br /&gt;
SRC_URI = &amp;quot;              \&lt;br /&gt;
   file://startup-script \&lt;br /&gt;
   file://run-script     \&lt;br /&gt;
   file://support-script \&lt;br /&gt;
   &amp;quot;&lt;br /&gt;
&lt;br /&gt;
# This function is responsible for:&lt;br /&gt;
#  1) Ensuring the required directories exist in the image;&lt;br /&gt;
#  2) Installing the scripts in to the image;&lt;br /&gt;
#  3) Creating the desired runlevel links to the scripts.&lt;br /&gt;
#&lt;br /&gt;
do_install() {&lt;br /&gt;
    #&lt;br /&gt;
    # Create directories:&lt;br /&gt;
    #   ${D}${sysconfdir}/init.d - will hold the scripts&lt;br /&gt;
    #   ${D}${sysconfdir}/rcS.d  - will contain a link to the script that runs at startup&lt;br /&gt;
    #   ${D}${sysconfdir}/rc5.d  - will contain a link to the script that runs at runlevel=5&lt;br /&gt;
    #   ${D}${sbindir}           - scripts called by the above&lt;br /&gt;
    #&lt;br /&gt;
    # ${D} is effectively the root directory of the target system.&lt;br /&gt;
    # ${D}${sysconfdir} is where system configuration files are to be stored (e.g. /etc).&lt;br /&gt;
    # ${D}${sbindir} is where executable files are to be stored (e.g. /sbin).&lt;br /&gt;
    #&lt;br /&gt;
    install -d ${D}${sysconfdir}/init.d&lt;br /&gt;
    install -d ${D}${sysconfdir}/rcS.d&lt;br /&gt;
    install -d ${D}${sysconfdir}/rc1.d&lt;br /&gt;
    install -d ${D}${sysconfdir}/rc2.d&lt;br /&gt;
    install -d ${D}${sysconfdir}/rc3.d&lt;br /&gt;
    install -d ${D}${sysconfdir}/rc4.d&lt;br /&gt;
    install -d ${D}${sysconfdir}/rc5.d&lt;br /&gt;
    install -d ${D}${sbindir}&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    # Install files in to the image&lt;br /&gt;
    #&lt;br /&gt;
    # The files fetched via SRC_URI (above) will be in ${WORKDIR}.&lt;br /&gt;
    #&lt;br /&gt;
    install -m 0755 ${WORKDIR}/startup-script  ${D}${sysconfdir}/init.d/&lt;br /&gt;
    install -m 0755 ${WORKDIR}/run-script      ${D}${sysconfdir}/init.d/&lt;br /&gt;
    install -m 0755 ${WORKDIR}/support-script  ${D}${sbindir}/&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    # Symbolic links can also be installed. e.g.&lt;br /&gt;
    #&lt;br /&gt;
    # ln -s support-script-link ${D}${sbindir}/support-script&lt;br /&gt;
&lt;br /&gt;
    #&lt;br /&gt;
    # Create symbolic links from the runlevel directories to the script files.&lt;br /&gt;
    # Links of the form S... and K... mean the script when be called when&lt;br /&gt;
    # entering / exiting the runlevel designated by the containing directory.&lt;br /&gt;
    # For example:&lt;br /&gt;
    #   rc5.d/S90run-script will be called (with %1=&#039;start&#039;) when entering runlevel 5.&lt;br /&gt;
    #   rc5.d/K90run-script will be called (with %1=&#039;stop&#039;) when exiting runlevel 5.&lt;br /&gt;
    #&lt;br /&gt;
    ln -sf ../init.d/startup-script  ${D}${sysconfdir}/rcS.d/S90startup-script&lt;br /&gt;
    ln -sf ../init.d/run-script      ${D}${sysconfdir}/rc1.d/K90run-script&lt;br /&gt;
    ln -sf ../init.d/run-script      ${D}${sysconfdir}/rc2.d/K90run-script&lt;br /&gt;
    ln -sf ../init.d/run-script      ${D}${sysconfdir}/rc3.d/K90run-script&lt;br /&gt;
    ln -sf ../init.d/run-script      ${D}${sysconfdir}/rc4.d/K90run-script&lt;br /&gt;
    ln -sf ../init.d/run-script      ${D}${sysconfdir}/rc5.d/S90run-script&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Keylevel</name></author>
	</entry>
	<entry>
		<id>https://wiki.yoctoproject.org/wiki/index.php?title=Cookbook&amp;diff=4089</id>
		<title>Cookbook</title>
		<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/index.php?title=Cookbook&amp;diff=4089"/>
		<updated>2011-11-18T22:04:58Z</updated>

		<summary type="html">&lt;p&gt;Keylevel: Added &amp;#039;Appliance How-Tos&amp;#039; section / Startup scripts link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page collects working examples on how to use the Yocto Project. Please test all procedures before adding them to this page.&lt;br /&gt;
&lt;br /&gt;
== Yocto Project Quick Start Guide ==&lt;br /&gt;
&lt;br /&gt;
The official Quick Start Guide contains a step-by-step walkthrough showing how to set up your environment and perform your first build: [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html Quick Start Guide]&lt;br /&gt;
&lt;br /&gt;
== Yocto Project BSP How-Tos ==&lt;br /&gt;
&lt;br /&gt;
* TomZ&#039;s page on how to create and maintain a Yocto Project BSP: [[Yocto_BSP_One-Stop_Shop_(Documentation_Overview,_Getting_Started,_FAQs,_and_more)]]&lt;br /&gt;
&lt;br /&gt;
* Examples section of the documentation: [http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#dev-manual-bsp-appendix Yocto Project Developer&#039;s Manual: Appendix A, BSP Development Example]&lt;br /&gt;
&lt;br /&gt;
== Appliance How-Tos ==&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Appliance:Startup_Scripts|Startup scripts]] - How to get things to happen / start automatically&lt;/div&gt;</summary>
		<author><name>Keylevel</name></author>
	</entry>
</feed>