Yocto recipe to update /etc/fstab

 ̄綄美尐妖づ 提交于 2019-12-24 04:08:08

问题


I'm having trouble updating the /etc/fstab of my Linux distribution, when building it with Yocto. I'm pretty new to Yocto, so maybe I'm off my rocker.

My latest attempt is to add a recipe named base-files_%.bbappend.

mount_smackfs () {
    cat >> ${IMAGE_ROOTFS}/etc/fstab <<EOF

# Generated from smack-userspace
smackfs /smack smackfs smackfsdefault=* 0 0 

EOF
} 

ROOTFS_POSTPROCESS_COMMAND += "mount_smackfs; "

But, the output /etc/fstab on the distribution hasn't changed. So the questions are:

  1. Is there a better way to do this?
  2. How can I tell if my .bbappend file was actually executed?

回答1:


ROOTFS_POSTPROCESS_COMMAND is handled in image recipes and not in package recipes. You have 2 possibilities.

  • Update your fstab in base-file_%.bbappend:

    do_install_append () {
        cat >> ${D}${sysconfdir}/fstab <<EOF
    
    # Generated from smack-userspace
    smackfs /smack smackfs smackfsdefault=* 0 0 
    
    EOF
    }
    
  • Update the fstab in your image's recipe: In this case, you just append what you wrote above (in your post) in the image's recipe.




回答2:


Create a new layer using

yocto-layer create mylayer

inside it, create a folder called recipes-core and inside this folder create another folder called base-files.

Inside this folder create a file called base-files_%.bbappend, with the following content:

FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"

Create another folder called base-files, inside which you should put a file called fstab with your configurations.

Make sure to enable your new layer in the bblayers.conf and it will work correctly, no need to create any append recipe or thing. I had this issue and solved it using this method today.



来源:https://stackoverflow.com/questions/43283825/yocto-recipe-to-update-etc-fstab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!