Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/loader/main.c
Show First 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) { | ||||
new_currdev.dd.d_dev = &bioscd; | new_currdev.dd.d_dev = &bioscd; | ||||
new_currdev.dd.d_unit = bd_bios2unit(initial_bootdev); | new_currdev.dd.d_unit = bd_bios2unit(initial_bootdev); | ||||
} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) { | } else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) { | ||||
/* we are booting from pxeldr */ | /* we are booting from pxeldr */ | ||||
new_currdev.dd.d_dev = &pxedisk; | new_currdev.dd.d_dev = &pxedisk; | ||||
new_currdev.dd.d_unit = 0; | new_currdev.dd.d_unit = 0; | ||||
} else { | } else { | ||||
/* we don't know what our boot device is */ | /* we don't know what our boot device is */ | ||||
new_currdev.d_kind.biosdisk.slice = -1; | new_currdev.disk.d_slice = -1; | ||||
new_currdev.d_kind.biosdisk.partition = 0; | new_currdev.disk.d_partition = 0; | ||||
biosdev = -1; | biosdev = -1; | ||||
} | } | ||||
#ifdef LOADER_ZFS_SUPPORT | #ifdef LOADER_ZFS_SUPPORT | ||||
} else if ((kargs->bootflags & KARGS_FLAGS_ZFS) != 0) { | } else if ((kargs->bootflags & KARGS_FLAGS_ZFS) != 0) { | ||||
/* | /* | ||||
* zargs was set in main() if we have new style extended | * zargs was set in main() if we have new style extended | ||||
* argument | * argument | ||||
*/ | */ | ||||
if (zargs != NULL && | if (zargs != NULL && | ||||
zargs->size >= | zargs->size >= | ||||
offsetof(struct zfs_boot_args, primary_pool)) { | offsetof(struct zfs_boot_args, primary_pool)) { | ||||
/* sufficient data is provided */ | /* sufficient data is provided */ | ||||
new_currdev.d_kind.zfs.pool_guid = zargs->pool; | new_currdev.zfs.pool_guid = zargs->pool; | ||||
new_currdev.d_kind.zfs.root_guid = zargs->root; | new_currdev.zfs.root_guid = zargs->root; | ||||
if (zargs->size >= sizeof(*zargs) && | if (zargs->size >= sizeof(*zargs) && | ||||
zargs->primary_vdev != 0) { | zargs->primary_vdev != 0) { | ||||
sprintf(buf, "%llu", zargs->primary_pool); | sprintf(buf, "%llu", zargs->primary_pool); | ||||
setenv("vfs.zfs.boot.primary_pool", buf, 1); | setenv("vfs.zfs.boot.primary_pool", buf, 1); | ||||
sprintf(buf, "%llu", zargs->primary_vdev); | sprintf(buf, "%llu", zargs->primary_vdev); | ||||
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.zfs.pool_guid = kargs->zfspool; | ||||
new_currdev.d_kind.zfs.root_guid = 0; | new_currdev.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 ((bootonce = malloc(VDEV_PAD_SIZE)) != NULL) { | ||||
if (zfs_get_bootonce(&new_currdev, OS_BOOTONCE_USED, | if (zfs_get_bootonce(&new_currdev, OS_BOOTONCE_USED, | ||||
bootonce, VDEV_PAD_SIZE) == 0) { | bootonce, VDEV_PAD_SIZE) == 0) { | ||||
setenv("zfs-bootonce", bootonce, 1); | setenv("zfs-bootonce", bootonce, 1); | ||||
} | } | ||||
free(bootonce); | free(bootonce); | ||||
(void) zfs_attach_nvstore(&new_currdev); | (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.disk.d_slice = -1; | ||||
new_currdev.d_kind.biosdisk.partition = 0; | new_currdev.disk.d_partition = 0; | ||||
biosdev = -1; | biosdev = -1; | ||||
} else { | } else { | ||||
new_currdev.d_kind.biosdisk.slice = | new_currdev.disk.d_slice = B_SLICE(initial_bootdev) - 1; | ||||
B_SLICE(initial_bootdev) - 1; | new_currdev.disk.d_partition = B_PARTITION(initial_bootdev); | ||||
new_currdev.d_kind.biosdisk.partition = | |||||
B_PARTITION(initial_bootdev); | |||||
biosdev = initial_bootinfo->bi_bios_dev; | biosdev = initial_bootinfo->bi_bios_dev; | ||||
/* | /* | ||||
* If we are booted by an old bootstrap, we have to guess at | * If we are booted by an old bootstrap, we have to guess at | ||||
* the BIOS unit number. We will lose if there is more than | * the BIOS unit number. We will lose if there is more than | ||||
* one disk type and we are not booting from the | * one disk type and we are not booting from the | ||||
* lowest-numbered disk type (ie. SCSI when IDE also exists). | * lowest-numbered disk type (ie. SCSI when IDE also exists). | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |