linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pawel Plociennik <paplociennik@gmail.com>
To: "Guillaume Chazarain" <guichaz@gmail.com>
Cc: "Pavel Machek" <pavel@ucw.cz>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] chroot= as a new kernel parameter
Date: Wed, 5 Mar 2008 08:38:03 -0500	[thread overview]
Message-ID: <200803050838.03452.paplociennik@gmail.com> (raw)
In-Reply-To: <3d8471ca0803030719x418f9997tc428344e659a6c90@mail.gmail.com>

On Monday 03 March 2008 10:19, Guillaume Chazarain wrote:
>
> init=/working_distro/lib/ld-linux.so.2 --library-path
> /working_distro/lib  /working_distro/usr/sbin/chroot /working_distro/
> /sbin/init
> 
root=<root> init=/working_distro/lib/ld-linux.so.2 --library-path 
/working_distro/lib working_distro/usr/sbin/chroot /working_distro/ /sbin/init

I think that it is *interestly* hack but I am not sure that it will be an usable method for all of a distroes which exists on the world.
At last my patch is as simple as possible and it has *only* a *few lines of the code* and it can be used
as *independent* method to various *hundred* distroes.

root=<root> chroot=<chroot>

and it looks *beautiful* I think :-)

so I have sent a patch again which it has corrected a *coding style* and a new description in a kernel-parameters.txt file
(a suggestions for better description are welcome).
I think that this can be a *last version* of a patch.
Because I am *newbie* in a kernel hacking I hope that someone will had been written me what now with it ?
Maybe send this patch *directly* to *kernel guru* such as Andrew Morton which manages a -mm series ?


diff -urp linux-2.6.24-orig/Documentation/kernel-parameters.txt linux-2.6.24/Documentation/kernel-parameters.txt
--- linux-2.6.24-orig/Documentation/kernel-parameters.txt	2008-02-25 20:53:26.000000000 -0500
+++ linux-2.6.24/Documentation/kernel-parameters.txt	2008-03-04 09:51:52.000000000 -0500
@@ -381,6 +381,8 @@ and is between 256 and 4096 characters. 
 			Value can be changed at runtime via
 				/selinux/checkreqprot.
 	
+	chroot=		[KNL] change a root for an init process.
+
 	clock=		[BUGS=X86-32, HW] gettimeofday clocksource override.
 			[Deprecated]
 			Forces specified clocksource (if available) to be used
diff -urp linux-2.6.24-orig/init/main.c linux-2.6.24/init/main.c
--- linux-2.6.24-orig/init/main.c	2008-03-01 12:58:37.000000000 -0500
+++ linux-2.6.24/init/main.c	2008-03-05 08:23:32.000000000 -0500
@@ -755,8 +755,20 @@ static void __init do_pre_smp_initcalls(
 		spawn_softlockup_task();
 }
 
+static void *chroot_str;
+static int __init chroot_setup(char *str)
+{
+	chroot_str = str;
+	return 1;
+}
+__setup("chroot=", chroot_setup);
+
 static void run_init_process(char *init_filename)
 {
+	if (chroot_str)
+		if (sys_chroot(chroot_str) < 0)
+			printk(KERN_WARNING "chroot=%s failed\n", chroot_str);
+
 	argv_init[0] = init_filename;
 	kernel_execve(init_filename, argv_init, envp_init);
 }

  reply	other threads:[~2008-03-05  7:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-01 19:09 [PATCH] chroot= as a new kernel parameter Pawel Plociennik
2008-03-01 18:47 ` Alexandre Oliva
2008-03-01 19:44 ` Stefan Hellermann
2008-03-02 11:17   ` Kasper Sandberg
2008-03-02 15:35 ` Pavel Machek
2008-03-02 15:53 ` Filippo Zangheri
2008-03-02 16:00 ` Guillaume Chazarain
2008-03-02 23:59   ` Pawel Plociennik
2008-03-02 18:05     ` Guillaume Chazarain
2008-03-03  1:09       ` Pawel Plociennik
2008-03-03 14:12         ` Pavel Machek
2008-03-03 15:19           ` Guillaume Chazarain
2008-03-05 13:38             ` Pawel Plociennik [this message]
2008-03-05  8:10               ` Pavel Machek
2008-03-05 13:23               ` Guillaume Chazarain
2008-03-06  4:51                 ` Pawel Plociennik
2008-03-06  4:54                 ` Pawel Plociennik
2008-03-06  4:59                 ` Pawel Plociennik
2008-03-02 19:05     ` Alan Cox
2008-03-03 14:11   ` Pavel Machek
     [not found] <a2zNf-7rl-7@gated-at.bofh.it>
     [not found] ` <a2YVo-4N6-27@gated-at.bofh.it>
     [not found]   ` <a3k9B-4Cf-43@gated-at.bofh.it>
2008-03-03 16:08     ` Bodo Eggert
     [not found] ` <a3k9y-4Cf-35@gated-at.bofh.it>
     [not found]   ` <a3kMn-5Jb-25@gated-at.bofh.it>
     [not found]     ` <a3Wop-6Xn-15@gated-at.bofh.it>
     [not found]       ` <a41Rb-7mN-9@gated-at.bofh.it>
2008-03-06  0:16         ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803050838.03452.paplociennik@gmail.com \
    --to=paplociennik@gmail.com \
    --cc=guichaz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).