aboutsummaryrefslogtreecommitdiff
path: root/stand/efi/boot1
Commit message (Collapse)AuthorAgeFilesLines
* stand: Rename ZFSSRC to SAZFSSRC to avoid confusionWarner Losh2025-11-251-1/+1
| | | | | | | | | ZFSSRC is abiguous on its surface and too clos to ZFSTOP, so rename it to SAZFSSRC. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D53901
* stand: Cut over to using the EDK2 filesWarner Losh2025-11-162-1/+4
| | | | | | | | | | | | | | | | | | | | | | Remove the old EFI SDK files that we've been nursing along for too many years. Replace them with files from EDK2 edk2-stable202502 and tweak the interfaces we need to tweak. Mostly include different things or change the names of the protocols that no longer have old-school compat names. I gave up in the middle of env.c, too damn tedious to find all those new GUIDs. Also, many of the guids were mystery meat, most likely from the EDK2 sources, but just not the Include subdirectory. Need to investigate those. And the memory info? Is it just an oboslete thing, or embedded knowledge of EDK2. Delete the now-redundant copies of things in Guid and Protocol. I debated keeping ZeroGuid.h, but EDK2 has moved on from when I snagged it years ago (or maybe I just invented it out of whole cloth: edk2 does radically different things today and I didn't do the git deep-dive to find out). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D53655
* stand: Rename EFI_ERROR_CODE to DECODE_ERROR to avoid Edk2 ClashWarner Losh2025-11-164-8/+8
| | | | | | | | This follows what Illumos has done. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D53656
* efi: translate errno to EFI status on exitAhmad Khalifa2025-09-091-2/+2
| | | | | Translate the given errno to an efi status instead of always exiting with EFI_LOAD_ERROR.
* machine/stdarg.h -> sys/stdarg.hBrooks Davis2025-06-112-2/+6
| | | | | | | | | | | | | 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
* boot: Always use ELF Tool Chain elfcopy for EFI buildsEd Maste2025-03-231-1/+1
| | | | | | | | | | | | | | | | We now use llvm-objcopy by default (as of commit 1cae7121c667), but it does not support efi-app-x86_64 and similar ouptut formats (for more detail see LLVM issue 108609[1]). Go back to installing ELF Tool Chain's version of objcopy as elfcopy (the standard upstream name) and use it for EFI builds. [1] https://github.com/llvm/llvm-project/issues/108609). PR: 280771 Reviewed by: andrew Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49362
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* boot/efi: Fix warning for non-standard formats when debuggingJohn F. Carr2024-06-141-3/+4
| | | | | | | | Add -Wno-format for zfs_module and regroup. This fixes warnings when EFI_DEBUG is defined. PR: 279071 Reviewed-by: imp
* boot1.efi: Don't redundantly include devpath.cWarner Losh2024-05-071-2/+1
| | | | | | | | | | | | | devpath.c is on both the comand line and in libefi. This is redundant and was a mistake in 4cf36aa1017f9. It never should have been here. In practice, this just means that the devpath.o from libefi.a goes unused. This will cause problems with some upcoming changes (D44872) to enable LTO to reduce the size of the binaries, so go ahead and make the change now to reduce the changeset for that. No functional change indended. Fixes: 4cf36aa1017f9 Co-authored-by: sobomax Sponsored by: Netflix
* loader: Move ldscripts to match more standard practicesWarner Losh2024-02-251-1/+1
| | | | | | | | | In the larger open source community, ld scripts are foo.ldscrpt rather than ldscript.arch like we use here. This moves the EFI ldscripts. Sponsored by: Netflix Reviewed by: tsoome, kevans, emaste Differential Revision: https://reviews.freebsd.org/D44056
* stand: Automated cleanup of cdefs and other formattingWarner Losh2023-11-274-4/+2
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-162-4/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-164-8/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Stand: Silence undefined symbols check commandVexedUXR2023-07-011-1/+1
| | | | | | | No need to print this... Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/786
* Add boot1.efi to CLEANFILESVexedUXR2023-06-121-0/+2
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/775
* stand/boot1.efi: use the bootonce dataset as root datasetGleb Smirnoff2023-06-081-12/+42
| | | | | | | | | | | | | Before this change we would only pass the bootonce dataset name to the environment for the next loader, while actually reading the next stage loader from the 'bootfs' dataset, not the bootonce dataset. Another problem fixed by this change is a boot from a configuration when bootonce attribute is present, but 'bootfs' property is not set. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D40389
* stand/efi: Retire i386 supportWarner Losh2023-05-111-4/+3
| | | | | | | | Remove the i386 ifdefs and files. It never worked. Sponsored by: Netflix Reviewed by: manu, tsoome, kevans Differential Revision: https://reviews.freebsd.org/D40012
* stand/boot1.efi: Implement bootonce for ZFSWarner Losh2023-05-011-1/+26
| | | | | | | | | | | | | | Implement ZFS bootonce protocol. We pass zfs-bootonce=t to the next boot stage as a command line argument. Unlike zfsboot -> loader handoff in the BIOS case, we don't use the OS_BOOTONCE_USED. This would require modifications to loader.efi which would only server to make it more complicated. Instead, use the command line parsing interface for the boot1.efi -> loader.efi to pass in the zfs-bootonce kenv that will be needed by rc.d/zfsbe to activate the BE if boot progresses that far. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D39412
* stand/boot1.efi: Allow modules to add env variablesWarner Losh2023-05-012-0/+23
| | | | | | | | | | Sometimes filesystem modules need to pass details of the state of the filesystem to later stages of a boot. Provide a generic method to do so. We'll add them after any env variables set in our config files. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D39407
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-4/+0
|
* stand: s/libstand/libsa/g to catch up with renameWarner Losh2022-04-301-1/+1
| | | | | | | We renamed libstand to libsa years ago with the move from sys/boot to stand. Catch up in the comments. Sponsored by: Netflix
* stand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.John Baldwin2022-02-021-0/+3
| | | | | | | | | | ld.bfd in binutils 2.34+ now reports an error in more cases for custom ldscripts that do not place PHDRs in a LOAD segment. However, EFI binaries are not dynamic binaries which need PHDRs, so pass --no-dynamic-linker to disable this check. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D34124
* loader: implement mount/unmount rootfsToomas Soome2021-09-081-1/+1
| | | | | | | | | We want to keep our root file system open to preserve bcache segment between file accesses, thus reducing physical disk IO. Reviewed by: imp, allanjude, kevans (previous version) Differential Revision: https://reviews.freebsd.org/D30848 MFC after: 1 month
* EFI secure boot VECTX related changesEric van Gyzen2021-04-301-0/+2
| | | | | | | | | | | | | | When VECTX is enabled as a kernel option and non-EFI loaders are built, many reads will fail due to the mis-match of whether LOADER_VERIEXEC_VECTX or not in readin.h. Source that includes bootstrap.h must ensure the kernel option agrees with the compile time CFLAGS in the various make related files. Submitted by: bret_ketchum@dell.com (original revision) Reviewed by: sjg, bdrewery, dab, bret_ketchum@dell.com MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29993
* Add zstd support to the boot loader.Warner Losh2020-10-121-0/+1
| | | | | | | | | | | | | | | Add support to the _STANDALONE environment enough bits of the kernel that we can compile it. We still have a small zstd_shim.c since there were 3 items that were a bit hard to nail down and may be cleaned up in the future. These go hand in hand with a number of commits to sys/sys in the past weeks, should this need be MFCd. Discussed with: mmacy (in review and on IRC/Slack) Reviewed by: freqlabs (on openzfs repo) Differential Revision: https://reviews.freebsd.org/D26218 Notes: svn path=/head/; revision=366657
* Link efi programs with -pie rather than -sharedAlex Richardson2020-10-121-1/+1
| | | | | | | | | | | This was causing build failures in CheriBSD where we were passing -pie already by default. Reviewed By: andrew Differential Revision: https://reviews.freebsd.org/D24787 Notes: svn path=/head/; revision=366644
* loader: zfs should support bootonce an nextbootToomas Soome2020-09-212-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bootonce feature is temporary, one time boot, activated by "bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag. By default, the bootonce setting is reset on attempt to boot and the next boot will use previously active BE. By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will be set permanently active. bootonce dataset name is recorded in boot pool labels, bootenv area. in case of nextboot, the nextboot_enable boolean variable is recorded in freebsd:nvstore nvlist, also stored in boot pool label bootenv area. On boot, the loader will process /boot/nextboot.conf if nextboot_enable is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf processing on next boot. bootonce and nextboot features are usable in both UEFI and BIOS boot. To use bootonce/nextboot features, the boot loader needs to be updated on disk; if loader.efi is stored on ESP, then ESP needs to be updated and for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated (gpart or other tools). At this time, only lua loader is updated. Sponsored by: Netflix, Klara Inc. Differential Revision: https://reviews.freebsd.org/D25512 Notes: svn path=/head/; revision=365938
* Only set WARNS if not definedKyle Evans2020-09-111-1/+1
| | | | | | | | | | | | | This would allow interested parties to do experimental runs with an environment set appropriately to raise all the warnings throughout the build; e.g. env WARNS=6 NO_WERROR=yes buildworld. Not currently touching the numerous instances in ^/tools. MFC after: 1 week Notes: svn path=/head/; revision=365631
* boot1.efi: use malloc family from libsaToomas Soome2020-06-301-36/+16
| | | | | | | | | | | | | | | The zfs reader development did reach to the point where linking boot1, we will get errors about duplicate symbols Malloc, Free, Calloc. We can just use libsa version, just as loader.efi does. The only concern is, libsa zalloc is using fixed size heap region, I did pick 64MB as other stage instances are using, but this size is likely not optimal. In any case, with limited memory setups, we should boot loader.efi directly. Sponsored by: Netflix, Klara Inc. Notes: svn path=/head/; revision=362812
* Remove tests for obsolete compilers in the build systemEric van Gyzen2020-05-121-4/+0
| | | | | | | | | | | | | | Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree. Assume clang is at least 6, which was in 11.2-RELEASE. Drop conditions for older compilers. Reviewed by: imp (earlier version), emaste, jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24802 Notes: svn path=/head/; revision=360964
* Fix the EFI_DEBUG case, prio_str is only used when EFI_DEBUG is unset.Andrew Turner2020-05-051-0/+2
| | | | | | | Sponsored by: Innovate UK Notes: svn path=/head/; revision=360655
* As with r352446 align blocks in boot1.efiAndrew Turner2020-05-051-5/+5
| | | | | | | | | | | | We need to ensure the buffers are aligned before passing them to ReadBlocks. Assume 512 bytes is enough for now. Reviewed by: imp MFC after: 1 month Sponsored by: Innovate UK Notes: svn path=/head/; revision=360654
* Remove duplicate lz4 implementationsToomas Soome2019-11-021-0/+1
| | | | | | | | | | | | | | Port illumos change: https://www.illumos.org/issues/11667 Move lz4.c out of zfs tree to opensolaris/common/lz4, adjust it to be usable from kernel/stand/userland builds, so we can use just one single source. Add lz4.h to declare lz4_compress() and lz4_decompress(). MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22037 Notes: svn path=/head/; revision=354253
* boot1.efi: provide generic exit() and stub getchar()Toomas Soome2019-10-151-1/+18
| | | | | | | panic() is expecting us to have exit and getchar, lets provide those. Notes: svn path=/head/; revision=353544
* The efifat files are no longer used: remove the code to build themRebecca Cran2019-09-047-106/+0
| | | | | | | | Reviewed by: imp, tsoome, emaste Differential Revision: https://reviews.freebsd.org/D20562 Notes: svn path=/head/; revision=351831
* loader: support com.delphix:removingToomas Soome2019-08-081-0/+2
| | | | | | | | | | | | We should support removing vdev from boot pool. Update loader zfs reader to support com.delphix:removing. Reviewed by: allanjude MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18901 Notes: svn path=/head/; revision=350772
* loader.efi: boot1.c was left out of 350654Toomas Soome2019-08-061-5/+6
| | | | | | | Followup for 350654. Notes: svn path=/head/; revision=350655
* loader.efi: replace HandleProtocol() with OpenProtocol()Toomas Soome2019-08-061-2/+2
| | | | | | | | | | | | | | The HandleProtocol() is deprecated interface and we should use OpenProtocol() instead. Moreover, in some firmware implementation(s), the HandleProtocol() does return device path using static storage, so we can not keep the value returned there. With same firmware, the OpenProtocol() does return data we do not need to clone. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D21162 Notes: svn path=/head/; revision=350654
* Fix gcc build by removing redeclarationLi-Wen Hsu2019-06-131-1/+0
| | | | | | | | | Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20622 Notes: svn path=/head/; revision=349008
* Add stuff to disable warning for %SWarner Losh2019-06-081-0/+2
| | | | | | | | | Add the customary warnings to disable format checking on armv7. Code move to new files, and the unconditional setting of WARNS to 6 provoked it on tinerbox... Notes: svn path=/head/; revision=348814
* Break out the disk selection protocol from the rest of boot1.Warner Losh2019-06-085-196/+280
| | | | | | | | | | | Segregate the disk probing and selection protocol from the rest of the boot loader. Reviewed by: tsoome, bcran Differential Revision: https://reviews.freebsd.org/D20547 Notes: svn path=/head/; revision=348811
* Rework the reporting of the priority.Warner Losh2019-06-071-55/+34
| | | | | | | | | | | Simplify the code a bit and rework how we report the results of the probing. Reviewed by: tsoome@ Differential Revision: https://reviews.freebsd.org/D20537 Notes: svn path=/head/; revision=348768
* Remove left-over status variablesWarner Losh2019-06-072-2/+0
| | | | Notes: svn path=/head/; revision=348766
* Fix when NOFAT is definedWarner Losh2019-06-061-2/+3
| | | | | | | | We need to add the *efi file to the list of things that get built, even if we're not creating the efifat stuff. Notes: svn path=/head/; revision=348763
* Use simple malloc/free instead of dropping down to the UEFIWarner Losh2019-06-062-18/+16
| | | | | | | | | | | BootServices AllocatePool/FreePool calls. They are simpler to use and result in the same thing happening. Reviewed by: tsoome@ Differential Revision: https://reviews.freebsd.org/D20540 Notes: svn path=/head/; revision=348760
* Don't make the efifat thing if NOFAT is defined.Warner Losh2019-06-061-0/+4
| | | | Notes: svn path=/head/; revision=348722
* ufs_module.c can't currently be compiled with -Wcast-align, but theWarner Losh2019-06-051-0/+3
| | | | | | | | code is safe enough. Turn off the warning for now until I can find the right construct to silence it in the code. Notes: svn path=/head/; revision=348675
* Don't shadow a global zfsmount variable.Warner Losh2019-06-051-3/+3
| | | | Notes: svn path=/head/; revision=348674
* Use newly minted efi_devpath_same_disk() instead ofWarner Losh2019-06-041-1/+1
| | | | | | | | | | efi_devpath_match(). This fixes a regression in r347193. Reported by: Tomoaki AOKI Differential Revision: https://reviews.freebsd.org/D20513 Notes: svn path=/head/; revision=348659