Weekly Status Report(s) #1/2: Loader quality of life

From: Connor Bailey <connorbailey777_at_gmail.com>
Date: Sat, 25 Jun 2022 18:18:05 UTC
Hi,

The general goal of my project is to fix-up a bunch of quality of life 
problems in/around the loader. For example, the lack of editing key 
support at the prompt.
My project involves a number of smaller things, so I'll leave listing 
them to the wiki page [1].

Technically, development started around the GSoC application phase, but 
I only implemented the left arrow key as a bit of a hack, so that change 
won't be reused.
Also, this report includes both week 1 and 2 (sorry about that!). I've 
got enough alarms and reminders set that that my weekly reports should 
be more weekly from now on.

Week 1:

I didn't plan the most interesting first week, but got a lot of solid 
foundations built out.
Mostly, this was figuring out how I could actually test my changes since 
unit tests for a bootloader aren't very viable, so instead I settled on 
a bunch of smoke tests. I set up VMs for i386 PXE booting, AMD64 legacy 
booting, and AMD64 UEFI booting. I left out plain i386 legacy booting 
since the AMD64 legacy flow ends up running the same code right up until 
it jumps into the kernel.
I've also got physical machines to test with, including some arm. 
Although I only plan on doing physical testing to verify everything 
works at the end of a week/feature.

After forgetting "DESTDIR=" on a "make install", I ended up turning my 
host machine's loader prompt into "AAA", so I also set up some helpers 
to mount/update/unmount/test each VM instead of allowing a typo to break 
my host.

Week 2:

During the dev summit, bug 257018 [2] caught my eye, so I took a (mentor 
approved) detour through i386 PXE booting intricacies, which ended up 
teaching me a lot (since I'm a bit spoiled by AMD64/UEFI). I thought 
that I'd even managed to find the root cause of the bug in a 
semi-obvious place, and spent a majority of the week implementing my fix.
I had thought that the file PXE downloads was too big (and ended up 
clobbering important memory), so I tried to implement a medium sized 
"boot2" which would be small enough to keep said important memory intact.

However, I was wrong about the bug, and wasted a bunch of time solving a 
non-issue. So, this week didn't go perfectly, but I learned so much that 
it doesn't bother me too much. In the end I threw away most of the code, 
but kept around some makefile changes that would cut down on some 
duplication, and might try to flesh out the architecture handbook to 
explain the corner of the code that I tripped over.

Connor

[1] 
https://wiki.freebsd.org/SummerOfCode2022Projects/FreeBSDBootloaderQualityOfLifeImprovements 

[2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257018