overlayyoctoreadonlyrootfs

How do I create writable readonly rootfs using yocto?


I want to create writable rootfs using Yocto. I tried with meta-readonly-rootfs-overlay layer and just included it into stm32mp135f yocto build process but seems like it is not making a writable readonly rootfs.

I tried with meta-readonly-rootfs-overlay layer with mickeldore branch and just included it into stm32mp135f yocto build process but seems like it is not making a writable readonly rootfs.


Solution

  • You need to add an Image Features, the one you are looking for is read-only-rootfs.

    A complete guide is in the docs: Creating the Root Filesystem.

    You need to set either IMAGE_FEATURES or EXTRA_IMAGE_FEATURES with the added feature.


    I missed a part of the question, on the overlay.

    You can use the overlay class provided by Yocto: overlayfs.bbclass. It provides a way to setup an external partition as an overlay, making it writable for your scripts/binaries/configuration. You can also use overlayfs-etc.bbclass if you only want to overlay /etc.