[yocto] Problem add and removing files to filesystem

Khem Raj raj.khem at gmail.com
Fri Jul 24 17:24:29 PDT 2015


On 15-07-24 14:27:09, Lorin Vandegrift wrote:
> Hi all,
> 
> We are having problems adding extra files/removing files from the generated
> file system in Yocto.  We've had success with using a do_install command in
> our own bb file and using commands in the format rsync -avz test.txt
> ${D}{sysconfdir}, however we can't write to some paths (i.e. writing to
> root with ${D).  Additionally, we are not able to overwrite files generated
> by other recipes.  We also tried using install and couldn't push our init
> script (nstall -m 0755 test.sh ${D}${sysconfdir}/init.d).  Any advice for
> these?  Also is there a recommended way for removing files?   We were able
> to remove them by using the rm command and adding it to
> ROOTFS_POSTPROCESS_COMMAND.

You can consider few approaches

1. Move the files into packages of there own in the recipe which means

PACKAGES += "foo"
FILES_foo = "files you want to separate out"

2. Write a bbappend in your own layer if you are doing something thats
not generic and wont benefit community, in this bbappend you can write
do_install_append () function and do the removal and any other packaging
related adjustments needed for that recipe

3. Write your own rootfs post processing function and hook it up into
ROOTFS_POSTPROCESS_COMMAND variable, this will however mean that online
package upgrades wont work out of box.

If you are looking for overwriting files then consider them patching
using patches or overlaying files using SRC_URI itself again using a
bbappend, if its a config file and you have few tweaks you can sed/awk
then in do_install step itself.

what you are trying is violating the packaging concerns of buildsystem
and thats why its not working as you expected.

Consider components and files a component provides as basic unit of
operation, all changes has to be done at that level for best results.

-Khem




More information about the yocto mailing list