Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filesystem overlays #183

Open
Harvie opened this issue Mar 18, 2022 · 1 comment
Open

Filesystem overlays #183

Harvie opened this issue Mar 18, 2022 · 1 comment

Comments

@Harvie
Copy link
Contributor

Harvie commented Mar 18, 2022

I think it would be really beneficial to allow filesystems to be overlayed.

For example, currently if you want to build ext4, you use something like this:

image rootfs2.ext4 {
  ext4 {}
  mountpoint = "/"
}

But what i actualy need for serious work is bit different. Eg. i have following directories

  • root - containing complete userspace from debootstrap
  • overlay_generic - containing some files that i want to replace in all devices, eg. custom /etc/ssh/sshd_config
  • overlay_alice - containing device specific stuff, eg. /etc/hostname = alice
  • overlay_bob - containing device specific stuff, eg. /etc/hostname = bob

Then i would want to do something like this:

image generic.img {
  ext4 {}
  overlay_dirs {
    "root"
    "overlay_generic"
  }
}

image alice.img {
  ext4 {}
  overlay_dirs {
    "root"
    "overlay_generic"
    "overlay_alice"
  }
}

image bob.img {
  ext4 {}
  overlay_dirs {
    "root"
    "overlay_generic"
    "overlay_bob"
  }
}

So that i will only need to build one debootstrap chroot and then copy it to all of my ext4 images. without having to manage several copies of the chroot.
Then apply/copy the overlays over it in exact order as specified in genimage.cfg, assuming that the files from later overlay will overwrite the files in former.

BTW This is probably related to #181 which points out that genimage is dogmaticaly stuck on some "root path" concept, which often does not reflect reality of embedded development very well. Project structure tends to be more complex than just having one root that contains everything. I suggest not to force such concept and leave the directory structure up to users.

@michaelolbrich
Copy link
Member

Tools like mke2fs only accept one directory for root. So at some point, all those directories must be copied together. I think that's out of scope for genimage. But with #184 you could probably do it in a exec-pre command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants