aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2024-02-21 03:26:08 +0000
committerWarner Losh <imp@FreeBSD.org>2024-02-21 03:36:00 +0000
commit65ee8f90b7906a5895c87bfe05f85ce3d3bf84c7 (patch)
treeed85e577a1920a889c9e97b58f6315da856b504c /stand
parent9a5aaa97cbae024f90bb626f78c3dbde28653c58 (diff)
downloadsrc-65ee8f90b7906a5895c87bfe05f85ce3d3bf84c7.tar.gz
src-65ee8f90b7906a5895c87bfe05f85ce3d3bf84c7.zip
kboot: Fix zfs bootonce protocol
This wasn't updated when the other copies were updated. Make it identical to efi code. We should likely refactor this (with userboot), but they are all not quite identical. Sponsored by: Netflix
Diffstat (limited to 'stand')
-rw-r--r--stand/kboot/kboot/hostdisk.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/stand/kboot/kboot/hostdisk.c b/stand/kboot/kboot/hostdisk.c
index 552ae68daced..423151983523 100644
--- a/stand/kboot/kboot/hostdisk.c
+++ b/stand/kboot/kboot/hostdisk.c
@@ -567,40 +567,35 @@ hostdisk_zfs_probe(void)
/* This likely shoud move to libsa/zfs/zfs.c and be used by at least EFI booting */
static bool
-probe_zfs_currdev(uint64_t pool_guid, uint64_t root_guid, bool setcurrdev)
+probe_zfs_currdev(uint64_t pool_guid)
{
char *devname;
struct zfs_devdesc currdev;
- bool bootable;
+ char buf[VDEV_PAD_SIZE];
currdev.dd.d_dev = &zfs_dev;
currdev.dd.d_unit = 0;
currdev.pool_guid = pool_guid;
- currdev.root_guid = root_guid;
+ currdev.root_guid = 0;
devname = devformat(&currdev.dd);
- if (setcurrdev)
- set_currdev(devname);
-
- bootable = sanity_check_currdev();
- if (bootable) {
- char buf[VDEV_PAD_SIZE];
-
- if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) {
- printf("zfs bootonce: %s\n", buf);
- if (setcurrdev)
- set_currdev(buf);
- setenv("zfs-bootonce", buf, 1);
- }
- (void)zfs_attach_nvstore(&currdev);
- init_zfs_boot_options(devname);
+ printf("Setting currdev to %s\n", devname);
+ set_currdev(devname);
+ init_zfs_boot_options(devname);
+
+ if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) {
+ printf("zfs bootonce: %s\n", buf);
+ set_currdev(buf);
+ setenv("zfs-bootonce", buf, 1);
}
- return (bootable);
+ (void)zfs_attach_nvstore(&currdev);
+
+ return (sanity_check_currdev());
}
static bool
hostdisk_zfs_try_default(hdinfo_t *hd)
{
- return (probe_zfs_currdev(hd->hd_zfs_uuid, 0, true));
+ return (probe_zfs_currdev(hd->hd_zfs_uuid));
}
bool