D59889 brings up a FreeBSD/loongarch64 EFI loader, none of it in
this tree yet. Add a disabled config entry (excluded from -A, usable
via -a once the port lands) using the confirmed QEMU virt/la464
recipe; hw/loongarch/virt.c defaults to virtio-blk/net, so the
existing generic EFI+GPT builder needs no arch-specific QEMU code.
loongarch64 has never had a FreeBSD release, so
install_minimal_userland's ISO extraction can never find one. Split
it into ISO and installworld-cross-build paths, selected by a new
no_release capability, so archs without a release can still get a
minimal userland.
Differential Revision: https://reviews.freebsd.org/D59923
When we're doing admin-passhtru, we need to use the admin device, not
the namespace device. So when we're passed in ndaX or nvdX, we need to
translate that to nvmeY for this command for the admin-passthru command,
but not the io-passthru command. Note namespace nuance in man page.
Differential Revision: https://reviews.freebsd.org/D59878
Add -n/--dry-run to resolve and print the Format NVM command without
submitting it. This lets users verify namespace selection and format
parameters before making destructive media changes.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59835
Extend sector-size selection to controller-wide formats when every
namespace has one compatible format index and matching effective
metadata and protection settings. Reject ambiguous or inconsistent
layouts so heterogeneous fleets can request a sector size without
risking an unintended controller-wide format.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59834
Add automatic selection of lbaf value based on a single sector size. The
lbas (the data sector size) is selected based on the power of 2 in the
sector size, and the metadata size is selected by the remainder. If an
lbaf matches these values is used, otherwise we exit with an error.
When there's a tie, we prefer the higher performance.
Manual selection of these values remains as well for times when we
select incorrectly.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59833
When we're resetting after a controller failure, and we fix the failure,
and we've not resetting as part of initialization, notify the all the
children devices of new namespaces. When we failed the controller
before, we removed all the namespaces.
Reviewed by: seuros
Differential Revision: https://reviews.freebsd.org/D59832
When we add a namespace, we have the code inline to do the
notifications. Refactor ahead or reuse.
Reviewed by: seuros
Differential Revision: https://reviews.freebsd.org/D59831
Now that we have per-command timeouts, allow linux-compat ioctls to have
a passed-in timeout.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59829
Separate the updating the stats for the completion from the biodone for
each one.
Sponsored by: Netflix
Reviewed by: ali_mashtizadeh.com
Differential Revision: https://reviews.freebsd.org/D60157
Separate the updating the stats for the completion from the biodone for
each one.
Sponsored by: Netflix
Reviewed by: ali_mashtizadeh.com
Differential Revision: https://reviews.freebsd.org/D60156
Separate the updating the stats for the completion from the biodone for
each one.
Sponsored by: Netflix
Reviewed by: ali_mashtizadeh.com
Differential Revision: https://reviews.freebsd.org/D60155
The function updates scheduler statistics but does not complete the
bio. Rename it to avoid implying ownership of bio completion.
Sponsored by: Netflix
Reviewed by: ali_mashtizadeh.com
Differential Revision: https://reviews.freebsd.org/D60349
So if one inserts a USB drive with a GPT that doesn't match the media
size, a resize is initiated, so gpart takes g_access(cp, 1, 1, 1) on the
disk and holds it until the resize is accepted or rejected. The orphan
path releases it, but the spoil path does not. So if the drive is
ejected while the resize is in flight, we call spoil directly, without
releasing the access. Since gpt_opened is not cleared for the spoil
path, this causes several different process to hang in the open path
waiting for the leaked access.
Move the release into the wither function when gpt_opened is set, and
remove the release elsewhere. Since all paths to destroy the geom pass
through wither, this ensure that access is always released when we've
taken the access for resize.
PR: 297777
Reported by: Rick Richard
MFC After: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59138
Get the link offset using the zfs_dnode_sa_lookup helper now.
Recently, the symbolic links we rely on in the boot loader have stopped
working.
Prior to OpenZFS commit e90badec11 ("Inherit the project ID for every
object type", Matt Turner, 2026-08-14), symbolic link information was
written at a fixed offset in the SA data. Since that commit, the
inherited PROJIDs mean that all pools with quota enabled have started
writing symbolic links with a new, non-fixed offset. Old symbolic links
remained unchanged, but new ones were written with a different
offset. At work, we have all these things: rewritten BEs, quotas, and a
dependence on symbolic links in our boot path.
This came in on 2026-08-24 OpenZFS merge (22649d4dba). This was 12
hours after stab week for August, so we didn't hit this until the
September stab week. Since the new kernel has to write links at the new
offset, the initial tests worked, but the second ones didn't.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60268
Find the SA values with the zfs_dnode_sa_lookup and read out the
relevant bits for the stat buffer.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60267
zfs_dnode_sa_lookup will look in the bonus part of the dnode for the
requested SA values, and fall back to the spill as if it's not there.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60266
Compute the offset for the data for this bundle and the requested data
type.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60265
zfs_sa_load looks up all the system attribute offsets and stores them in
the mountpoint.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60264
For the dynamic system attributes, we'll need the mount argument. Adjust
zfs_dnode_readlink to take that argument.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60262
When reading dynamic system attributes, we'll need the mount argument
since we can no longer hard-code the offsets. Adjust zfs_dnode_stat to
take it.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60261
Dynamic system attribute layout can require modifications to the mount
structure on lookup. Drop the const to allow that.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D60260
Make sure that we can chainboot with gptboot.efi. Many projects use this
as their migration tool from gptboot to ping-pong partitions to boot
from. This tests that functionality which I recently broke.
Assisted-by: Claude Code (Fable 5, Opus 5)
Sponsored by: Netflix
BSDRP images are built with "poudriere image -t firmware", which puts
gptboot.efi on the ESP instead of loader.efi. gptboot.efi reads the GPT
bootme attribute, picks the active system partition (BSDRP1 or BSDRP2),
chainloads /boot/loader.efi from it and hands loader.efi that partition
in LoadedImage->DeviceHandle (stand/efi/boot1/boot1.c:try_boot).
Since ce9bfd7816 ("loader.efi: Refactor try_boot_device_partitions"),
find_currdev() no longer tries that device: try_boot_device_partitions()
walks the parent disk while explicitly skipping dp->pd_handle, on the
assumption that the boot image always comes from an ESP holding no root
filesystem. When chainloaded, the partition gptboot.efi selected is
therefore the one partition never considered, and loader.efi falls
through to the first other UFS partition on the disk - the previous
system. Every A/B upgrade silently boots the old slice.
Commit 1c85c5eea0, which introduced try_boot_device_partitions(), did
try dp itself before its siblings; the refactor dropped it. Restore it,
keeping the sibling walk as the fallback for the normal ESP case.
Fixes: ce9bfd7816
Assisted-by: Claude Code (Fable 5, Opus 5)
Sponsored by: Netflix
Add the built-in python http server, bound to each of the interaces we
create to expand network testing to include http:// in various
scenarios.
Sponsored by: Netflix
Since the PixieFail security fixes (CVE-2023-45237), EDK II's DxeNetLib --
underneath essentially all of NetworkPkg (Mnp/Arp/Ip4/Dhcp4/Tcp/Http) --
carries a DEPEX on EFI_RNG_PROTOCOL. With no RNG protocol producer
available, that DEPEX is never satisfied and the entire NetworkPkg driver
stack silently fails to load: no error, no assert, it just isn't there.
netboot-efi and netboot-ramdisk never noticed because they only ever touch
the raw EFI_SIMPLE_NETWORK_PROTOCOL via our own net.c, which has no such
dependency. A test that needs EDK II's own NetworkPkg (e.g. one exercising
EFI_HTTP_PROTOCOL) is the first to be affected.
RngDxe can satisfy the DEPEX from the RDRAND instruction alone on a
sufficiently recent edk2 build, but not every installed OVMF is that
recent. -device virtio-rng-pci provides an RNG unconditionally via
VirtioRngDxe, regardless of edk2 vintage or host CPU features.
Unfortunately, the edk2 shipped with qemu lacks the network this needs.
Sponsored by: Netflix
These aren't referenced in the tree anymore, so remove them from
here. This doesn't chanage src.conf.5, so I didn't commit that file.
Sponsored by: Netflix
When we're searching for the EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID (GOPs) to
use, skip any whose Mode or Mode->Info pointers are NULL. The spec
requires these to be non-null, however, some firmwares seem to fail to
populate the Info when, for example, a monitor is not present. Work
around these bugs by skipping any GOPs with bad pointers.
PR: 288900
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59830
For the images we read into the memory, use EfiLoaderData memory type
instead of EfiReservedMemoryType. The kernel handles the former properly
and won't reallocate it. While the latter isn't necessarily mapped,
which can cause ram disks to fault when loaded. memdisk_uefi.efi
used the latter type, but also registered the device as an ACPI
RAM disk, which we don't do.
Fixes: afee781523
Sponsored by: Netflix
The only possible time we could download the initmd that the dhcp server
told us about is if we're netbooting. So only attempt to do that if the
load device for loader.efi is a network. IF you are booting off disk and
then need to snag an initmd off the network, that's a different path,
and wouldn't need to necessarily do a dhcp exchange, except to get the
IP address.
Sponsored by: Netflix
It's really discovery_status_str(). Rename it and use open_memstream()
to write the string so we don't have to play as many str* games.
Fixes: afb60897a1
Noticed by: claude + Sonet 5 (size error, bad fix ignored)
Sponsored by: Netflix
Turn an assert into a bounds check to not overflow if the nvme drive
reports too many power states (we validate the user input, but not the
drive's identify data).
Use a uint32_t instead of int for entry so right shift we do is defined.
No functional changes.
Fixes: 35793364d7
Noticed by: claude + Sonet 5
Sponsored by: Netflix
Since we don't have THP in FreeBSD, return that it's disabled. Linux
applications use this to get around the weird latency spikes THP in
Linux creates. Since FreeBSD superpages don't suffer from this issue,
just say it's disabled.
This removes the noisiest noise from the linux claude running on
FreeBSD.
Sponsored by: Netflix
pkgbase splits programs and their tests into separate packages (e.g.
unifdef/yacc/indent/file2c -> toolchain, jail -> jail, etc), while their
tests always land in the generic tests package. Installing just the
tests package therefore leaves these suites unable to find the binary
they exercise, and they fail confusingly instead of skipping.
Rather than force all packages to be installed for the tests package,
make the tests cope with the missing packages. Add require.progs (or,
for TAP/PLAIN-style suites with no atf_set hook: TEST_METADATA
required_programs) for the binary under test in: bectl, certctl,
ctfconvert, dhclient, file2c, indent, ipfw, jail, lastcomm, mixer,
newsyslog, nvmecontrol, pfctl, praudit, sa, syslogd, tunefs, unifdef,
yacc, ztest.
I skipped adding data for all the binaries in the base runtime
package for simplicity.
Assisted-by: Claude Code (Sonnet 5)
Sponsored by: Netflix
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D58262
echo is a shell builtin, and always present. While ls usually works,
some upgrade scenarios need to have ls be a build to to work
correctly. Rather than add it as a build tool, use echo instead which is
always safe because sh is a build tool.
Sponsored by: Netflix
cam::periph:error, cam::{,a,n,sd}da:error
Trace the error evolution for I/O errors the periph encounters
cam::periph:recovery, cam::{,a,n,sd}da:recovery
Trace the result of the error sorting
cam::periph:invalidate
Trace device invalidations
cam::periph:hold-boot
cam::periph:release-boot
cam::xpt:hold-boot
cam::xpt:release-boot
Trace boot holds and releases at different levels
cam::xpt:bus-register
Trace new busses added
These additions allow fairly complete instrumentation of the discovery
process at boot through dtrace's anonymous tracing. It would be mildly
better to have the boot holds have the periph, but dtrace sbts have to
be static at compile time.
Sponsored by: Netflix
Reviewed by: dteske
Differential Revision: https://reviews.freebsd.org/D58523
Prints the current discovry tables for the driver.
Sponsored by: Netflix
Assisted by: Claude (sonet-5)
Differential Revision: https://reviews.freebsd.org/D58528
Report serial number, if available, otherwise report the path of the
device invalidated.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58527
Apply de-morgan's law correctly to force only 4/2 to go to the
invalidate stage for that ASC/ASCQ.
Fixes: d78d04b17c
Sponsored by: Netflix
MFC After: 1 week
Reviewed by: ali_mashtizadeh.com, mav
Differential Revision: https://reviews.freebsd.org/D58525
When READ CAPACITY fails, we call cam_periph_invalidate() for some
hopeless ASC/ASCQ combinations and then fall through to test the cache
state. This results in excess commands to the abandoned device that may
take a while to timeout and/or report confusing errors. Instead, call
daprobedone() when the periph is invalid to terminate the probe.
Fixes: d78d04b17c
Sponsored by: Netflix
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D58524
When we can't find root, we give the user a chance to drop to the boot
loader OK prompt. We should eat the character that's pressed to not
interfere with the interactive session.
Sponsored by: Netflix
When we haven't downloaded an image via mem{disk,cd} and ipxe, try any
image specified by the FreeBSD-specific initmd dhcp option. This allows
direct booting of loader.efi with a detached root ramdisk filesystem.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59433
Configure net0, read the DHCP-provided initmd URL, and download it
through the file API so directly booted loader.efi can construct its
root memory disk.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59432
Feed the existing decompressor from loader file descriptors as well as
iPXE callbacks, allowing arbitrary HTTP filesystem URLs to become
kernel-exportable memory disks.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59431
Close the exclusively opened SNP protocol after loader networking
finishes so the firmware network stack can reconnect the controller and
service a subsequent HTTP request.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59430
Allow callers to obtain DHCP configuration without opening a network
file, enabling loader.efi to discover an initmd URL before handing the
interface back to firmware HTTP.
Differential Revision: https://reviews.freebsd.org/D59429
Sponsored by: Netflix
Request FreeBSD RFC 3925 PEM 2238 DHCP 125 option. Use suboption 1 to
specify a ramdisk image to load and use to load the kernel and as the
root file system.
Differential Revision: https://reviews.freebsd.org/D59428
Sponsored by: Netflix
Until now, the "http" device only worked when firmware itself booted
loader.efi via EFI HTTP Boot: efihttp_dev_init() required a URI node on
the loader's own boot device path, and every fetch went to that same
server. Add a second form, using the parse_uri() helper from libsa/dev.c,
that works anywhere: http[N]://host[:port]/path (N is a network interface
unit, defaulting to 0). This lets a devspec like this be used as rootdev,
in loader.conf, or interactively, independent of how loader.efi itself
was booted.
Network configuration is shared, loader-wide state (the myip/netmask/
gateip/nameip globals from net.h): if something has already configured
them (e.g. tftp/nfs via net_open()), the http device just reuses those
values, applying them to EFI_IP4_CONFIG2_PROTOCOL as a static address. If
nothing has, it drives IP4Config2's own DHCP directly instead of calling
netdev's net_open(): net_open() opens the NIC's SNP
EFI_OPEN_PROTOCOL_EXCLUSIVE, which would disconnect the Mnp/Ip4/.../
HttpDxe driver chain this code depends on. That chain is also commonly
disconnected already by whatever chained us here (e.g. iPXE excludes and
exclusively opens SNP for its own raw I/O), so reconnect it explicitly
with ConnectController() before giving up.
The legacy EFI HTTP Boot path is untouched.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59423
Add parse_uri(), a helper for devices whose devspec can take a
"[N]://host[:port][/path]" form in addition to the traditional "N:path"
form. It returns EINVAL when devspec doesn't match that pattern, so a
caller's own dv_parsedev can fall back to the traditional form.
Un-static default_parsedev() so it can serve as that fallback.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59422
Some UEFI firmwares do not contain the RamDisk protocol. When this
happens, load the file into a md disk instead. This is less desireable
than the RamDisk (since that allows better chain-booting options), but
sufficient to boot an image as a md device for FreeBSD. While most
severs have the RamDisk protocol enabled in their builds, I have two
IoT class boards from different manufacturers that do not. Since it
works just fine with this fallback, that's preferable.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59421
When someone has loaded a ram disk, that's a stronger hint about what to
boot than the UEFI boot manager. Prefer it and rework a little the #ifdefs
to reduce their number.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59419
Augment the md device to allow creation of md devices. This is useful
when UEFI doesn't support RamDisk and in other cases where we have a
handy initrd-like image we want to use.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59418
Only the EFI loader supports the md devices (as the moment). Create
LOADER_MD_SUPPORT and only try to compile md when that's true. For the
moment, also allow it when only MD_IMAGE_SIZE is defined, but that
will be dropped since LOADER_MD_SUPPORT is a superset.
Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D59416
This reverts commit 45645518ea.
Although this changed looks like it should just be a harmless change to
bookkeeping, it turns out that it changes the termination condition of
the initial device scan, resulting in it never finishing. This causes
the boot to hang forever coming up. Since I don't have good access to
hardware, I'm reverting until the exact details can be sorted out.
Reported by: Edward Scroop
Sponsored by: Netflix
MFC After: 1 week
Different command sets have different encoding for op codes, etc. While
one can normally puzzle out which is which, it's better to explicitly
tag the command set used.
Sponsored by: Netflix
These were overlooked when I added compression support.
Fixes: 86d719ae68 ("loader: Add xzfs, like gzipfs but with xz.")
Fixes: c61ee49cd0 ("loader: zstd based filesystem, zstdfs like gzipfs")
Sponsored by: Netflix
This is a script that eventually will test boot with qemu all the
supproted combinations for the boot loader. There's several things that
could be done with gptboot or boot0sio (or not) that aren't tested. We
don't test the 10-odd hardware root devices we support, nor do we test
complex scenarios like RELAXED vs STRICT zfs efi booting.
However, the scenarios we do support are included here. We test aarch64,
amd64, armv7, powerpc64, powerpc64le, and riscv64 for BIOS, UEFI, and
Prep and OpenFirmware (as appropriate) crossed with CDROM, MBR and GPT
(and some hybrid) crossed with lua, 4th and simple loaders. Plus some
linuxboot and memdisk scenarios, including the recently added
compression for ram disk scenarios:
=== Results: 67 passed, 3 failed, 9 timed out (of 79) ===
The timeouts are well understood, usually failure to find the root
disk. The failures are bad console assumptions. netboot-bios fails
because TFTP with a single packet buffer in qemu gives horrible
throughput, so the test takes 18-20 minutes. Now that I have a
dashboard, I can fix the rest one by one.
There's also a powerpc architecture that you can request specifically,
but it's just for convenience and tests with the non-functional mac99
qemu machine. I will eventually eliminate this architecture. I added it
to make sure the FreeBSD version wasn't too hard coded since this
framework pulls from CD images to get the binaries for the minimal root
used in testing and there's no 15.x 32-bit powerpc images.
We need to add http and nfs root booting tests, but that's for the
future. Plus there's some other functional tests that we should also add
for different types of root (usb, sata, sas, nvme, ufs, emmc, sd, etc)
that would be useful to test, especailly the non-sata/non-nvme ones.
How we do that is still TBD.
I leaned on claude to iterate over the recipes that I've developed over
the years, collected off the internet or got on IRC recently to produce
this framework. Most of this code is fairly good, while a few parts,
especailly some of the comments, are detectable as AI produced. My plans
are to iteratively improve those. Since this is just a test, and since
I've broken many scenarios w/o realizing, it's a good tradeoff. I've not
made it an ATF test since we test all the architectures, but I'm open to
feedback in this area.
Total time to test all the architectures is about 10 minutes. It assumes
you've built GENERIC* and the boot loader for all the architectures too.
In the future, I plan on moving to MINIMAL for all the boot testing, but
likely only after PCI devmatch is integrated into it. That would be
incrementally faster test times.
The man page is decent, but was also generated by Claude with only
trivial edits by me to date.... But at least there's a man page for it,
though neither it nor the script is installed onto the system.
Sponsored by: Netflix
Assisted-by: Claude Code (Opus 4.6, Opus 4.8(1M) and Sonet 5.0)
Differential Revision: https://reviews.freebsd.org/D58008
For the BIOS, add xzfs support. This is a tiny increase in the loader
size, but allows us to fetch compressed files from any of the
filesystems we support, including over the network.
For EFI, also add gzipfs and bzip2fs support we well. The increment for
these files is tiny.
Sponsored by: Netflix
We can now decompress .xz compressed memory disks, like
FreeBSD-15.1-RELEASE-amd64-disc1.iso.xz
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58073
-I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz isn't used, and
.PATH: ${SRCTOP}/sys/contrib/xz-embedded/freebsd isn't used either.
Remove them both to simplify things a little.
Sponsored by: Netflix
kldxref -m <file> will print the same data that the '-d' flag produces,
except restrict the output to one file. This should be the full path to
the file, and the directory name to process is omitted.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D57902
We have two sets of BIOS loaders: One that lives in stand/i386 and one
that lives in stand/userboot. Add knows to turn these on/off, with the
default being on. These often aren't needed when creating a minimal UEFI
system, so add knobs to turn them off. Given light-weight VMs have
created a new use cases for these loaders, there's no plans at all to
eliminate them.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58072
This reverts commit 3e3fd1fde8.
This appears to break chainbooting with boot1.efi and similar scenarios
with Root-on-ZFS scenarios. Revert until it's better understood.
PR: 296309
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58071
This code is simpler when we spell it the Unix way. Also, add sanity
checks to make sure the offset is where we think it is.
Fixes: afee781523 ("loader.efi: Recognize new memdisk=<url> and memcd=<url> options")
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58070
The end address is the final byte in the array, not one byte past the
end of the array, so we need to add 1 to get the full length.
Fixes: 59219fc76a ("loader.efi: efiblk_memdisk_preload passes the VirtualDisks to FreeBSD")
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58069
The download protocol calls download_data with FileOffset and
BufferLength of 0 first to start the download (no data yet
available). Calls it again with BufferLength == 0 and FileOffset the
size of the download (again, no data). It then starts calling with
BufferLength != 0 and FileOffset == 0 to start the download. The
heuristic I used to detect the start was wrong, so we'd allocate the
buffer twice. Fix that by being more explicit and not using the
heuristic that was bogus.
Fixes: afee781523 ("loader.efi: Recognize new memdisk=<url> and memcd=<url> options")
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58068
Sicne we have gcc15 in Jenkins, and since people are actually using it,
add cross building tests to universe.sh to avoid build breakage when
hacking on loader.efi (and others). UEFI makes it too easy to mix
pointers and integers since it deals in an odd mix of
EFI_PHYSICAL_ADDRESS and pointers...
Sponsored by: Netflix
Use (uintptr_t) casts to cast the EFI_PHYSICAL_ADDDRESS to a pointer.
Fixes: afee781523 ("loader.efi: Recognize new memdisk=<url> and memcd=<url> options")
Sponsored by: Netflix
Reviewed by: rlibby
Differential Revision: https://reviews.freebsd.org/D57893
We have a ltitle wiggle room, so go ahead and bump the pxeldr size.
It should be a little larger than the limit we have for the /boot/loader
since we embed that in this loader...
Sponsored by: Netflix
Support ipxe downloading of a memory disk (either presented to the OS as
a harddisk or a cd). This requires an ipxe server since it uses the ipxe
download protocol to grab the disk. If there is a disk, we add it to the
environment as a disk, and then the rest of the bootloader just sees it
and boots from it.
I've cribbed code from https://github.com/russor/memdisk_uefi and
adapted it to work in the context of the FreeBSD bootloader.
The ipxe_download.h file was created from the documentation of the
interface.
So a .ipxe file with the line
chain http://10.2.0.1/loader.efi memdisk=${cwduri}FreeBSD-15.1-RELEASE-amd64-bootonly.iso
would use the FreeBSD boot loader to boot the FreeBSD 15.1 release.
md(9) has a bug at the moment that prevents it from probing the
partitions on it.
Also, we'll automatically decompress gzip, bzip2 and zstd files
automatically.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D57677
Set hint.md.%d.physaddr and hint.md.%d.len for each of the VirtualDisks.
The memory for these remains after we exit boot services so FreeBSD can
use them. This leverages the BIOS work we did for memdisks. In
hindsight, I should have passed this in via metadata, but it's been in a
release.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D57806
When we're searching the system for all the disks in relaxed mode, we
need to do a final pass over all the non-boot disks. We no longer need
to have two loops since ZFS on boot device is selected properly in
try_boot_device_partitions. This also simplifies the code a bit.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D57805
uefi_rootdev had to be the exact device to work. This is often difficult
to arrange and awkward. Instead, have it search the specified device: As
a partition if it specifies the partition, and as the whole disk if the
specified partition didn't work or it specifies a disk. This brings it
into lone what we do with other devices. This overrides the boot manager
search we do before we do this for the boot device, but this knob has
always been meant to overload the boot manager search.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D57803