CPU_ROOTCONF(9)

πŸ“¦ version 11.0, in nixpkgs unstable

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:

  1. 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.
  2. The variable bootspec following the same syntax.
  3. 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.
  4. 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:

  1. The result of a previous interactive query. See above.
  2. The kernel configuration variable dumpspec, if set.
  3. The second partition of the root device, if it is a regular disk.
  4. 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