diff options
| author | Rodrigo Balerdi | 2024-09-25 02:05:45 +0000 |
|---|---|---|
| committer | Daniel Golle | 2026-03-17 16:16:16 +0000 |
| commit | 0b6022439cadf5928d0c657f16cf5af354eff3ff (patch) | |
| tree | c37bb3833d53318e7470e31d5b018381211d340d | |
| parent | 1bf2d490484ed2f0a251baabc2fa830a0e995d06 (diff) | |
| download | fstools-0b6022439cadf5928d0c657f16cf5af354eff3ff.tar.gz | |
mount_root: add kernel parameter to specify the overlay storage name
The kernel parameter 'fstools_overlay_name' can now be used to specify
the overlay backing storage by name. The name is resolved by the regular
stack of fstools drivers.
Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
| -rw-r--r-- | mount_root.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mount_root.c b/mount_root.c index c8ffe58..392e912 100644 --- a/mount_root.c +++ b/mount_root.c @@ -22,6 +22,9 @@ #include "libfstools/libfstools.h" #include "libfstools/volume.h" +#include "libfstools/common.h" + +#define BUFLEN 64 /* * Called in the early (PREINIT) stage, when we immediately need some writable @@ -30,10 +33,17 @@ static int start(int argc, char *argv[3]) { + char dataparam[BUFLEN]; + char *dataname = "rootfs_data"; struct volume *root; - struct volume *data = volume_find("rootfs_data"); + struct volume *data; struct stat s; + if (get_var_from_file("/proc/cmdline", "fstools_overlay_name", dataparam, sizeof(dataparam))) + dataname = dataparam; + + data = volume_find(dataname); + if (!getenv("PREINIT") && stat("/tmp/.preinit", &s)) return -1; |