问题
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:
- Is there a better way to do this?
- 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