集成了自定义配方,但在闪烁后看不到 rootfs 的任何变化



我创建了一个自定义配方,其中包括一些作为sysfs一部分的服务文件,即使我能够构建整个映像并对其进行刷新,我也没有看到rootfs中有任何更改。

bitbake-layers show-recipes | grep <recipe-name>
// i see the newly added recipe here

以下是配方bb文件中的do_install_append()

do_install_append() {
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}/etc/initscripts
install -d ${D}${systemd_unitdir}/system
mv ${D}/etc/init.d/<daemon_file> ${D}/etc/initscripts/<daemon_file>
install -m 0644 ${WORKDIR}/<recipe>/<service_file> ${D}${systemd_unitdir}/system/<service_file>
install -d ${D}${systemd_unitdir}/system/multi-user.target.wants/
ln -sf ${systemd_unitdir}/system/<service_file>  ${D}${systemd_unitdir}/system/multi-user.target.wants/<service_file>
fi
}

例如,我进入/etc/initscripts/,却看不到<daemon_file>

由于构建本身运行良好,我是否应该研究其他问题来调试该问题?

您的食谱没有任何问题。

以下是需要考虑的几点:

  • 只有当systemdDISTRO_FEATURES中时,do_install_append才会复制文件

要确保这一点,请检查:

bitbake -e | grep ^DISTRO_FEATURES=

或者将bbwarn "Message"添加到您的配方中,以确保块被执行。

  • 确保将文件添加到FILES_${PN}
FILES_${PN} += "/etc/initscripts/<daemon_file> 
${systemd_unitdir}/system/<service_file> 
${systemd_unitdir}/system/multi-user.target.wants/<service_file>"
  • 在构建完整图像之前,请检查配方的${D}文件夹
$ bitbake -e <recipe> | grep ^D=
D=".../tmp/work/.../<recipe>/<version>/image"
$ cd <path>
$ tree .

要激活systemd,请使用:

INIT_MANAGER = "systemd"

你真的把这个配方创建的包安装到图像中了吗?仅仅因为你比特烘焙了一个食谱并不意味着内容会进入每个图像,你还需要将包名称添加到IMAGE_INSTALL中。