NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Current boot options



On Thu, Aug 15, 2024 at 09:04:30PM -0000, Michael van Elst wrote:
> db7%SDF.ORG@localhost (Diogo) writes:
> 
> >I'm looking for a mechanism to see what options were passed to the kernel when 
> >booting. In Linux that is typically stored in /proc/cmdline. How to figure that 
> >out in NetBSD?
> 
> There is no command line, and the kernel doesn't take many options.
> 
> Some information can be retrieved with sysctl (e.g. sysctl kern.boothowto).
> 
> kern.boothowto is a number that combines bitmasks for the various options
> from boothowto(9), e.g.
> 
> RB_ASKNAME   0x00000001  -a
> RB_SINGLE    0x00000002  -s
> RB_HALT      0x00000008  -b
> RB_KDB       0x00000040  -d
> RB_MINIROOT  0x00000200  -m
> RB_USERCONF  0x00001000  -c
> AB_QUIET     0x00010000  -q
> AB_VERBOSE   0x00020000  -v
> AB_SILENT    0x00040000  -z
> AB_DEBUG     0x00080000  -x
> RB_MD1       0x10000000  -1
> RB_MD2       0x20000000  -2
> RB_MD3       0x40000000  -3
> RB_MD4       0x80000000  -4
> 
> kern.consdev is the device used as the kernel console. That is usually deduced
> from an option in the bootloader (e.g. console=pc on a platform using wscons
> would usually result in kern.consdev being /dev/ttyE0).
> 
> kern.root_device is the device mounted as /, which is either deduced from
> the boot process or from an explicit option to the bootloader.
> 
> machdep.booted_kernel is the name of the kernel that was loaded, either a
> default searched on the disk or passed explicitely to the bootloader.
> 

Thank you for the detailed explanation, I can write a small program to fetch
that info if necessary.



Home | Main Index | Thread Index | Old Index