linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] chroot= as a new kernel parameter
@ 2008-03-01 19:09 Pawel Plociennik
  2008-03-01 18:47 ` Alexandre Oliva
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Pawel Plociennik @ 2008-03-01 19:09 UTC (permalink / raw)
  To: linux-kernel

hi *real* hackers,

it is a my first post to lkml and I hope that you will have not been
ignored me if I have done some incorrect thing.

In the short this patch has added a new chroot= kernel parameter which can be used
to changing a chroot of an init process before it will has been runed.
I use that for testing variouses distroes without making a separate partition but
by copied a new root-fs to a new subdirectory on the my *base* filesystem.

PS: be sure that you have added my e-mail in a CC because I am not subscribed
to the lkml and ...
I sorry but my English can be little incorrect because it is not my *native* language :-(      
please do not ignore me if I have been done some inccorect thing.

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-02-25 20:51:21.000000000 -0500
@@ -381,6 +381,8 @@ and is between 256 and 4096 characters. 
 			Value can be changed at runtime via
 				/selinux/checkreqprot.
 	
+	chroot=		[KNL] call chroot() for init proccess.
+
 	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-02-25 20:36:06.000000000 -0500
@@ -755,8 +755,22 @@ 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("chroot=%s failed\n", chroot_str);
+		else
+			printk("chroot=%s successed\n",chroot_str);
+	}
 	argv_init[0] = init_filename;
 	kernel_execve(init_filename, argv_init, envp_init);
 }

^ permalink raw reply	[flat|nested] 22+ messages in thread
[parent not found: <a2zNf-7rl-7@gated-at.bofh.it>]

end of thread, other threads:[~2008-03-06  0:16 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).