Create a blank application component (auto enabled).
steve@Linux-Steve:/home/steve/projects/petalinux$ petalinux-create --type apps --template install --name led-runner --enable
Change the default source code to do something a little more obvious.
steve@Linux-Steve:/home/steve/projects/petalinux$ subl project-spec/meta-user/recipes-apps/led-runner/files/led-runner
- #!/bin/sh
-
- poke 0x41200000 0x18
- usleep 125000
- poke 0x41200000 0x3C
- usleep 125000
- poke 0x41200000 0x7E
- usleep 125000
- poke 0x41200000 0xFF
- usleep 125000
- poke 0x41200000 0x7E
- usleep 125000
- poke 0x41200000 0x3C
- usleep 125000
- poke 0x41200000 0x18
- usleep 125000
- poke 0x41200000 0x00
Change the BitBake receipe to make it suitable for an auto-start application.
steve@Linux-Steve:/home/steve/projects/petalinux$ subl project-spec/meta-user/recipes-apps/led-runner/led-runner.bb
- #
- # This file is the led-runner recipe.
- #
- SUMMARY = "Simple led-runner application"
- SECTION = "PETALINUX/apps"
- LICENSE = "MIT"
- LIC_FILES_CHKSUM ="file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
-
- SRC_URI = "file://led-runner"
-
- S = "${WORKDIR}"
-
- FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-
- inherit update-rc.d
-
- INITSCRIPT_NAME = "led-runner"
- INITSCRIPT_PARAMS = "start 99 S ."
-
- do_install() {
- install -d ${D}${sysconfdir}/init.d
- install -m 0755 ${S}/led-runner ${D}${sysconfdir}/init.d/led-runner
- }
- FILES_${PN} += "${sysconfdir}/*"