Page MenuHomeFreeBSD

loader: Change this BIOS tradeoff: Add back zip and use text only
ClosedPublic

Authored by imp on Oct 19 2024, 7:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 9, 1:01 AM
Unknown Object (File)
Sat, Dec 7, 12:45 PM
Unknown Object (File)
Wed, Dec 4, 4:23 PM
Unknown Object (File)
Nov 17 2024, 7:50 AM
Unknown Object (File)
Nov 11 2024, 2:23 PM
Unknown Object (File)
Nov 11 2024, 2:18 PM
Unknown Object (File)
Nov 10 2024, 7:09 AM
Unknown Object (File)
Nov 6 2024, 8:46 PM

Details

Summary

After talking with a number of people about the removal of some things
to make the loader fit, readjust things a little.

Add back GZIP and BZIP2 compression support. Many of the downstream MFC
packaging systems depend on this. This adds back 20k to the size of the
loader.

Make the boot loader text-only by default. This saves 40k in size. Net,
we're 20k smaller. The graphics loader for BIOS is less useful than the
zip functionality: You can still boot w/a text only one it and you can
build a custom one if you really want it. It's also the default we use
for dual console.

This should be merged back into stable/14 and stable/13 so it's in the
next release for each of these. That way we have only one release (13.4)
with the other defaults.

MFC After: 3 days
Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Oct 19 2024, 7:28 PM
This revision is now accepted and ready to land.Oct 19 2024, 11:18 PM

While I agree with the rationale and the change:

  • Do we have those build options documented somewhere? I can not find them in build(7), loader(8), loader_lua(8) or tuning.
  • IMO this change should add some info somewhere (at least UPDATING, but ideally in some man page) about how to get back a graphical loader.

I don't have any say here but wanted to say that this makes a lot of sense to me. If you want it pretty, boot EFI. If you're still using BIOS (and I do) then text is fine.

Not trying to bikeshed, but I do wonder if it might be possible to also (if necessary) remove BZIP2 and keep GZIP. Probably beyond the context of this. I think this is great as it is.

While I agree with the rationale and the change:

  • Do we have those build options documented somewhere? I can not find them in build(7), loader(8), loader_lua(8) or tuning.

LOADER_BIOS_TEXTONLY is documented in src.conf:

WITH_LOADER_BIOS_TEXTONLY
        Use the old, FreeBSD 12 vidconsole.c.  This only supports text
        mode without teken, without any graphics, font or video mode
        support.  This setting only affects the i386 and amd64 BIOS boot
        loader.

(this will change to WITHOUT)

The other two are not documented because they aren't in any shape
to be documented. They work inside of the loader makefile only and
aren't really appropriate to document further since they aren't really
meant to be a user serviceable part (in the same way that LOADER_BIOS_TEXTONLY
is). This isn't changing for this commit. It's possible to create a derivative
system by changing it, and that's as good as it gets. Changing it to be
a real option is a lot of work that is beyond the scope of this change.
It sucks, but it's been like this for at least the last 15 years. I fixed most
of them to be Makefile only things, but there's still some magic that
assumes this default or that, and I'm not going to play the crazy
combinatoric game with them (since we'd need BIOS vs EFI and
4th vs Lua and on some platforms uboot vs EFI as well. It's an ugly
problem that I don't have time to solve (but would happily look
at other solutions). I know this is an unsatisfying answer, but
it's all I have time for and this change is more urgently needed than
docs here. They are tweaks to what are basically internal-only
variables use to create different subsets for different loaders
(see stand/loader.mk for how that's done, though adding some
comments there wouldn't be a bad idea as a separate thing).

  • IMO this change should add some info somewhere (at least UPDATING, but ideally in some man page) about how to get back a graphical loader.

Ah UPDATING is a good thing to add. Thanks for the suggestion. I'll add WITHOUT_LOADER_BIOS_TEXTONLY=t example to src.conf.

I don't have any say here but wanted to say that this makes a lot of sense to me. If you want it pretty, boot EFI. If you're still using BIOS (and I do) then text is fine.

Not trying to bikeshed, but I do wonder if it might be possible to also (if necessary) remove BZIP2 and keep GZIP. Probably beyond the context of this. I think this is great as it is.

In talking to downstream users, both GZIP and BZIP2 were used (though GZIP is more popular, I'll grant). The cost of BZIP2 is only like 10k, and I have two changes I need to test / debug that will get us back more than that by moving a couple things out of the 640k area that don't need to be there.

FYI, I added this to src.conf:

grep LOADER /etc/src.conf

LOADER_GZIP_SUPPORT=no
LOADER_BZIP2_SUPPORT=no
LOADER_BIOS_TEXTONLY=no
LOADER_NFS_SUPPORT=no
LOADER_TFTP_SUPPORT=no
LOADER_CD9660_SUPPORT=no

Then I went to /usr/src/stand/i386/loader and rebuild. The resulting binary in /usr/ob is 8k smaller than /boot/loader_lua (graphical, without compression, but with nfs, tftp and cd support).

Did I do something wrong, or is your makefile-only stuff working in src.conf?

rgrimes added a subscriber: rgrimes.

Yes please!

olce added a subscriber: olce.

I agree this is likely the most sensible tradeoff.

FYI, I added this to src.conf:

grep LOADER /etc/src.conf

LOADER_GZIP_SUPPORT=no
LOADER_BZIP2_SUPPORT=no
LOADER_BIOS_TEXTONLY=no
LOADER_NFS_SUPPORT=no
LOADER_TFTP_SUPPORT=no
LOADER_CD9660_SUPPORT=no

Then I went to /usr/src/stand/i386/loader and rebuild. The resulting binary in /usr/ob is 8k smaller than /boot/loader_lua (graphical, without compression, but with nfs, tftp and cd support).

Did I do something wrong, or is your makefile-only stuff working in src.conf?

It's global there, and affects all the loaders. That's what makes it makefile only: You can't set it with the build system to different values for different loaders. Of course, setting random variables in src.conf can have undefined effects and this is one of those times. There's too many issues / bugs with doing it this way that it's not ripe to document.

So, no. I'm not documenting this in the build stuff, since it's not ready. I have documented it in the loader.mk file, though, and sophisticated users can find it and do like what you've done, assuming they know what they are doing.