Commit Graph

2313 Commits

Author SHA1 Message Date
Simon J. Gerraty b44cc1b479 loader: do not try to open directories with TFTP
Attempting to mount or even open / with some tftp servers
causes a several minute delay in boot.

Since opening a directory via TFTP does not make sense, we
avoid it.  We don't know if using TFTP until after net_open()
has been called.

Add an is_tftp() accessor to avoid everyone having to include
all the net* headers.

Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51447
2025-08-20 15:45:54 -07:00
Simon J. Gerraty aaf65a13c0 stand: add fs_ops.fs_flag
To avoid a layering violation in open() allow fs_ops to
indicate that devopen() should be skipped.

This is only true for pkgfs.

Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51684
2025-08-20 15:42:35 -07:00
Gleb Smirnoff fe2418f26e libsa/zfs: inline vdev_init_from_label() into vdev_probe()
This function is used only once and also pulls three variables from the
nvlist that the only caller have already pulled out.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D52031
2025-08-20 07:53:20 -07:00
Gleb Smirnoff a1572e202a libsa/zfs: further improve handling of stale labels
Fix two problems with 6dd0803ffd.  First problem is that situation when
newer label was read before stale one, was handled differently to reverse
order case.  Second problem is that vdev_free() would free the fully
initialized leaf vdev that carried stale label.  In a case when vdev
carries a stale label, but is still referenced by a different label with
new a configuration, we don't want to free it, but rather insert it into
the new configuration.

o Provide a helper function nvlist_find_vdev_guid() that checks presence
  of certain GUID in a label.
o In top level vdev store the GUID of vdev used to instantiate top vdev.
o Cover all possible cases in the block in vdev_probe() where we encounter
  a known configuration.  Make the diagnostic print more informative and
  looking same regardless of probe order.  Make this whole block easier to
  read reducing one level of indentation for a price of a single comparison
  at runtime.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D51913
Fixes:			6dd0803ffd
2025-08-20 07:52:20 -07:00
Gleb Smirnoff 9dbd8ee116 libsa/zfs: refactor vdev tree for better resiliency against stale disks
Before this change in vdev_insert() we would avoid inserting a duplicate
vdev to the list of children, however this duplicate being unlinked from
the parent is still stored on the global list with initialized v_guid.
Such leaked duplicate can later be returned by vdev_find().  After
6dd0803ffd such leaked vdev may be freed or pointing to a freed parent,
which leads to a loader crash.  Note that the leak problem was there
before 6dd0803ffd.

First, in vdev_insert() free conflicting vdev and return the existing one.
Update callers accordingly.  There is only one caller that actually may
encounter this condition.

Second, eliminate global list of vdevs and make vdev_find() to work
recursively on the tree that a caller must provide.  Of course, a chance
of GUID collision between members of different pools is extremely low. The
main motivation here is just to increase code robustness and fully isolate
the data structures of different pools being tasted by the loader, and
make easier debugging of bugs like the one being fixed.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D51912
Fixes:			6dd0803ffd
2025-08-20 07:51:21 -07:00
Gleb Smirnoff 8ef5016f73 libsa/zfs: simplify vdev_find_previous()
An empty list case is properly covered by the cycle.
Don't pass pointer to vdev being looked up, pass just id.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D51911
2025-08-20 07:51:14 -07:00
Gleb Smirnoff de055556a0 libsa/zfs: ignore labels with zero txg
Zero txg means this vdev has been correctly removed from the pool.  For
reference see module/zfs/vdev_removal.c in OpenZFS.  It calls
vdev_label_init(vd, 0, VDEV_LABEL_REMOVE), and second argument there is
the txg to write.

Reviewed by:		tsoome, mav, imp
Differential Revision:	https://reviews.freebsd.org/D51910
2025-08-20 07:51:08 -07:00
Gleb Smirnoff 5d5d03356e libsa/zfs: remove unused variable
In vdev_init_from_label() we obtain the pool guid but don't use it.

Reviewed by:		tsoome, mav, imp
Differential Revision:	https://reviews.freebsd.org/D51909
2025-08-20 07:50:58 -07:00
Andrew Turner a2e28ba792 kboot: Support reading the smbios vis sysfs
When reading the smbios on Linux we try to access it via /dev/mem. On
some systems we can't do this as /dev/mem is locked down. To handle
this try reading the sysfs file first, and if that fails fall back to
/dev/mem.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D51413
2025-07-30 19:35:29 +01:00
Gordon Bergling a7818e3420 stand/efi: Fix a typo in a source code comment
- s/externel/external/

MFC after:	3 days
2025-08-17 11:23:45 +02:00
Toomas Soome d439a15512 libsa: ip fragment reassembly is buggy
Well, it does not really work and we are getting retransmits.
To replicate, set nfs.read_size large enough.

What needs to happen is, we read ethernet packet, if it has
IPv4 payload and that payload is fragment, we create reassembly
queue (sorted by growing fragment offset) and on last
fragment, we can build complete packet. Once done properly,
the network load can utilize larger read sizes.

While there, move ARP (and other) processing out of readipv4().

Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D51690
2025-08-08 10:10:08 +03:00
Martin Matuska df58e8b150 zfs: merge openzfs/zfs@8302b6e32
Notable upstream pull request merges:
 #16853 894edd084 Add TXG timestamp database
 #17004 -multiple Implement dynamic gang header sizes
 #17405 dea0fc969 ZVOL: Return early, if volmode is ZFS_VOLMODE_NONE
                  on FreeBSD side
 #17455 cf146460c Default to zfs_bclone_wait_dirty=1
 #17481 523d9d600 Validate mountpoint on path-based unmount using statx
 #17482 92da9e0e9 ZVOL: Implement zvol_alloc() function on FreeBSD side
 #17489 dee62e074 spa: ZIO_TASKQ_ISSUE: Use symbolic priority
 #17496 bf846dcb7 Release topology restrictions on special/dedup
 #17497 4e92aee23 Relax special_small_blocks restrictions
 #17503 ea38787f2 Revert "Fix incorrect expected error in ztest"
 #17505 be1e991a1 Allow and prefer special vdevs as ZIL
 #17506 ee0cb4cb8 ztest: Fix false positive of ENOSPC handling
 #17507 92d3b4ee2 zio: rename `io_reexecute` as `io_post`;
                  use it for the direct IO checksum error flag
 #17508 6af8db61b metaslab: don't pass whole zio to throttle reserve APIs
 #17518 4c2a7f85d FreeBSD: Add support for _PC_HAS_HIDDENSYSTEM
 #17521 d7ab07dfb ZIL: Force writing of open LWB on suspend
 #17524 b6e8db509 zpool/zfs: Add '-a|--all' option to scrub, trim,
                  initialize
 #17531 c1e51c55f Correct weight recalculation of space-based metaslabs
 #17533 d323fbf49 FreeBSD: zfs_putpages: don't undirty pages until
                  after write completes
 #17536 b21e04e8d Fix zdb pool/ with -k
 #17537 -multiple Userspace tunables
 #17540 2957eabbe Add support for FreeBSD's Solaris style extended
                  attribute interface
 #17547 4bd7a2eaa zdb: fix checksum calculation for decompressed blocks
 #17551 -multiple cleanup: remove var init/update
 #17561 0f8a1105e Skip dbuf_evict_one() from dbuf_evict_notify()
                  for reclaim thread
 #17563 10a78e264 Faster checksum benchmark on system boot
 #17564 00ce064d8 spa: update blkptr diagram to include vdev padding
                  on encrypted blocks
 #17565 -multiple Physical rewrite
 #17566 fc885f308 Don't use wrong weight when passivating group
 #17572 f70c85086 BRT: Fix ZAP entry endianness
 #17575 0b6fd024a ZVOL: Unify zvol minors operations and improve error
                  handling
 #17581 cb5e7e097 range_tree: Provide more debug details upon unexpected
                  add/remove
 #17587 -multiple Fix two issues with dynamic gang headers

Obtained from:	OpenZFS
OpenZFS commit:	8302b6e32b
2025-08-07 09:06:31 +02:00
Toomas Soome 733da235aa libsa: errors with pointer conversion
loader ip implementation is using pointer to structure ip to receive
the packet and is using this pointer to cast on other data types
(namely structure arphdr). Problem does arise when those data structures
are declared with different alignment rules and when/if the compiler
does check those rules. To work around and silence warnings, use
void * generic pointer instead.

Error seen with gcc 14 (-Werror=address-of-packed-member).

Reviewed by:    imp
Differential Revision: https://reviews.freebsd.org/D51662
2025-08-01 01:04:32 +03:00
Kyle Evans 763a097c15 loader: add nvidia modules to the loader blacklist
It is known that nvidia modules, like the drm modules that are already
present, will panic if loaded in early boot rather than later.  Pop them
into our list to deny loading them if someone were to add, e.g.,
nvidia-modeset_load="YES", to their loader.conf.  This doesn't prevent
them from being loaded if one drops to the loader prompt, but it does
prevent the standard user from easy foot-shooting if they find old or
inaccurate information out in the wild.

Reviewed by:	imp, kbowling
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D51644
2025-07-30 23:41:28 -05:00
John Baldwin df607c941f stand/i386: Don't include SASRC in .PATH of boot loaders
These link against libsa instead of pulling individual sources from
the libsa source directory.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D51599
2025-07-28 14:31:26 -04:00
John Baldwin 4e2cbc4466 stand/i386: Remove references to empty variable OPENCRYPTO_XTS
Reviewed by:	imp
Fixes:		4728f534ff ("Move LOADER_{NO,}_GELI_SUPPORT to MK_LOADER_GELI")
Differential Revision:	https://reviews.freebsd.org/D51598
2025-07-28 14:31:26 -04:00
John Baldwin a88cd55ba8 gptzfsboot: Move zfsboot.c source into its sole consumer
Suggested by:	imp
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D51597
2025-07-28 14:31:26 -04:00
John Baldwin a3b72d89c7 zfsboot: Remove zfsboot(8) program used to boot ZFS from MBR + BIOS
This has not worked since the import of OpenZFS in FreeBSD 13.0.
Trying to fix it at this point would probably entail rearchitecting
how it works (e.g. using a dedicated freebsd-boot slice to hold
zfsboot).  However, it's not really worth doing that at this point.

PR:		271262
Reported by:	Henryk Paluch <hpaluch@seznam.cz>
Reviewed by:	imp, emaste
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D51545
2025-07-28 10:58:02 -04:00
kpowkitty bfa4759d51 replace raw isprint() w/ isprint() func
Signed-off-by: Kayla Powell (AKA Kat) <kpowkitty@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1740
2025-07-23 00:33:06 -06:00
kpowkitty 87c326e41e libsa: isprint()
libsa is missing isprint().  Adding it with the other isfoo()
functions. Remove a stray copy from fdt too.

Signed-off-by: Kayla Powell (AKA Kat) <kpowkitty@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1740
2025-07-23 00:32:40 -06:00
Richard Russo 15925062e1 biosboot: Detect memory disks from PXE
Walk through the disk driver entries chained off of INT13.

MEMDISK is part of the Syslinux project; it loads disk images into
memory, sets an int 13h hook and then does a BIOS boot from the image;
this can be used as part of a PXE boot environment to load installer
disks, however the disks are not accessible from inside the FreeBSD
kernel because it doesn't access disks through BIOS APIs.

This patch detects the disk images in the loader, and passes their
address and length as a driver hint. When the md driver sees the hint,
it maps the image, and presents it to the system.

(rebased and reworked from https://reviews.freebsd.org/D27349)

Feedback from: kib, bapt, olce
Differential Revision:	https://reviews.freebsd.org/D45404
2025-07-22 18:10:25 -06:00
Simon J. Gerraty cae98cf683 install: allow ENV in metatags
The metatags file informs install of kernel and modules to load,
allow it to also case variables to be set in env.

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc
Differential Revision:	https://reviews.freebsd.org/D51446
2025-07-21 10:14:00 -07:00
Aymeric Wibo 860f20cc13 stand: Add print_delay environment variable in loader
This adds support for a new `print_delay` environment variable,
which inserts a delay in microseconds when `putchar` encounters a
newline character. This can be useful when debugging.

Reviewed by:	markj, imp, ziaee, mckusick (mentor)
Approved by:	markj, imp, ziaee, mckusick (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50832
2025-07-21 16:33:20 +02:00
Simon J. Gerraty e67aef4190 Add DEBUG_PRINTF to stand.h
stand/ is mostly debugged with printfs, in an ad hoc and sometimes
fragile manner. For example BOOTP_DEBUG in bootp.c cannot be defined
unless NETIF_DEBUG is defined in dev_net.c or build fails for lack of the
symbol debug.

The DEBUG_PRINTF implementation in stand.h addresses that and allows
for more control over debug output.  It is compatible with the
usage in libsecureboot.

Simply define _DEBUG_LEVEL to the desired level of debug
or in the case of libsecureboot _DEBUG_LEVEL_VAR to the variable that
will hold that value - default is _debug which is static so each
translation unit can be controlled independently.

The 1st arg to DEBUG_PRINTF is a level which must be greater than or
equal to _DEBUG_LEVEL_VAR if the printf is to be called.
See libsecureboot for more examples.

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51269
2025-07-17 16:36:17 -07:00
Gleb Smirnoff 6dd0803ffd libsa/zfs: prefer a vdev with newer txg to a stale one
Before this change, the first probed member of a pool would initialize
vdev tree for the pool.  Now, imagine a situation when a machine has a
disk that has been removed from the pool, but the ZFS label was not
erased.  That's a typical scenario - disk goes offline, it is replaced
with a spare, no data changes written to the gone disk.  Then, disk
appears back at boot time and it is the first one to be probed by the
loader.  It has the same pool GUID as all other members and naive loader
would not see a conflict.  Then the disk will be used as source of truth
to read the bootenv.

To fix that, provide vdev_free() that allows to rollback the already
prebuilt vdev tree, so that a new one can be built from scratch.  Upon
encountering a newer configuration for already known top level part of a
pool, call vdev_free() and let vdev_probe() to build a new one.

The change has been tested with loader_lua and userboot.so, but it should
have same effect on the legacy boot1 loader.

Reviewed by:		tsoome, mav, imp
Differential Revision:	https://reviews.freebsd.org/D51219
2025-07-16 11:15:54 -07:00
Gleb Smirnoff 8e8fd66ca0 libsa/zfs: fail earlier in vdev_probe() if can't find ZPOOL_CONFIG_GUID
Don't store any configuration in memory from such weird label.
2025-07-10 20:26:01 -07:00
Gleb Smirnoff 8949cdd9af libsa/zfs: don't read and store ZPOOL_CONFIG_VDEV_CHILDREN in vdev_probe()
This is just the value from the current label and it is not used in the
function.  Later zfs_spa_init() will call vdev_init_from_nvlist() and
it will obtain the value.
2025-07-10 20:18:36 -07:00
Gleb Smirnoff 03f3dc3189 libsa/zfs: don't hardcode root vdev name, use the real pool name 2025-07-10 20:07:39 -07:00
Gleb Smirnoff f1eceb963c libsa/zfs: add error printf() in zfs_spa_init()
All other error exits from this function print something.
2025-07-10 20:04:50 -07:00
Simon J. Gerraty d1f0ee548c Allow net_cleanup for loader.efi
While netbooting with loader.efi on at least one arm64 platform
which uses u-boot emulating UEFI, the kernel gets corrupted, we
suspected the u-boot ethernet driver was still running.

Use netdev.dv_cleanup for efinet_dev to address this.

This in turn requires calling dev_cleanup() before bi_load() to avoid
a loader crash since bi_load() calls ExitBootServices.

Reviewed by:	imp
Sponsored by:   Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51186
2025-07-10 11:14:38 -07:00
Tom Jones d72c74a6c5 loader: Add halt as an alias to poweroff machine
Add halt as an alias to also poweroff a machine from the loader prompt,
this is consistent with ddb.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51132
2025-07-04 07:37:31 +01:00
Joseph Mingrone ac7a19d41e lualoader: Add distinct brand for installer
Make it obvious to users that the system is booting into the installer.

Reviewed by:	kevans, manu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51001
2025-06-24 12:11:15 -03:00
Ahmad Khalifa b670c9bafc newbus: replace leftover device unit wildcards
Reviewed by:	imp, jhb
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50913
2025-06-21 05:57:45 +03:00
Kyle Evans eca5637760 stand: userboot: allow building on !x86
We can still get plenty of use out of a userboot that doesn't know
anything about how to load or boot a kernel; notably, the test harness
in tools/boot can still be used to test lua changes.

Hack out the necessary bits to simply build on other platforms, and add
a small warning with ample time to view the warning on other platforms.
We still won't build userboot by default on these platforms, since the
build product isn't useful for most people.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D41529
2025-06-18 13:42:29 -05:00
Kyle Evans abdbd85d1b lualoader: adapt builtin brand/logo definitions as well
While these should be moved to the new format, it wasn't my intention
to force them over immediately.  Downstreams may embed their own brands
in drawer.lua, and we shouldn't break them for something like this.

Move adapt_fb_shim() up and use it for preloaded definitions to avoid
forcing the matter for now.  Perhaps in the future we'll start writing
out warnings for those that do need adapted.

Reported by:	0x1eef on IRC
2025-06-18 10:21:37 -05:00
Emmanuel Vadot 7e1930480b loader: Fix loader_brand = none
Setting loader_brand to none in loader.conf now result in a lua error
as we try to get a non-existant table
Defines it

Differential Revision:	https://reviews.freebsd.org/D50875
Fixes:	bef6d85b6d ("lualoader: allow graphical bits to be disabled with loader_gfx")
Reviewed by:	kevans, tsoome
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2025-06-17 08:06:29 +02:00
Kyle Evans 1beab149d0 stand: lua: add a more productive comment
The global `shift` is a special little hack for shifting everything when
the logo is gone, and we should explain that.

Fixes:	33d3373faf ("stand: lua: convert orb to a new format [...]")
2025-06-12 21:33:11 -05:00
Kyle Evans 33d3373faf stand: lua: convert orb to a new format that allows per-graphic shift
Previously, we had one shift that had to work for both the ASCII version
and the image that we may draw if we have a framebuffer to play with.
That makes it more difficult to get the positioning just right, so split
them out into their own tables for convenience.

While we're here, stop clipping off the bottom of the orb when the
autoboot sequence is interrupted.  There's plenty of space for it to
move up a hair, so let's do that..

Reviewed by:	imp, tsoome
Differential Revision:	https://reviews.freebsd.org/D50801
2025-06-12 21:23:39 -05:00
Bjoern A. Zeeb 55efb3bf2b loader.conf: add LinuxKPI based wireless drivers to module_blacklist
Despite being discouraged in the man page people are trying to load
the driver from loader.  In that case firmware is missing and the
root file system is not there yet and the LinuxKPI based drivers
will panic the system on boot.  Simply avoid any further support
trouble by disallowing them to be loaded from loader.
If someone still wants to do it, they will need to figure out how
to remove them from the blocklst and how to loader the firmware
file(s) in advance themselves.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
PR:		287480
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D50817
2025-06-12 15:34:07 +00:00
tropicahq 150274edd2 Update tramp.S comment
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1705
Closes: https://github.com/freebsd/freebsd-src/pull/1705
2025-06-11 17:16:21 -06:00
Brooks Davis e453e498cb machine/stdarg.h -> sys/stdarg.h
Switch to using sys/stdarg.h for va_list type and va_* builtins.

Make an attempt to insert the include in a sensible place.  Where
style(9) was followed this is easy, where it was ignored, aim for the
first block of sys/*.h headers and don't get too fussy or try to fix
other style bugs.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Kyle Evans d0d5415881 lualoader: rename loop variable to cleanup luacheck
This shadows an `i` used for indexing earlier in the function, and we
don't care that much about the name.
2025-06-06 09:44:37 -05:00
Kyle Evans bef6d85b6d lualoader: allow graphical bits to be disabled with loader_gfx
Some people prefer the old ASCII art look and it's good to have a way
to confirm that the fallbacks still work right on systems that have a
functional framebuffer available. Add a loader_gfx loader.conf(5)
variable to disable the eager use of graphics for these use-cases.

While we're here, clean up the style in the area a little bit; the early
porting that I did to lualoader did a lot of redundant ~= nil that has
carried over into some of the later work.  We can drop some of that, and
also re-organize some of these variables to improve readability.

ziaee notes that the positioning of the orb is a bit off; this is due to
a change in positioning that happened in
1b4e117131 ("loader: Fix orb position") to account for the image
dimensions.  This should be partially reverted to get it right; we
shouldn't assume that we can use the same shift in gfx-* definitions for
both the ASCII art and the associated image -- the {image, image_rl}
pair should be converted to something more like an fbimg or gfx table
that has the image, image width and a shift override to avoid messing
up the ASCII positioning when disabled (or with no graphics available).

Reviewed by:	imp, manu, ziaee (manpages)
Differential Revision:	https://reviews.freebsd.org/D50706
2025-06-06 09:44:29 -05:00
Simon J. Gerraty 61d77e6c00 loader: allow for exceptions to restricted settings.
We restrict what an unverified loader.conf etc can set,
and the same restrictions are applied to interactive input.
We need to allow for exceptions (eg boot_verbose).
It is best if any allowed settings match up to '='.

If we do not allow it to be set, do not allow it to be unset

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
2025-06-01 22:48:43 -07:00
Simon J. Gerraty f9890204b5 install: must set netproto for tftp://
tftp_open requires netproto is NET_TFTP

Reviewed by:	stevek
2025-06-01 22:28:21 -07:00
Warner Losh 1145891d07 kboot: Create quit command
Create a command that just quits out of the loader. Useful for
debugging.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D50589
2025-05-30 09:56:51 -06:00
Warner Losh aeb446be4e style: Use static consistently
C doesn't require that we have static on both the declaration and
definition of a function. But stylistically, FreeBSD does. Make that
so. Also make a function static that wasn't because, it seems, that
static and struct look a lot alike in a column of text.

Sponsored by:		Netflix
Reviewed by:		tsoome, jhibbits
Differential Revision:	https://reviews.freebsd.org/D50588
2025-05-30 09:56:50 -06:00
Warner Losh 6aea7b224a stand: Retire arch_loadaddr using md_align, pending its replacement
arch_loadaddr() is inconsistently used. In fact, I removed it entirely
from kboot because its interface wasn't wide enough (though I broke
powerpc kboot several years ago, and this commit might fix that).  For
now, modify uboot to put it into copyin like all the other loaders
do. This might break arm ubldr.

In its place, use the new md_align() and any replacement will be called
from there, or via some explicit init() function.

These changes allow me to load a amd64 kernel via UEFI with all the
modules aligned to 16k.

Sponsored by:		Netflix
Reviewed by:		jhibbits
Differential Revision:	https://reviews.freebsd.org/D50587
2025-05-30 09:56:50 -06:00
Warner Losh 18582d3542 stand: Style nit
Sponsored by:		Netflix
Reviewed by:		chs, tsoome
Differential Revision:	https://reviews.freebsd.org/D50586
2025-05-30 09:56:50 -06:00
Warner Losh a3bdf33f3e stand: Introduce md_align
When we're loading metadata, we need to align it in a certain way. Right
now that way is hard-coded to be PAGE_SIZE. Rather than do the actual
physical thing in all these places, move this into a wrapper routine. We
may want to load a 16k kernel and align all these on 16k or a 4k kernel
and align on 4k on aarch64 (today you have to compile the loader with
the right page size). This will also reduce the number of places we
might have to touch to do that.

Sponsored by:		Netflix
Reviewed by:		tsoome, jhibbits
Differential Revision:	https://reviews.freebsd.org/D50585
2025-05-30 09:56:50 -06:00