Home | History | Annotate | Line # | Download | only in man9
 $NetBSD: cpu_rootconf.9,v 1.10 2014/11/26 20:46:46 wiz Exp $

Copyright (c) 2002 The NetBSD Foundation, Inc.
All rights reserved.

This code is derived from software contributed to The NetBSD Foundation
by Gregory McGarry.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

.Dd November 11, 2014 .Dt CPU_ROOTCONF 9 .Os .Sh NAME .Nm cpu_rootconf , .Nm rootconf , .Nm setroot .Nd root file system setup .Sh SYNOPSIS n sys/types.h n sys/systm.h .Ft void .Fn cpu_rootconf "void" .Ft void .Fn rootconf "void" .Ft void .Fn setroot "device_t bootdv" "int bootpartition" .Sh DESCRIPTION The .Fn cpu_rootconf is a machine-dependent interface invoked during system bootstrap to determine the root file system device and initialize machine-dependent file system state. .Fn cpu_rootconf provides the global variables .Fa booted_device , .Fa booted_partition , .Fa booted_startblk , .Fa booted_nblks , and .Fa bootspec . .Fa cpu_rootconf invokes the machine-independent function .Fa rootconf which calls the function .Fa setroot to record the root device and the root partition information for use in machine-independent code.

p .Fa rootconf may adjust the global variables and determines the parameters for setroot. This is for example used to translate a device and partition number provided by the bootloader into a disk wedge device covering the same partition.

p If the bootloader already identified a disk wedge, it passes a non-zero value for .Fa booted_nblks , then .Fa booted_startblk and .Fa booted_nblks specify a disk wedge as the boot device.

p .Fa setroot evaluates several sources to identify the root device in the following order until a valid device is selected: l -enum t The kernel configuration variable .Fa rootspec which is set by .Xr config 1 . The value is the name and unit of the root device, e.g., "sd0" (disk) or "dk0" (wedge) or "le0" (network) or the prefix "wedge:" followed by the name of the disk wedge. For disk devices the partition passed as argument to .Fa setroot is used. t The variable .Fa bootspec following the same syntax. t The result of an interactive query of the root device if .Fa boothowto has set the flag .Dv RB_ASKNAME . The input uses the same syntax as the previous sources. Here also the kernel dump device is queried. t The boot device and partition passed as arguments. .El

p If a root device cannot be selected, .Fa setroot sets the .Dv RB_ASKNAME flag and loops.

p Otherwise the kernel dump device is identified in a similar manner from l -enum t The result of a previous interactive query. See above. t The kernel configuration variable .Fa dumpspec , if set. t The second partition of the root device, if it is a regular disk. t The first disk wedge device of type DKW_PTYPE_SWAP. .El .Sh SEE ALSO .Xr config 1 , .Xr dk 4 , .Xr boot 8 , .Xr boothowto 9