Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Sep 2008 13:51:21 +0300
From:      Manolis Kiagias <sonic2000gr@gmail.com>
To:        joel@levee-online.org
Cc:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: starting sysinstall at boot time
Message-ID:  <48BD1AA9.8000307@gmail.com>
In-Reply-To: <1220348951.48bd0c17315aa@imp.online.net>
References:  <1220348951.48bd0c17315aa@imp.online.net>

next in thread | previous in thread | raw e-mail | index | archive | help
joel@levee-online.org wrote:
> Hi,
>
> Something seems magic in freebsd: I am looking for what does start
> sysinstall at boot time when I boot from the installation CD.
> The only thing related to systinstall is the setting of the init_path variable
> in the loader.rc file but it is in comment thus the loader should finish
> by launchinig init as usual so what does make it launch sysinstall instead?
>
> I also examined /etc/ttys which is used by init but this file is standard
> and I do not find anything that could tell init to start sysinstall instead
> of getty!
>
> As you may guess, my goal is to create an customized installation CD in
> order to install a network appliance wich embedds freebsd.
>
> Sincerily,
> Joel Levee
>
>
>   

This is a tricky one, kind of black magic ;)

Seriously, it is quite simple:

You correctly located the init_path variable. This contains the 
following (on a 6.3-RELEASE CD I have handy at the moment):

#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"

This is commented out, but the values shown are the built-in defaults.

Now, if you take a look at the CD filesystem structure, *there is* an 
/sbin/init and there is *no* /stand/sysinstall. So, you would assume 
that init would run first.

However, here comes the caveat:

The root filesystem when you boot your installation media, is  *not* the 
CD-ROM itself. Look at /boot/loader.conf:

mfsroot_load="YES"
mfsroot_type="mfs_root"
mfsroot_name="/boot/mfsroot"

You will find /boot/mfsroot.gz as the file that acts as the root filesystem.
You can actually examine the contents of this if you mount it using 
mdconfig (assuming you mounted your install CD on /cdrom):

cp /cdrom/boot/mfsroot.gz /tmp
cd /tmp
unzip mfsroot.gz (Can probably be mounted compressed(?), did not check)
mdconfig -f mfsroot md0
mount /dev/md0 /mnt

Check the contents of /mnt:

bin   boot  dev   etc   mnt   sbin  stand var

sbin is a symbolic link to stand. There is no '/stand/init' in , but   
'/stand/sysinstall' exists. Therefore, sysinstall executes ;)



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