Page MenuHomeFreeBSD

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

Authored by imp on Sep 13 2022, 8:17 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 Not Applicable
Unit
Tests Not Applicable

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–269

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.