NAME
cpu_rootconf
,
rootconf
, setroot
—
root file system setup
SYNOPSIS
#include
<sys/types.h>
#include <sys/systm.h>
void
cpu_rootconf
(void);
void
rootconf
(void);
void
setroot
(device_t
bootdv, int
bootpartition);
DESCRIPTION
Thecpu_rootconf
()
is a machine-dependent interface invoked during system bootstrap to determine
the root file system device and initialize machine-dependent file system
state. cpu_rootconf
() provides the global variables
booted_device, booted_partition,
booted_startblk, booted_nblks, and
bootspec. cpu_rootconf invokes the
machine-independent function rootconf which calls the
function setroot to record the root device and the root
partition information for use in machine-independent code.
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.
If the bootloader already identified a disk wedge, it passes a non-zero value for booted_nblks, then booted_startblk and booted_nblks specify a disk wedge as the boot device.
setroot evaluates several sources to identify the root device in the following order until a valid device is selected:
- The kernel configuration variable rootspec which is set by 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 setroot is used.
- The variable bootspec following the same syntax.
- The result of an interactive query of the root device if
boothowto has set the flag
RB_ASKNAME
. The input uses the same syntax as the previous sources. Here also the kernel dump device is queried. - The boot device and partition passed as arguments.
If a root device cannot be selected, setroot
sets the RB_ASKNAME
flag and loops.
Otherwise the kernel dump device is identified in a similar manner from
- The result of a previous interactive query. See above.
- The kernel configuration variable dumpspec, if set.
- The second partition of the root device, if it is a regular disk.
- The first disk wedge device of type DKW_PTYPE_SWAP.