summaryrefslogtreecommitdiff
path: root/stand/efi
diff options
context:
space:
mode:
authorToomas Soome <tsoome@FreeBSD.org>2020-06-20 06:23:31 +0000
committerToomas Soome <tsoome@FreeBSD.org>2020-06-20 06:23:31 +0000
commit3830659e99640001c09d26dfc0e1bbd77d919a62 (patch)
treec05db1c928b5f34c3b3027ccc6fef6cc7949423b /stand/efi
parent830efe55395a27f0a72812b5a028e323ee3981a6 (diff)
downloadsrc-test-3830659e99640001c09d26dfc0e1bbd77d919a62.tar.gz
src-test-3830659e99640001c09d26dfc0e1bbd77d919a62.zip
loader: create single zfs nextboot implementation
We should have nextboot feature implemented in libsa zfs code. To get there, I have created zfs_nextboot() implementation based on two sources, our current simple textual string based approach with added structured boot label PAD structure from OpenZFS. Secondly, all nvlist details are moved to separate source file and restructured a bit. This is done to provide base support to add nvlist add/update feature in followup updates. And finally, the zfsboot/gptzfsboot disk access functions are swapped to use libi386 and libsa. Sponsored by: Netflix, Klara Inc. Differential Revision: https://reviews.freebsd.org/D25324
Notes
Notes: svn path=/head/; revision=362431
Diffstat (limited to 'stand/efi')
-rw-r--r--stand/efi/libefi/Makefile2
-rw-r--r--stand/efi/loader/main.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/stand/efi/libefi/Makefile b/stand/efi/libefi/Makefile
index 6e5628047e17c..8bbd421486cae 100644
--- a/stand/efi/libefi/Makefile
+++ b/stand/efi/libefi/Makefile
@@ -52,6 +52,8 @@ CFLAGS.efi_console.c+= -I${SRCTOP}/sys/teken
CFLAGS.teken.c+= -I${SRCTOP}/sys/teken
.if ${MK_LOADER_ZFS} != "no"
CFLAGS+= -I${ZFSSRC}
+CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
+CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
CFLAGS+= -DEFI_ZFS_BOOT
.endif
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 14c320a098114..6ad626b2df393 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -260,6 +260,8 @@ probe_zfs_currdev(uint64_t guid)
{
char *devname;
struct zfs_devdesc currdev;
+ char *buf = NULL;
+ bool rv;
currdev.dd.d_dev = &zfs_dev;
currdev.dd.d_unit = 0;
@@ -269,7 +271,18 @@ probe_zfs_currdev(uint64_t guid)
devname = efi_fmtdev(&currdev);
init_zfs_bootenv(devname);
- return (sanity_check_currdev());
+ rv = sanity_check_currdev();
+ if (rv) {
+ buf = malloc(VDEV_PAD_SIZE);
+ if (buf != NULL) {
+ if (zfs_nextboot(&currdev, buf, VDEV_PAD_SIZE) == 0) {
+ printf("zfs nextboot: %s\n", buf);
+ set_currdev(buf);
+ }
+ free(buf);
+ }
+ }
+ return (rv);
}
#endif