Page MenuHomeFreeBSD

i386: Make boot loader smaller by reducing size of bootinfo
ClosedPublic

Authored by imp on Sep 13 2022, 8:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 11:37 AM
Unknown Object (File)
Wed, Nov 6, 6:37 PM
Unknown Object (File)
Tue, Nov 5, 1:32 PM
Unknown Object (File)
Thu, Oct 17, 11:42 AM
Unknown Object (File)
Oct 15 2024, 5:52 AM
Unknown Object (File)
Oct 14 2024, 10:20 AM
Unknown Object (File)
Oct 12 2024, 10:33 PM
Unknown Object (File)
Oct 12 2024, 12:02 PM

Details

Summary

We don't need the 56 bytes at the end of bootinfo, and never had. Don't
copy them from old boot loaders, and don't provide them with new boot
loaders.

Add comments about what versions of FreeBSD 'old' means in various
contexts. Add note that old disk loader (from 1.x/2.x) is doomed to
failure because it doesn't provide metadata that we now require to boot,
and has been since approximately FreeBSD 7.x. Retain all this
information to explain why we have 4 arguments that are always 0, even
though it's ancient history.

This saves 56 bytes in the boot loader.

Sponsored by: Netflix

Test Plan

This boots for me (assuming I built the test jig correctly). I added the last people
to touch this code. Only two are still alive. Plus kib and jhb who likely are the only
others with the proper tribal knowledge here.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47364
Build 44251: arc lint + arc unit

Event Timeline

imp requested review of this revision.Sep 13 2022, 8:17 PM
imp created this revision.
imp added reviewers: jhb, kib, phk, rgrimes.

No protests from here.

This revision is now accepted and ready to land.Sep 13 2022, 8:36 PM
sys/i386/include/bootinfo.h
70

So somebody added EFI placeholders for i386 bootinfo in 2010. Are we completely giving up on EFI/i386 boot?

sys/i386/include/bootinfo.h
70

Yes. We've given up.

If others really want to do this, then the boot loader will pass the memory table to the kernel with metadata like we do for all the other platforms. We should know enough to be able to rummage around there to find the memory maps we need to bring up the vm system...

darius-dons.net.au added inline comments.
sys/i386/i386/locore.s
268

laoder -> loader

sys/i386/include/bootinfo.h
70

I would not be that categorical. In fact, my memory is that UEFI was functional for i386 loader, and the biggest missed parts are that i386 kernel

  • does not parse EFI memory map
  • has some BIOS calls in vm86 mode unconditionally done.

BTW, it is probably more EFI bits spread over the i386 loader code. May be, instead of removing, add some option like LOADER_EFI_I386, default *disabled*, and move all found code under #ifdef LOADER_EFI_I386?

sys/i386/include/bootinfo.h
70

I can be categorical because there's really no i386 loader today. __exec() is empty, there's some empty stubs. It only compiles, but little else is there, at least for 32-bit images. It would be a heavy lift to even get the i386 loader to parity with amd64 on the loader side. Based on my kboot experience getting amd64 going (partially and I copied from acpi), you'd be looking at at least a few weeks of somebody's time

These fields are left-over from the ia64 implementation that was copied here in preparation for making it work on i386, but that never happened.

In addition, the demand for i386 UEFI booting is super low as well, since so few 32-bit i386 boards were made that could load with UEFI.