How do I create writable readonly rootfs using yocto?

109 Views Asked by At

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.

1

There are 1 best solutions below

2
PierreOlivier On BEST ANSWER

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.

  • IMAGE_FEATURES if you set it in your image recipe (IMAGE_FEATURES += "read-only-rootfs")
  • EXTRA_IMAGE_FEATURES if you set it in the local.conf (EXTRA_IMAGE_FEATURES += "read-only-rootfs"

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.