Index: sys/amd64/amd64/machdep.c =================================================================== --- sys/amd64/amd64/machdep.c +++ sys/amd64/amd64/machdep.c @@ -1169,10 +1169,6 @@ } } -static char bootmethod[16] = ""; -SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0, - "System firmware boot method"); - static void native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx) { Index: sys/amd64/include/md_var.h =================================================================== --- sys/amd64/include/md_var.h +++ sys/amd64/include/md_var.h @@ -55,6 +55,8 @@ */ extern char kernphys[]; +extern char bootmethod[16]; + struct savefpu; struct sysentvec; Index: sys/i386/i386/machdep.c =================================================================== --- sys/i386/i386/machdep.c +++ sys/i386/i386/machdep.c @@ -1237,10 +1237,6 @@ SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev, CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in struct cdev *format)"); -static char bootmethod[16] = "BIOS"; -SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0, - "System firmware boot method"); - /* * Initialize 386 and configure to run kernel */ @@ -2348,6 +2344,9 @@ /* Init basic tunables, hz etc */ init_param1(); + /* Set bootmethod to BIOS: it's the only supported on i386. */ + strlcpy(bootmethod, "BIOS", sizeof(bootmethod)); + /* * Make gdt memory segments. All segments cover the full 4GB * of address space and permissions are enforced at page level. Index: sys/i386/include/md_var.h =================================================================== --- sys/i386/include/md_var.h +++ sys/i386/include/md_var.h @@ -49,6 +49,7 @@ #endif extern vm_offset_t proc0kstack; extern uintptr_t setidt_disp; +extern char bootmethod[16]; struct segment_descriptor; union savefpu; Index: sys/x86/x86/cpu_machdep.c =================================================================== --- sys/x86/x86/cpu_machdep.c +++ sys/x86/x86/cpu_machdep.c @@ -111,6 +111,10 @@ static volatile u_int cpu_reset_proxy_active; #endif +char bootmethod[16]; +SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0, + "System firmware boot method"); + struct msr_op_arg { u_int msr; int op; Index: sys/x86/xen/pv.c =================================================================== --- sys/x86/xen/pv.c +++ sys/x86/xen/pv.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -109,6 +110,8 @@ extern char *dbg_stack; #endif +extern char bootmethod[16]; + /* * Placed by the linker at the end of the bss section, which is the last * section loaded by Xen before loading the symtab and strtab. @@ -630,6 +633,11 @@ if (envp != NULL) envp += off; xen_pvh_set_env(envp, reject_option); + + if (MD_FETCH(kmdp, MODINFOMD_EFI_MAP, void *) != NULL) + strlcpy(bootmethod, "UEFI", sizeof(bootmethod)); + else + strlcpy(bootmethod, "BIOS", sizeof(bootmethod)); } else { /* Parse the extra boot information given by Xen */ if (start_info->cmdline_paddr != 0) @@ -637,6 +645,7 @@ (char *)(start_info->cmdline_paddr + KERNBASE), ","); kmdp = NULL; + strlcpy(bootmethod, "XEN", sizeof(bootmethod)); } boothowto |= boot_env_to_howto();