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)
Wed, Jul 24, 9:55 AM
Unknown Object (File)
Mon, Jul 22, 11:44 AM
Unknown Object (File)
Sat, Jul 13, 1:21 PM
Unknown Object (File)
Fri, Jun 28, 8:02 AM
Unknown Object (File)
Jun 15 2024, 7:46 PM
Unknown Object (File)
Jun 14 2024, 12:57 AM
Unknown Object (File)
May 30 2024, 3:04 PM
Unknown Object (File)
May 17 2024, 4:51 AM
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