From owner-freebsd-hackers@FreeBSD.ORG Sat Dec 30 17:45:41 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AFD8B16A403 for ; Sat, 30 Dec 2006 17:45:41 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5489813C442 for ; Sat, 30 Dec 2006 17:45:41 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kBUHh2Yw050300; Sat, 30 Dec 2006 10:43:02 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 30 Dec 2006 10:43:09 -0700 (MST) Message-Id: <20061230.104309.35221148.imp@bsdimp.com> To: olli@lurza.secnetix.de From: "M. Warner Losh" In-Reply-To: <200612301119.kBUBJNno062104@lurza.secnetix.de> References: <20061229.130333.-1771083254.imp@bsdimp.com> <200612301119.kBUBJNno062104@lurza.secnetix.de> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Sat, 30 Dec 2006 10:43:02 -0700 (MST) Cc: erik.udo@gmail.com, freebsd-hackers@freebsd.org Subject: Re: Init.c, making it chroot X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Dec 2006 17:45:41 -0000 In message: <200612301119.kBUBJNno062104@lurza.secnetix.de> Oliver Fromme writes: : 1- Why does the kernel try to mount /dev at all? Why not : simply let init mount it in all cases, with ot without : init_chroot? Would make things simpler. There doesn't : seem to be a clear reason why the kernel needs to mount : it. (Or maybe there _are_ reasons, byt they don't : appear during my testing.) The kernel needs to mount /, and to do that it needs to have a /dev to look things up in. Well, it actually mounts devfs on / before looking up and mounting the real /. After it does that, it pivots the devfs mounted on / into /dev, which is the source of the warning that you see. : 2- Another solution would be to let init(8) autodetect : whether /dev needs to be mounted. However, that might : not be as trivial as it sounds. Indeed. As far as I can tell, the -d fallback in init is totally unused these days. Since the kernel doesn't have a general list of args passed to init, but instead has to construct them one at time from flags set by the boot loader, I'm pretty sure that it can't be easily specified. : By the way, testing the whole thing is easy. Just install : qemu from ports, then run this command: : : qemu -monitor stdio -cdrom chroot-test.iso -boot d : : Creating the ISO (with mkisofs) takes 5 seconds, and booting : it in qemu takes 10 seconds (even without the kqemu kernel : accelerator module), so the development and testing cycles : are very short. That's how I developed my CD/DVD boot : manager "eltoro"[1]. As soon as the ISO runs successfully : in qemu, I write it to a CD-RW and boot it on a real PC : for verification. Cool! : Best regards : Oliver : : : PS: [1] http://www.secnetix.de/products/eltoro/ : : -- : Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing : Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd : Any opinions expressed in this message may be personal to the author : and may not necessarily reflect the opinions of secnetix in any way. : : "One of the main causes of the fall of the Roman Empire was that, : lacking zero, they had no way to indicate successful termination : of their C programs." : -- Robert Firth : :