Re: Loader can't find /boot/ua/loader.lua on UFS after main-n255828-18054d0220c

From: Warner Losh <imp_at_bsdimp.com>
Date: Tue, 31 May 2022 23:05:41 UTC
On Tue, May 31, 2022 at 3:55 PM Olivier Cochard-Labbé <olivier@freebsd.org>
wrote:

> Same problem here:
> - I'm building FreeBSD head on a builder machine, and NFS mounting its
> /usr/src and /usr/obj to 4 others
>
> Results:
> - 2 of them, UEFI+ZFS machines works great ((Thinkpad T420 and AMD Epyc
> with Tyan motherboard)
> - 2 of them, BIOS+UFS machines meet this "can't find /boot/ua/loader.lua"
> (HP microserver and PC Engines APU2)
>
> I had to boot from an USB stick, mounting the system partition and "cp
> boot/loader_4th.old boot/loader".
>

Kirk found that the boot loader defines MAXPHYS to be 128k, which only is
for the BIOS loader since it's 32-bit. UEFI
is 64-bits and just works because it's define to 1MB. So the UEFI machines
with ZFS are doubly safe. Kirk has a change
that relaxes the check and I think we should do this

diff --git a/sys/sys/param.h b/sys/sys/param.h
index 1f720ed31142..8cd9616e872e 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -176,7 +176,7 @@
 #define DFLTPHYS       (64 * 1024)     /* default max raw I/O transfer
size */
 #endif
 #ifndef MAXPHYS                                /* max raw I/O transfer
size */
-#ifdef __ILP32__
+#if defined(__ILP32__) && !defined(_STANDALONE) /* Always 1M for loader */
 #define MAXPHYS                (128 * 1024)
 #else
 #define MAXPHYS                (1024 * 1024)

as well to ensure that the loader always assumes a larger MAXPHYS (though
I'd kinda like the loader to not
define it at all, but that is a longer conversation after reflection not a
quick fix to get people back up and
running).

Warner