CPU_ROOTCONF(9)
omg hiii bestie π welcome to the CPU_ROOTCONF(9) page from the Kernel Developer's Manual β¨ this is the root file system setup lore, and it's giving bootstrap main character energy π
β¨ 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 β¨
okay so cpu_rootconf() is the machine-dependent interface invoked during system bootstrap to determine the root file system device and initialize machine-dependent file system state. no cap, it's the setup girlie π
cpu_rootconf() provides the global variables booted_device, booted_partition, booted_startblk, booted_nblks, and bootspec. π«Ά
Then 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. highkey a whole handoff chain, iykyk π
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. iconic translation moment β¨
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. noted bestie π
setroot evaluates several sources to identify the root device in the following order, until a valid device is selected:
- The kernel configuration variable
rootspecwhich is set byconfig(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 tosetrootis used. - The variable
bootspecfollowing the same syntax. - The result of an interactive query of the root device if
boothowtohas set the flagRB_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. π that's the fallback loop, periodt.
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.
β¨ SEE ALSO β¨
config(1), dk(4), boot(8), boothowto(9) π
and that's the page bestie π this was CPU_ROOTCONF(9) from the Kernel Developer's Manual, brought to you by Debian, dated November 11, 2014 β slay, bye π
π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2002 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms