petalinux 2019.1 设置自启动脚本
petalinux-create -t apps --template install -n autorunapp --enable
修改/project-spec/meta-user/recipes-apps/autorunapp/autorunapp.bb文件
#
# This file is the autorunapp recipe.
#
SUMMARY = "Simple autorunapp application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://autorunapp \
"
S = "${WORKDIR}"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
inherit update-rc.d
INITSCRIPT_NAME = "autorunapp"
INITSCRIPT_PARAMS = "start 99 S ."
do_install() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${S}/autorunapp ${D}${sysconfdir}/init.d/autorunapp
}
FILES_${PN} += "${sysconfdir}/*"
尤其这几行代码,否则会报如下的错误。
do_install() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${S}/autorunapp ${D}${sysconfdir}/init.d/autorunapp
}
ERROR: petalinux-user-image-1.0-r0 do_rootfs: Postinstall scriptlets of ['autorunapp'] have failed. If the intention is to defer them to first boot,
then please place them into pkg_postinst_ontarget_${PN} ().
Deferring to first boot via 'exit 1' is no longer supported.
Details of the failure are in /home/mrzhang/Works/mpsoc/D1025/build/tmp/work/plnx_zynqmp-xilinx-linux/petalinux-user-image/1.0-r0/temp/log.do_rootfs.
ERROR: petalinux-user-image-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/mrzhang/Works/mpsoc/D1025/build/tmp/work/plnx_zynqmp-xilinx-linux/petalinux-user-image/1.0-r0/temp/log.do_rootfs.49676
ERROR: Task (/home/mrzhang/Works/mpsoc/D1025/project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb:do_rootfs) failed with exit code '1