Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/loader/main.c
Show All 34 Lines | |||||
#include <stand.h> | #include <stand.h> | ||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <machine/bootinfo.h> | #include <machine/bootinfo.h> | ||||
#include <machine/cpufunc.h> | #include <machine/cpufunc.h> | ||||
#include <machine/psl.h> | #include <machine/psl.h> | ||||
#include <sys/disk.h> | #include <sys/disk.h> | ||||
#include <sys/reboot.h> | #include <sys/reboot.h> | ||||
#include <sys/zfs_bootenv.h> | |||||
#include <common/drv.h> | #include <common/drv.h> | ||||
#include "bootstrap.h" | #include "bootstrap.h" | ||||
#include "common/bootargs.h" | #include "common/bootargs.h" | ||||
#include "libi386/libi386.h" | #include "libi386/libi386.h" | ||||
#include <smbios.h> | #include <smbios.h> | ||||
#include "btxv86.h" | #include "btxv86.h" | ||||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | |||||
* XXX should be extended for netbooting. | * XXX should be extended for netbooting. | ||||
*/ | */ | ||||
static void | static void | ||||
extract_currdev(void) | extract_currdev(void) | ||||
{ | { | ||||
struct i386_devdesc new_currdev; | struct i386_devdesc new_currdev; | ||||
#ifdef LOADER_ZFS_SUPPORT | #ifdef LOADER_ZFS_SUPPORT | ||||
char buf[20]; | char buf[20]; | ||||
char *bootonce; | |||||
#endif | #endif | ||||
int biosdev = -1; | int biosdev = -1; | ||||
/* Assume we are booting from a BIOS disk by default */ | /* Assume we are booting from a BIOS disk by default */ | ||||
new_currdev.dd.d_dev = &bioshd; | new_currdev.dd.d_dev = &bioshd; | ||||
/* new-style boot loaders such as pxeldr and cdldr */ | /* new-style boot loaders such as pxeldr and cdldr */ | ||||
if (kargs->bootinfo == 0) { | if (kargs->bootinfo == 0) { | ||||
Show All 31 Lines | if (zargs != NULL && | ||||
setenv("vfs.zfs.boot.primary_vdev", buf, 1); | setenv("vfs.zfs.boot.primary_vdev", buf, 1); | ||||
} | } | ||||
} else { | } else { | ||||
/* old style zfsboot block */ | /* old style zfsboot block */ | ||||
new_currdev.d_kind.zfs.pool_guid = kargs->zfspool; | new_currdev.d_kind.zfs.pool_guid = kargs->zfspool; | ||||
new_currdev.d_kind.zfs.root_guid = 0; | new_currdev.d_kind.zfs.root_guid = 0; | ||||
} | } | ||||
new_currdev.dd.d_dev = &zfs_dev; | new_currdev.dd.d_dev = &zfs_dev; | ||||
if ((bootonce = malloc(VDEV_PAD_SIZE)) != NULL) { | |||||
if (zfs_get_bootonce(&new_currdev, OS_BOOTONCE_USED, | |||||
bootonce, VDEV_PAD_SIZE) == 0) { | |||||
setenv("zfs-bootonce", bootonce, 1); | |||||
} | |||||
free(bootonce); | |||||
(void) zfs_attach_nvstore(&new_currdev); | |||||
} | |||||
#endif | #endif | ||||
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) { | } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) { | ||||
/* The passed-in boot device is bad */ | /* The passed-in boot device is bad */ | ||||
new_currdev.d_kind.biosdisk.slice = -1; | new_currdev.d_kind.biosdisk.slice = -1; | ||||
new_currdev.d_kind.biosdisk.partition = 0; | new_currdev.d_kind.biosdisk.partition = 0; | ||||
biosdev = -1; | biosdev = -1; | ||||
} else { | } else { | ||||
new_currdev.d_kind.biosdisk.slice = | new_currdev.d_kind.biosdisk.slice = | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |