Page MenuHomeFreeBSD

efi: Add zfs bootonce support to boot1.efi
AbandonedPublic

Authored by imp on Apr 3 2023, 11:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 14 2024, 11:50 PM
Unknown Object (File)
Jan 3 2024, 12:26 PM
Unknown Object (File)
Dec 20 2023, 1:34 AM
Unknown Object (File)
Dec 13 2023, 3:03 AM
Unknown Object (File)
Oct 15 2023, 9:05 AM
Unknown Object (File)
Oct 15 2023, 9:05 AM
Unknown Object (File)
Aug 15 2023, 2:48 AM
Unknown Object (File)
Jul 1 2023, 10:17 PM
Subscribers

Details

Summary

We have a usecase where we have to chainload loader.efi off the
dataset. The recent loader.efi breakage was such that it happened before
it could clear bootonce. We really should be clearing it in boot1.efi in
this case so that we can fall back to the last known good image.

We have to re-implement the bootonce protocol here because boot1 doesn't
have devdesc. But inlining zfs_get_bootonce and all it calls was only
about 20 lines of actual lines of code since we didn't have to go back
and forth to the devdesc, lookup the spa many times, etc. Add comments
to this effect with details.

Sponsored by: Netflix

Test Plan

The generic kenv stuff could be separated out, so opinions on that would be good.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 50740
Build 47631: arc lint + arc unit

Event Timeline

imp requested review of this revision.Apr 3 2023, 11:03 PM
imp added reviewers: tsoome, kevans, allanjude.

I had a gut reaction at first when I hit the word "Inlined," but it's really not bad. I don't think the zfs_get_bootenv() part is likely to change, but can you add a note to zfs_get_bootonce() that it's' been inlined here in case we end up, e.g., doing more than just removing this key and writing it back out at some point?

stand/efi/boot1/boot1.c
103

!= NULL

stand/efi/boot1/zfs_module.c
157

I believe this is zfs_get_bootenv

This revision is now accepted and ready to land.Apr 4 2023, 1:31 AM