Read only root filesystem with overlay fs

I am looking for feedback on modifying an existing system based on imx8 to support a read-only root file system with overlayfs to allow the system to run as if the root filesystem were not read-only. The scope of this is limited to modifying our current system, which does not use bitbake but starts with your minimal image and then adds packages to result in something which looks like ubuntu 20:

root@toradex-imx8:~# uname -a

Linux toradex-imx8 5.4.193-imx8-base-os #1 SMP PREEMPT Mon Dec 4 13:45:11 EST 2023 aarch64 aarch64 aarch64 GNU/Linux

root@toradex-imx8:~# cat /etc/os-release
NAME=“Ubuntu”
VERSION=“20.04.6 LTS (Focal Fossa)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=“Ubuntu 20.04.6 LTS”
VERSION_ID=“20.04”
HOME_URL=“https://www.ubuntu.com/
SUPPORT_URL=“https://help.ubuntu.com/
BUG_REPORT_URL=“Bugs : Ubuntu
PRIVACY_POLICY_URL=“Data privacy | Ubuntu
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
root@toradex-imx8:~#

I am trying to determine if there is a way to make the rootfs read only and mount overlay filesystems to allow the system to run as if the root were writeable. I don’t understand how to modify the boot sequence to make this happen given the constraints above; using bitbake is not within the scope of this assignment.

Any advice would be appreciated.

We have an option for overlay fs in the Yoe Updater – the following may help if you want to use the overlayfs feature:

Hi @nccaruso

Without knowing the details of your Ubuntu-ization of our Yocto image, it’s hard to give concrete advice here. The scripts referenced by @cbrake show how it is done for the Yoe Distro and something similar will need to be done in your build scripts. Hopefully, those scripts will help you understand the required steps.

Drew