[yocto] recipe to clean up files from rootfs

Andre McCurdy armccurdy at gmail.com
Wed Dec 13 23:57:26 PST 2017


On Wed, Dec 13, 2017 at 11:06 PM, Sherif Omran
<sherifomran2000 at gmail.com> wrote:
> Here is my recipe, it runs suceeds but does not delete the files
>
> mypostprocesfunction() {
> rm -r ${IMAGE_ROOTFS}/etc/init.d/psplash.sh
> rm -r ${IMAGE_ROOTFS}/usr/bin/psplash*
> }
>
> ROOTFS_POSTPROCESS_COMMAND += "mypostprocessfunction; "
>

I think you are fundamentally misunderstanding how recipes work. At a
very high level, recipes are used to compile sources into installable
packages (e.g. ipk or rpm files) and then (as a separate step) an
image recipe creates the rootfs by unpacking a set of installable
packages.

One recipe can depend on the output of another (e.g. an image recipe
depends on the installable packages created by other recipes) but each
recipe has it's own execution environment. You can't expect to write a
recipe which changes the behaviour of another recipe, so writing a new
recipe to remove some files from the rootfs created by the image
recipe is fundamentally wrong. It's never going to work, even if you
fix every typo.

As suggested already, the normal and recommended way to remove files
from the rootfs is:

  1) Remove the package which provides the file(s) from the image you
are building (ie don't install the files in the rootfs at all).

If the file(s) you want to remove don't match the granularity of the
installable packages (ie you want to keep some files provided by a
package but remove others) then you have two basic options:

  2) Spilt the installable package into multiple smaller installable
packages (ie modify the packaging rules in the recipe which creates
the installable package).

  3) Postprocess the rootfs. For that to work, you need to add the
postprocessing function ** TO THE IMAGE RECIPE **.



More information about the yocto mailing list