Re: [OpenWrt-Devel] [PATCH v2 1/3] mount_root: implement overlay= boot option
Am 29.04.2016 um 07:47 schrieb Rafał Miłecki: > On 28 April 2016 at 20:20,wrote: >> @@ -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; > > Please keep coding style consistent across the project. You can see > there is: if (!getenv("PREINIT")) with space after "if". Please > update your code to use the same style, e.g.: if (!data) while > (!feof(fp)) { > Will do, thanks for the pointer (I really didn't notice)! Meanwhile any comments on the content itself? ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v2 1/3] mount_root: implement overlay= boot option
On 28 April 2016 at 20:20,wrote: > From: Josua Mayer > > 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 . Why are you using fake e-mail address in "From"? ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v2 1/3] mount_root: implement overlay= boot option
On 28 April 2016 at 20:20,wrote: > @@ -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; Please keep coding style consistent across the project. You can see there is: if (!getenv("PREINIT")) with space after "if". Please update your code to use the same style, e.g.: if (!data) while (!feof(fp)) { ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 1/3] mount_root: implement overlay= boot option
From: Josua MayerThis 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 . --- mount_root.c | 29 + 1 file changed, 29 insertions(+) diff --git a/mount_root.c b/mount_root.c index 47a3409..9d2c0de 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); -- 2.6.6 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel