Hi everyone,

please note that this patch is not final in that the code does not look
for device-node-names, but for a partition name.
But don't hesitate to comment anyway!

Am 04.05.2016 um 14:45 schrieb [email protected]:
> From: Josua Mayer <[email protected]>
> 
> This change adds code to handle a new option on cmdline: overlay=
> This is used to find the rootfs_data partition / disk when it has a
> non-standard name or location.
> 
> It takes either the device node name, or the full path to the device node:
> i.e. /dev/mmcblk0p3 or mmcblk0p3
> 
> This option has precedence over the default name "rootfs_data", and extroot.
> 
> Signed-off-by: Josua Mayer <[email protected]>.
> ---
>  mount_root.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/mount_root.c b/mount_root.c
> index 47a3409..446e3cc 100644
> --- a/mount_root.c
> +++ b/mount_root.c
> @@ -33,6 +33,35 @@ start(int argc, char *argv[1])
>       if (!getenv("PREINIT"))
>               return -1;
>  
> +     /*
> +      * Check cmdline for a hint about overlay device
> +      */
> +     if (!data) {
> +             FILE *fp;
> +             char buffer[100] = {0};
> +
> +             fp = fopen("/proc/cmdline", "r");
> +             while (!feof(fp)) {
> +                     if(fscanf(fp, "overlay=%s", buffer))
> +                             break;
> +
> +                     fseek(fp, 1, SEEK_CUR);
> +             }
> +             fclose(fp);
> +
> +             // overlay= argument was found
> +             if (buffer[0]) {
> +                     // strip /dev/ prefix if any
> +                     int offset = 0;
> +                     if (strstr(buffer, "/dev/"))
> +                             offset = 5;
> +
> +                     // try to find the volume
> +                     ULOG_NOTE("Looking for overlay device given on 
> commandline\n");
> +                     data = volume_find(buffer + offset);
> +             }
> +     }
> +
>       if (!data) {
>               root = volume_find("rootfs");
>               volume_init(root);
> 
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to