Re: [PATCH] init: Introduce rootdir bootparm to select which dir to sys_chroot

From: Al Boldi
Date: Thu Nov 08 2007 - 23:57:47 EST


Andrew Morton wrote:
> > On Tue, 6 Nov 2007 13:40:26 +0300 Al Boldi <a1426z@xxxxxxxxx> wrote:
> >
> > This patch introduces a rootdir kernel boot parameter, which specifies
> > the path to the kernel sys_chroot boot dir.
> >
> > This is useful for systems that have more than one distribution
> > installed on the same fs/partition.
> >
> >
> > Cc: H. Peter Anvin <hpa@xxxxxxxxx>
> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Al Boldi <a1426z@xxxxxxxxx>
> >
> > ---
> >
> > --- a/init/do_mounts.c
> > +++ b/init/do_mounts.c
> > @@ -252,6 +252,15 @@ __setup("rootflags=", root_data_setup);
> > __setup("rootfstype=", fs_names_setup);
> > __setup("rootdelay=", root_delay_setup);
> >
> > +static char * __initdata root_dir;
> > +static int __init root_dir_setup(char *str)
> > +{
> > + root_dir = strcat("./",str);
> > + return 1;
> > +}
> > +
> > +__setup("rootdir=", root_dir_setup);
>
> Please update Documentation/kernel-parameters.txt when adding __setup
> options.

Sure.

If you think this feature is useful, which I think it is, then I probably
need to resend with a doc update. But bare in mind, this patch needs
something like small hack to allow remounting root, which currently isn't
possible. I'm sure hpa is probably the genius to help out here.

>
> > static void __init get_fs_names(char *page)
> > {
> > char *s = page;
> > @@ -469,6 +478,10 @@ void __init prepare_namespace(void)
> > mount_root();
> > out:
> > sys_mount(".", "/", NULL, MS_MOVE, NULL);
> > +
> > + if(root_dir)
> > + sys_chdir(root_dir);
> > +
>
> Please run scripts/checkpatch.pl across all patches before sending them to
> anyone.

Ok.


Thanks!

--
Al

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/