Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Dec 2006 10:43:09 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        olli@lurza.secnetix.de
Cc:        erik.udo@gmail.com, freebsd-hackers@freebsd.org
Subject:   Re: Init.c, making it chroot
Message-ID:  <20061230.104309.35221148.imp@bsdimp.com>
In-Reply-To: <200612301119.kBUBJNno062104@lurza.secnetix.de>
References:  <20061229.130333.-1771083254.imp@bsdimp.com> <200612301119.kBUBJNno062104@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200612301119.kBUBJNno062104@lurza.secnetix.de>
            Oliver Fromme <olli@lurza.secnetix.de> 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
: 
: 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061230.104309.35221148.imp>