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)
Nov 25 2024, 1:01 AM
Unknown Object (File)
Oct 31 2024, 2:43 PM
Unknown Object (File)
Oct 19 2024, 9:44 PM
Unknown Object (File)
Oct 3 2024, 2:02 PM
Unknown Object (File)
Sep 24 2024, 11:21 AM
Unknown Object (File)
Sep 22 2024, 12:37 PM
Unknown Object (File)
Sep 19 2024, 1:10 AM
Unknown Object (File)
Sep 18 2024, 10:10 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