aboutsummaryrefslogtreecommitdiff
path: root/stand/efi
Commit message (Collapse)AuthorAgeFilesLines
* loader.efi: Defer efi_translate(e_entry) until after bi_loadJessica Clarke2026-04-303-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bi_load itself loads various things into the staging area which can cause it to grow, which may result in the staging area moving, including the kernel. Therefore the address we get for the kernel entry point prior to bi_load may not be correct afterwards when we actually call it, and so we must defer the translation. On arm and riscv (but not arm64, which predates both of them in loader.efi and did not gain a copy of arm's added printf when arm support was added) we also printf this entry point to the console, which we can no longer do since bi_load calls ExitBootServices, so remove this printf that, in practice, seems to not be so useful, given nobody ever felt the need to add it to arm64. If anyone really feels this is an important printf to have then bi_load will need to be split so we can call printf after all the loading and potential reallocation of the staging area, but before ExitBootServices is called. We may also want to make this code more uniform and shared between the three architectures here, since there isn't much architecture-specific about this (and something like the RISC-V boot hart protocol could easily be made an MD hook). Reviewed by: imp Fixes: 0cafabf97fae ("Add support for arm64 to loader.efi and boot1.efi") Fixes: ea7796a9ae6b ("EFI: don't call printf after ExitBootServices, since it uses Boot Services") Fixes: 2192efc03bc4 ("RISC-V boot1.efi and loader.efi support") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56431 (cherry picked from commit ab1d659e78e454995b7c2b4566e035269b215e48)
* loader.efi.8/efibootmgr.8: Don't use contradicting term 'EFI BIOS'Michael Osipov2026-04-141-2/+2
| | | | | | | | | | | Both (U)EFI and BIOS are completely different things, be precise and don't use them together. Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D56329 (cherry picked from commit 4f684e929de1275b1099b17b2a2cff0d3f4af223)
* loader: Prefer comma-separated list of values for "console"Michael Osipov2026-02-051-2/+2
| | | | | | | | | PR: 292595 Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54923 (cherry picked from commit 56970c3c4b0bc61d972837661a31cc2b9e8e8d7c)
* loader.efi: add stride & offset for MacBookPro3,1Frank Hilgendorf2026-01-121-0/+17
| | | | | | | | | | Note that there are three variants of this MacBook. We only have the stride and offset values for the 17" 1680x1050 model. Reviewed by: vexeduxr Pull Request: https://github.com/freebsd/freebsd-src/pull/1584 (cherry picked from commit be6ba97aaee762c2e5300834f1916ae5dfd5a0b9)
* loader.efi: probe for UGA if GOP isn't foundAhmad Khalifa2026-01-121-35/+37
| | | | | | | | | | | Probe for UGA instead of returning early if we can't find GOP. Reviewed by: tsoome PR: 291935 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54431 (cherry picked from commit 5d85dde27b4769604fc108b89328607e70e767ed)
* Bump lld LINKER_FREEBSD_VERSION for reproducibility fixDimitry Andric2024-10-081-1/+8
| | | | | | | | | | The upstream fix to make lld output for our EFI loaders reproducible again was committed in 54521a2ff93a. Bump lld's LINKER_FREEBSD_VERSION to be able to check this in the EFI loader Makefile. MFC after: 3 days (cherry picked from commit f97c7fdc59d252cc8611968ffac541d4b8342b8b)
* stand: bump arbitrary build date to 2024-01-01Ed Maste2024-09-091-2/+2
| | | | | | | | | | | | | | For build reproducibility we set PE headers to an arbitrary timestamp. Nothing in FreeBSD uses this timestamp, but bump it from 2016 to 2024 so that the timestamp does not seem "too old" in case some third party tool is used to inspect EFI boot components. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46527 (cherry picked from commit 1b9cfd6a625dc82611846cb9a53c1886f7af3758) (cherry picked from commit 14a2be2b3db17cbd86a584d5a3378baa7e966bd0)
* Fix EFI loader reproducibility with lldDimitry Andric2024-08-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | When the various loaders under stand/efi are built, the resulting binaries differ over multiple runs, even if WITH_REPRODUCIBLE_BUILD is used. This is caused by lld multithreading and the custom linker scripts for the loaders, and affects the following binaries: * loader_4th.efi * loader_4th.sym * loader_4th.sym.full * loader_lua.efi * loader_lua.sym * loader_lua.sym.full * loader_simp.efi * loader_simp.sym * loader_simp.sym.full Work around this by disabling lld threading for these binaries. Reviewed by: emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D46271 (cherry picked from commit f5ce3f4ef562ea9fc4d8f9c13c268f48a5bacba7)
* loader: Bump all versions to 3.0Warner Losh2024-08-011-0/+1
| | | | | | | | | | | | | | | | | Each incompatible change we make, we bump the major version. We've not done the bump in a while, so sync everybody to 3.0. Anything older than 3.0 will be given a warning that their boot loader is too old. We check only the major version, though, so minor versions can still be bumped for individual loaders (though I honestly doubt we'll ever need to do that again). MFC Note: veriexec version not update as not in 13 Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D45888 (cherry picked from commit 9f7f90507528aaa9a2f54575c1d4f4010d01c2e5)
* stand: Remove obsolete junkWarner Losh2024-08-011-4/+0
| | | | | | | | | | | | | | We long ago changed newvers.sh to make these comments bogus. Remove them since every single one of them is broken after the $FreeBSD$ removal. MFC Note: veriexec loader not updates since not in 13 Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D45879 (cherry picked from commit 8165650389ba2d0a68cea6902ac3750055cad9da)
* stand/efi: Fix for binutils when targeting arm64Andrew Turner2024-07-151-1/+1
| | | | | | | | | | | | | | | | | When linking with ld.bfd it complain with the following: /usr/local/bin/aarch64-unknown-freebsd14.0-ld: start.o: relocation R_AARCH64_ABS32 against `__data_size' can not be used when making a shared object Fix this by marking the __data_size with ABSOLUTE. This returns a non-relocatable value which appears to be the same behaviour of lld. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45257 (cherry picked from commit 9f44638ef2c46861565b89bb01bbeeab17755649)
* loader: For EFI, if we don't have ConOut, try ConInWarner Losh2024-02-071-1/+6
| | | | | | | | | | | | | | | | | Try ConIn if we don't have a ConOut variable. ConIn will contain HID devices and/or serial devices. We currently just search for serial devices and will use them instead of video with the current code. While ConIn w/o ConOut is fairly common on laptops, is kinda rare on servers. Some refinement may be needed in the future if servers come to light. This is also minimal to allow possible integration into 13.3 release. MFC After: 1 week Sponsored by: Netflix Reviewed by: dab, tsoome Differential Revision: https://reviews.freebsd.org/D43714 (cherry picked from commit 064fa628ce375028f2510182f4edbafa7f469ecb)
* stand: Add 1440p to the list of known resolutions.Dag-Erling Smørgrav2024-02-011-0/+5
| | | | | | | | MFC after: 1 week Reviewed by: manu, kevans, imp Differential Revision: https://reviews.freebsd.org/D43391 (cherry picked from commit 7edbf69b79c13debff251e6edfee1f57eeac3a6b)
* Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit 05248206f720)
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit fa9896e082a1)
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-2319-19/+0
| | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/ Similar commit in main: (cherry picked from commit d0b2dbfa0ecf)
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-2338-76/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in main: (cherry picked from commit 1d386b48a555)
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-2347-47/+0
| | | | | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/ Similar commit in main: (cherry picked from commit 2a63c3be1582)
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/ Similar commit in main: (cherry picked from commit 42b388439bd3)
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-2320-40/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit b3e7694832e8)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-252-2/+2
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* bug: efi_print_global only checks for the first 5 letters of "Driver"Alfonso Gregory2023-07-111-1/+1
| | | | | | | | | As a result, it is only really checking for the word Drive, making "Drive" appended to anything else considered for efi env. Reviewed by: imp, kevans (cherry picked from commit 39ae24e3bf1c8e7d053d0249a6bc88f65eff6de1)
* loader.efi: Fix some arm64 PE metadataMark Johnston2023-05-292-22/+29
| | | | | | | | | | | | | | | | - Mark the file as an executable in the COFF header. - Provide separate .text and .data sections. - Provide sane file and section alignment values. These values are the defaults defined in the PE specification. - Set appropriate characteristics for each of .text and .data. This is required for the MS devkit to load our UEFI image. Obtained from: OpenBSD via allanjude MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D37765 (cherry picked from commit 21d56b796634bda628b149c717461bf88c23677d)
* loader: always install help filesMitchell Horne2023-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address two issues with current help file logic: The existing condition prevents the common help file from being installed when there are no additional help files defined. This results in no loader.help on EFI platforms, for example. Second, due to the fact that we build and install multiple loader types, each successive install will clobber the previous loader.help. The result is that we could lose type-specific commands, or possibly list them in loaders that do not have such commands. Instead, give each loader type a uniquely named help file. The EFI loader will look for /boot/loader.help.efi, userboot will look for /boot/loader.help.userboot, etc. The interpreter variant has no effect on which help file is loaded. This leaves the old /boot/loader.help unused. Some credit for the final approach goes to Mathieu <sigsys@gmail.com> for their version of the fix in https://reviews.freebsd.org/D22951. PR: 267134 Reported by: Daniel O'Connor <darius@dons.net.au> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28591 (cherry picked from commit 8859960436f5727f163a7b3468e08710c5e6d874)
* efiserialio: use port settings (sio->Mode) for initial setupToomas Soome2023-02-101-16/+22
| | | | | | | | | | | | Use serial port setup done by system firmware. ARM64 Hyper-V does hung if we attempt to override the defaults, therefore we should default to use settings from firmware. Tested by: schakrabarti@microsoft.com PR: 266248 MFC after: 1 week (cherry picked from commit c243de11cf7c4bb3d67bbc1655b149037e5b04f1)
* stand: create common set_currdevWarner Losh2023-01-241-14/+0
| | | | | | | | | | | | | | Pull together the nearly identical copies of set_currdev in i386, userboot and efi. Other boot loaders have variances that might be fine to use the common routine, or not. Since they are harder to test for me, and ofw and uboot do handle these setting differently, leave them be for now. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38005 (cherry picked from commit ad70f2e22ef29f94bf5208b3a9a2389575330b06)
* stand: Create common gen_setcurrdev and replace codeWarner Losh2023-01-243-21/+2
| | | | | | | | | | | | Replace 4 identical copies of *_setcurrdev with gen_setcurrdev to avoid having to create a 5th copy. uboot_setcurrdev is actually different and needs to remain separate (even though it's quite similar). Sponsored by: Netflix Reviewed by: fuz@fuz.su, kevans Differential Revision: https://reviews.freebsd.org/D38003 (cherry picked from commit 1c1783d66bc81ebd0c1304b1f613a9403c073915)
* stand/efi: Better variable nameWarner Losh2023-01-241-4/+4
| | | | | | | | | | sanity_check_currdev returns true if it found a kernel or a sane loader config file. A better name for this would be 'bootable' rather than 'rv' which connotes in other places an errno value or similar. Sponsored by: Netflix (cherry picked from commit 23ed2a38c200c93414de20d20f7508f621acecd1)
* stand/zfs: Add a third argument to zfs_probe_dev: part_tooWarner Losh2023-01-241-1/+1
| | | | | | | | | | | Pass in 'true' if you'd like to search this device's partitions or 'false' if you should just search the device. EFI and (in the future) kboot have discrete partitions that aren't accessed via the full disk device. Weird things happen if you try to search in these cases. Sponsored by: Netflix (cherry picked from commit 71bbe6fb709dcfbe36877fa53c928e2e6d881843)
* stand/efi: remove unused local varaiblesWarner Losh2023-01-241-2/+1
| | | | | | | | Remove some unused local variables. No functional change. Sponsored by: Netflix (cherry picked from commit 667419d55313619807b07b1bff1b206fb5d9edbb)
* kboot: Mark the EFI specific parts of bootinfo.cWarner Losh2023-01-241-0/+16
| | | | | | | | | | | bootinfo.c is about to be shared with kboot since they create substantially similar environments / metadata tagging / etc. Tag this with #ifdef EFI for the moment until the proper abstracting out can happen. Sponsored by: Netflix (cherry picked from commit b11aebff4d4a301bfeac516b5be45080c8a11142)
* stand: update prototypes for md_load and md_load64Warner Losh2023-01-241-1/+0
| | | | | | | | | | | | | These are declared as extern in a number of files (some with the wrong return type). Centralize this in modinfo.h and remove a few extra stray declarations as well that are no longer used. No functional change. Note: I've not tried to cope with the bi_load() functions which are the same logical thing. These will be handled separately. Sponsored by: Netflix (cherry picked from commit 335615c4cad79765b46048bfa782120fd9cadb95)
* stand/efi: Break stlye rules a little for easier sharingWarner Losh2023-01-241-2/+3
| | | | | | | | | Break the style rules a little to allow easier sharing between efi and kboot. This will allow the ifdefs to be fewer in number. Sponsored by: Netflix (cherry picked from commit aed1e5d332f9d26cdd8477bc336279217d53ecb8)
* stand/efi: Better include order for sharingWarner Losh2023-01-241-1/+1
| | | | | | | | | | Have a better include order so this can more easily be shared between EFI and kboot. Fewer ifdefs and the same (enough) include order as before. Sponsored by: Netflix (cherry picked from commit 3f2c1eb5b84317bae98420c1346304b604436727)
* stand/efi: Remove redundant parenthesisWarner Losh2023-01-241-1/+1
| | | | | | | | Style: Remove redundant parens. Sponsored by: Netflix (cherry picked from commit 3df86732afed7cea51934d613f8aa43b87787cc1)
* stand/efi: Document the copy size trickWarner Losh2023-01-241-1/+1
| | | | | | | | | We call bi_copymodules twice: once with 0 and once with the size of the arena. We do this to find the size, it turns out. Document this. Sponsored by: Netflix (cherry picked from commit 67e39a0d1bdb24967591721bf7c995d61e0e1c2d)
* stand: create devinitWarner Losh2023-01-241-3/+1
| | | | | | | | | | devinit() marches through all the devices, calling the inint routines if any exist. Replace all the identical copies of this code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37349 (cherry picked from commit 66012c8fc4f92b80a61405dc7e206617e9f08920)
* stand/efi: Move to using common devparse()Warner Losh2023-01-241-102/+3
| | | | | | | | | | We no longer need to have to hand-code this for each boot loader since devparse() handles them all with dv_parsedev(). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37340 (cherry picked from commit 77378d79f165b59296a0133eb910af55c8b2b600)
* stand: For all disk drivers, connect dv_parsedev to disk_parsedevWarner Losh2023-01-241-0/+1
| | | | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37339 (cherry picked from commit 8337ab69ba8e065e5cfde8f09859ec1d0d47e892)
* stand: Change zfs_parsedev() APIWarner Losh2023-01-241-5/+1
| | | | | | | | | | | | | Change the first argument to zfs_parsedev() to be a pointer to a struct devdesc *. This now gets filled in with a malloc'd structure that's returned to the caller that the caller is repsonsible for freeing. Most nplaces in the tree passed in a malloc'd pointer anyway, and this moves knowledge of zfs_devdesc more firmly into the zfs.c code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37336 (cherry picked from commit ba11bc368e612e7c5bbc195830a280f8af73ce18)
* stand: Change disk_parsedev() APIWarner Losh2023-01-241-5/+1
| | | | | | | | | | | | | Change the first argument to disk_parsedev() to be a pointer to a struct devdesc *. This now gets filled in with a malloc'd structure that's returned to the caller that the caller is repsonsible for freeing. Most places in the tree passed in a malloc'd pointer anyway, and this moves knowledge of disk_devdesc more firmly into the disk.[ch] code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37335 (cherry picked from commit 17276525fa1a28028f7ca423f365d5081cbe9a97)
* stand/efi: Simpler constructWarner Losh2023-01-241-7/+1
| | | | | | | | | Use 'sizeof(long) == 8' for a compile time constant that can be used as an initializer rather than #ifdefs. Sponsored by: Netflix (cherry picked from commit eca818c872f7ad094f8dac143123e7e8d65f3bcc)
* stand: collapse all copies of *copyenv into md_copyenvWarner Losh2023-01-241-40/+1
| | | | | | | | | | Use the efi's bi_copyenv to md_copyenv and place it in modinfo.c. Remove all other nearly identical and efi's has the best error handling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36574 (cherry picked from commit fc352701ff3aeb0af22c0da17c4194cf1f8ad5d0)
* stand: Move md_copymodules into modinfo.c and reduce copiesWarner Losh2023-01-241-37/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | md_copymodules, bi_copymdoules, bi_copymodules32 (x2) and bi_copymodules64 (x2) are all the same routine... Replace them all with md_copymodules. This saves about 800 bytes on i386 BIOS loader, which is a nice bonus. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36572 (cherry picked from commit 5d1531d9d4e7d1b1b706ab23ac3f864416e87522) stand: fix mismerge Remove stray line from mismerge of 5d1531d9d4e7. This is no longer needed. Fixes: 5d1531d9d4e7 Sponsored by: Netflix (cherry picked from commit dd2b9c2967767b19bcbc33de0e487405c612f59f) stand/efi: Call md_copymodules based on __LP64__ to fix 32-bit arm When I refactored everything, I neglected to pass in the proper is64 value on 32-bit platforms. This corrects that. This prevented armv7 and armv6 platforms from booting due to misaligned data in the kernel. The only platform we support 32-bit booting in armv[67], which I apparently neglected to test before commiting my refactoring. Tested by: skibo Fixes: 5d1531d9d4e7d Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37095 (cherry picked from commit e0c3f66b4d5f0282e9c7c4803c4cd26b5a388a38)
* stand: Create common/modinfo.hWarner Losh2023-01-241-60/+6
| | | | | | | | | | | | Move all the MOD_xxx macros to this header. Each user of this interface is currently required to define MOD_ALIGNMENT(l). modinfo was selected because it sits inbetween modules and metadata and will make it easier to migrate to new, shared intefaces. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36571 (cherry picked from commit bca9c87b6104219af35ae5ea4a6af098a1631bca)
* stand: Create MOD_ALIGN macro and use it everywhereWarner Losh2023-01-241-4/+5
| | | | | | | | | | To further reduce the differences between the different MOD_xxx macros, use MOD_ALIGN to do the proper alignment for the given use. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36570 (cherry picked from commit 8b19d28d68a396b0263e3c13a559a31f70eb3b1d)
* stand/efi: Clean the proper filesGuido van Rooij2023-01-241-1/+1
| | | | | | | | Need to clean the specific loader we build, not the generic loader.efi Reviewed by: imp (cherry picked from commit 0f97a0d425cf0c7fa3966e64b4f88e67a2ee2982)
* stand: More sensible defaults when ConOut is missingWarner Losh2023-01-244-2/+37
| | | | | | | | | | | | | | | | | | | When ConOut is missing, we used to default to serial. Except we did it in the worst way possible by just setting the howto bits and not updating the console setting, which lead to weird behavior where we'd get some things on the video port, others on serial. Instead, set console to "efi,comconsole" for this case. Also set RB_MULTIPLE always (so we get dual consoles from the kernel) and or in RB_SERIAL when we can't find GOPs that suggest the precense of a video console. This will put output in the most places and have a sensible default for 'primary' console. Sponsored by: Netflix Reviewed by: emaste, manu Differential Revision: https://reviews.freebsd.org/D36299 (cherry picked from commit df065f699f1ff819bb9607c44a6754275ab335ed)
* stand: Use bool for stage_offset_setWarner Losh2023-01-241-4/+4
| | | | | | | | stage_offset_set is a boolean, convert it to a bool. Sponsored by: Netflix (cherry picked from commit 9d70108a74efe327ed9d1f68bc1e9e271810d94c)
* stand: efi_fmtdev can be reduced to devformatWarner Losh2023-01-244-30/+3
| | | | | | | | | | devformat produces the same output as efi_fmtdev, so just use it to reduce on the dependencies. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35924 (cherry picked from commit 1e7a2eb93a527a2f4b22be66788caf50e4ba1f89)