Move to using a common kernel path between the boot / laoder bits and

the kernel.
This commit is contained in:
Warner Losh 2019-06-24 20:34:53 +00:00
parent 97ad52ca4c
commit ec9abc1843
4 changed files with 10 additions and 4 deletions

View File

@ -29,11 +29,14 @@
#ifndef _PATHS_H_
#define _PATHS_H_
#include <sys/boot.h> /* To get kernel path */
#define PATH_DOTCONFIG "/boot.config"
#define PATH_CONFIG "/boot/config"
#define PATH_LOADER "/boot/loader"
#define PATH_LOADER_EFI "/boot/loader.efi"
#define PATH_LOADER_ZFS "/boot/zfsloader"
#define PATH_KERNEL "/boot/kernel/kernel"
#define PATH_LOADER_CONF "/boot/loader.conf"
#define PATH_DEFAULTS_LOADER_CONF "/boot/defaults/loader.conf"
#endif /* _PATHS_H_ */

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/boot.h>
#include <paths.h>
#include <stdint.h>
#include <string.h>
#include <setjmp.h>
@ -237,8 +238,8 @@ sanity_check_currdev(void)
{
struct stat st;
return (stat("/boot/defaults/loader.conf", &st) == 0 ||
stat("/boot/kernel/kernel", &st) == 0);
return (stat(PATH_DEFAULTS_LOADER_CONF, &st) == 0 ||
stat(PATH_KERNEL, &st) == 0);
}
#ifdef EFI_ZFS_BOOT

View File

@ -136,7 +136,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD|CTLFLAG_CAPRD,
SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available");
#endif
char kernelname[MAXPATHLEN] = "/boot/kernel/kernel"; /* XXX bloat */
char kernelname[MAXPATHLEN] = PATH_KERNEL; /* XXX bloat */
SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE,
kernelname, sizeof kernelname, "Name of kernel file booted");

View File

@ -32,6 +32,8 @@
#ifndef _SYS_BOOT_H_
#define _SYS_BOOT_H_
#define PATH_KERNEL "/boot/kernel/kernel"
int boot_env_to_howto(void);
void boot_howto_to_env(int howto);
int boot_parse_arg(char *v);