aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/efi
Commit message (Collapse)AuthorAgeFilesLines
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-14102-18534/+0
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* boot1: also check for NULL deviceEd Maste2017-11-121-7/+9
| | | | | | | | | | | | | | | | | r325681 fixed a NULL pointer dereference on RPi3 caused by a lack of functionality in uboot's EFI implementation. That rev checked the boot1 load path for NULL but not the load device. In practice if the former works the latter will as well, but improve correctness by checking each separately. Submitted by: Keith White <kwhite@eecs.uottawa.ca> Reported by: jhb MFC after: 5 days MFC with: r325681 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=325744
* Install the 4th files in sys/boot/forth instead of each loaderWarner Losh2017-11-105-19/+3
| | | | | | | | | | | | | | | | | | | | | | | | Also, move generation of loader.help into loader.mk. Set HELP_FILES= to disable this (so we only install one help file, for now). At the same time remove some duplicate -I lines. Fix several FILES= and CLEANFILES= into the += form since we're touching both of those in the .mk files. Make sure we only build one loader.help file per platform in a unified way (we were building many on some, with the last to install winning, though often they were the same text). Also, we're now installing loader.rc and menu.rc everywhere. arm and mips uboot installed these as menu.rc.sample, but there's no need since the loader.rc for those platforms doesn't do menu.rc processing by default. pcibios.4th is now installed everywhere, but will failsafe on non x86 platforms (it isn't loaded by default anywhere). These changes are too intertwined to do separately since aspects of each are required to have a bug-free commit. Sponsored by: Netflix Notes: svn path=/head/; revision=325694
* Remove LOADER_FDT_SUPPORT as a Makefile variable.Warner Losh2017-11-103-8/+5
| | | | | | | | | | | | | LOADER_FDT_SUPPORT was used inconsistently in the tree. In some places, it was used to control whether or not the user wanted FDT included, and in other places it was a command to include support. Remove it entirely. The former is now enabled -DWITH_FDT, while the latter is controlled by Makefiles defining HAVE_FDT. Supported by: Netflix Notes: svn path=/head/; revision=325689
* boot1: avoid using NULL device pathEd Maste2017-11-101-14/+15
| | | | | | | | | | | | | | | | As of r323063 boot1 printed out the path & device from which it was loaded, but uboot's EFI implementation lacked some support, resulting in a NULL pointer and a crash. Check for a NULL pointer and avoid reporting (and storing in the environment) the device and path in this case. Submitted by: Zakary Nafziger <worldofzak@gmail.com> MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13038 Notes: svn path=/head/; revision=325681
* loader.efi: efi_devpath_is_prefix should return boolToomas Soome2017-11-102-9/+9
| | | | | | | | | | | efi_devpath_is_prefix() is currently returning values 0 or 1, which means it really should return bool. Additionally, use unsigned len, because we only get unsigned values from DevicePathNodeLength(). Notes: svn path=/head/; revision=325641
* loader: set options before including bsd.init.mkRoger Pau Monné2017-11-081-6/+6
| | | | | | | | | | | | | | | | | bsd.init.mk ends up including defs.mk so the per-arch options must be set before including defs.mk, or else the global defaults will be used and the per-arch ones will be ignored. Although better, note that the usage of MK_FDT before the inclusion of bsd.init.mk is incorrect but doesn't lead to build errors. This circular dependency must be broken in order for this to work correctly. Reviewed by: imp Sponsored by: Citrix Systems R&D Notes: svn path=/head/; revision=325556
* Prefer bsd.init.mk to src.opts.mkWarner Losh2017-11-061-1/+1
| | | | | | | | | | | | Final sweep to prefer bsd.init.mk to src.opts.mk everywhere as a design pattern. The rule is that all Makefiles in this subtree should start with .include <bsd.init.mk> so that we properly include ../Makefile.inc and defs.mk before anything else. Sponsored by: Netflix Notes: svn path=/head/; revision=325484
* Move machine and other link creation to defs.mkWarner Losh2017-11-063-37/+0
| | | | | | | | | | | | | | | | Steal the code from kmod.mk and use it to automatically create links. Modify it a little for the needs of the loader (no need to guess the OBJS dependency, and we have 32-on-64 cases to contend with). Remove 15 redundant implementations (which were mostly different, but kinda the same). A future commit should factor out this code and that of kmod.mk so we have only one copy of it in the tree. Sposnored by: Netflix Notes: svn path=/head/; revision=325482
* efipart_strategy is using wrong offset with >512B sectorsToomas Soome2017-11-011-1/+5
| | | | | | | | | | | The strategy() calls are assuming 512B sectors, so we need to adjust the offset accordingly. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12849 Notes: svn path=/head/; revision=325286
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-312-2/+6
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* For amd64, compile both zfs and zfs32 libraries.Warner Losh2017-10-303-41/+12
| | | | | | | | | | | | We have a separate copy of zfs for userboot. However, we don't need it if we compile both 32 and 64 bit ZFS libraries. Remove redunant copies of zfs related .o files now that both versions are available. Introduce ZFSSRC and use it everywhere. Sponsored by: Netflix Notes: svn path=/head/; revision=325175
* Define new EFI variablesWarner Losh2017-10-297-59/+59
| | | | | | | | | | | Define EFISRC, EFIINC and EFIINCMD. Use them, as well as using other symbols defined in defs.mk. Prefer <bsd.init.mk> to ../../Makefile.inc or <src.opts.mk>. Sponsored by: Netflix Notes: svn path=/head/; revision=325093
* loader.efi: Make framebuffer commands available for arm64Emmanuel Vadot2017-10-255-4/+5
| | | | | | | | | | | Move framebuffer.{c,h} to sys/boot/efi/loader and add the efifb related metadata and pass it to the kernel Reviewed by: imp, andrew Differential Revision: https://reviews.freebsd.org/D12757 Notes: svn path=/head/; revision=324995
* Move BINDIR definition to defs.mk, and override where it isn't /bootWarner Losh2017-10-251-2/+0
| | | | | | | | | (those files already do that so weren't changed). Sponsored by: Netflix Notes: svn path=/head/; revision=324981
* Revert "Unify boot1 with loader" change r324646Warner Losh2017-10-178-510/+884
| | | | | | | | | | | | | | Back out the unification commit to boot1. There's some issues on the arm and arm64 platforms that need to be addressed with code changes. There's also a discussion on arch@ about the future of boot1.efi vs just using loader.efi that needs to play out. So take a pause on these changes until the arm issues can be fixed and it's clear boot1.efi will survive into FreeBSD 12. OK'd by: Eric@meatspace Notes: svn path=/head/; revision=324709
* LOADER_foo_SUPPORTEDWarner Losh2017-10-162-0/+6
| | | | Notes: svn path=/head/; revision=324653
* Move all the ficl common code into ficl.mkWarner Losh2017-10-163-9/+1
| | | | | | | | There's a number of copies of basically identical code to enable building forth in /boot/loader. Move it all into ficl.mk. Notes: svn path=/head/; revision=324652
* Move common/Makefile.inc to sys/boot/loader.mk.Warner Losh2017-10-162-6/+2
| | | | | | | | | | | | Makefile.inc has a specific meaning in the tree, and common/Makefile.inc doesn't quite fit into that. Rename it to loader.mk and it will be a place to collect common things to all /boot/loader programs there. Sponsored by: Netflix Notes: svn path=/head/; revision=324649
* Rename top level Makefile.ficl to ficl.mk.Warner Losh2017-10-161-1/+1
| | | | Notes: svn path=/head/; revision=324648
* Unify boot1 with loaderWarner Losh2017-10-168-884/+512
| | | | | | | | | | | Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor to use the common efi_main.c. Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D10447 Notes: svn path=/head/; revision=324646
* Rename exit to efi_exit to avoid clashing with libsa exit definitionWarner Losh2017-10-123-11/+12
| | | | | | | | | | | Rename exit to efi_exit. It doesn't have the proper signature and conflicts with standard definition. Provide the standard definition as well. Sponsored by: Netflix Notes: svn path=/head/; revision=324557
* Move ufsread.cWarner Losh2017-10-121-2/+2
| | | | | | | | | | | Move ufsread.c from sys/boot/common (which used to be all the common files for /boot/loader, but grew to be all the common files for sys/boot, but that's now sys/boot/libsa's job) to sys/boot/libsa. Sponsored by: Netflix Notes: svn path=/head/; revision=324556
* Rather than laying whack-a-mole with including the path to stand.h,Warner Losh2017-10-103-7/+0
| | | | | | | | | | always include it. Remove places where we explicitly include it. This also helps reduce the 'cut-and-paste' factor of these Makefiles. Sponsored by: Netflix Notes: svn path=/head/; revision=324460
* Define LIBSA* and use them instead of overloaded LIBSTANDWarner Losh2017-10-092-4/+4
| | | | | | | | | | | LIBSA is the current stand alone library. LIBSA32 is the 32-bit version of the library. LIBSAU is the userboot version of libsa. Use the proper define instead of the more generic define. Sponsored by: Netflix Notes: svn path=/head/; revision=324452
* Define SASRC and use itWarner Losh2017-10-093-3/+3
| | | | | | | | | | | | Define SASRC to point to the current libstand sources. Include ../Makefile.inc early enough in a few places so we can .include "${SASRC}/Makefile" and have it work. Create a new pass-up Makefile.inc in sys/boot/userboot to allow this pattern to work. Sponsored by: Netflix Notes: svn path=/head/; revision=324450
* Prefer ${LIBSTAND} to -lstandWarner Losh2017-10-091-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=324449
* Unbreak building efiboot with MK_ZFS == noEnji Cooper2017-10-071-1/+2
| | | | | | | | | Wrap `efi_zfs_is_preferred` with `#ifdef EFI_ZFS_BOOT`. Reported by: Guy Yur <guyyur@gmail.com> Notes: svn path=/head/; revision=324388
* Encapsulate ZFS preferences into efi_zfs_is_preferredWarner Losh2017-10-063-8/+15
| | | | | | | | | | | Move the retrieval of the image information into loader's main instead of doing it in efizfs.c Differential Revision: https://reviews.freebsd.org/D12564 Submitted by: Eric McCorkle Notes: svn path=/head/; revision=324360
* Add efi_devpath_is_prefixWarner Losh2017-10-062-0/+30
| | | | | | | | | | efi_devpath_is_prefix determines if a path matches a passed-in prefix. Differential Revision: https://reviews.freebsd.org/D12564 Submitted by: Eric McCorkle Notes: svn path=/head/; revision=324359
* libefi: efipart_floppy() will should not pass acpi pointer if the HID test failsToomas Soome2017-09-251-2/+2
| | | | | | | The current efipart_floppy() implementation is leaking the acpi pointer. Notes: svn path=/head/; revision=323991
* libefi: define EISA PNP constantsToomas Soome2017-09-221-3/+8
| | | | | | | Define EISA PNP constants and use them, also fix ID for 0x701 Notes: svn path=/head/; revision=323909
* libefi: efipart_hdinfo_add_filepath should check strtol resultToomas Soome2017-09-221-0/+7
| | | | | | | Use errno for error checking. Notes: svn path=/head/; revision=323908
* libefi: efipart.c cstyle fix for efipart_print_common()Toomas Soome2017-09-221-1/+2
| | | | | | | The else statement should have { } Notes: svn path=/head/; revision=323907
* libefi: efipart_strategy() should return ENXIO when there is no mediaToomas Soome2017-09-221-1/+1
| | | | | | | | We should return ENXIO to indicate the situation with device present, but no media. Notes: svn path=/head/; revision=323906
* libefi: pdinfo_t pd_unit and pd_open should be unsignedToomas Soome2017-09-222-3/+3
| | | | | | | | | | The device index, partition index and reference counter are all positive numbers. However, since our internal partition number may be negative to indicate GPT table, the compare expression need to take care when comparing pdinfo_t and partition data. Notes: svn path=/head/; revision=323905
* efilib.h: typo in structure member descriptionToomas Soome2017-09-221-1/+1
| | | | | | | The link should be replaced by list. Notes: svn path=/head/; revision=323897
* r323885 did miss efilib.h updateToomas Soome2017-09-221-1/+2
| | | | | | | The efilib.h update was left out from r323885 by mistake. Notes: svn path=/head/; revision=323896
* libefi: efi_devpath_match local len should be unsignedToomas Soome2017-09-221-2/+2
| | | | | | | DevicePathNodeLength() will always return unsigned value. Notes: svn path=/head/; revision=323895
* libefi: efipart.c should use calloc()Toomas Soome2017-09-211-10/+5
| | | | | | | | The device specific *_add functions are using malloc() + memset, should use calloc instead. Notes: svn path=/head/; revision=323886
* libefi: efi_devpath_match() should return boolToomas Soome2017-09-212-9/+9
| | | | | | | | The current implementation of efi_devpath_match() is returning values 0 or 1, so it should be updated to return bool. Notes: svn path=/head/; revision=323885
* libefi: devicename.c cleanupsToomas Soome2017-09-211-16/+20
| | | | | | | | Remove duplicated free()+return statements, default unit to 0 and improve strtol error processing. Notes: svn path=/head/; revision=323867
* Increase EFI boot file size frok 128k to 384kAllan Jude2017-09-1311-116/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | generate_fat.sh does the following: - create an 800kb zero-filled file - create an md device backed by this file - format the device fat12 - mount the filesystem - create the EFI ESP directory structure - create the EFI boot file (BOOTx64 for amd64, BOOTaa64 for aarch64, etc) - Adds a marker to the beginning of the file, and pad it to 384kb - 384kb was chosen as it is less than half of 800kb, thus allowing users to keep a backup of their older boot file in the small partition - Unmount the filesystem - Scan the image and find the offset where the marker was inserted - The process requires root, to make image generation easier, images for each architecture are pregenerated, compressed with xz, and checked into svn. The Makefile that generates boot1.efifat does the following: - Ensure the compiled boot1.efi file is no larger than the generated image - Decompress the template created by generate-fat.sh - dd the contents of boot1.efi into boot1.efifat starting at the offset where the marker is found. This allows any file less than the maximum size to be written into the fat filesystem without having to mount it, so no root privileges are required. Later work by imp and myself makes bsdinstall create a 200mb fat16 instead of using this process, but it is retained to make image generation easier. Submitted by: Eric McCorkle (original version) Reviewed by: emaste, tsoome, Eric McCorkle MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9680 Notes: svn path=/head/; revision=323554
* libefi: efipart_realstrategy rsize pointer may be NULLToomas Soome2017-09-131-1/+2
| | | | | | | Need to check rsize before dereferencing it. Notes: svn path=/head/; revision=323541
* libefi: efipart_open should check the status from disk_openToomas Soome2017-09-121-2/+13
| | | | | | | | | | In case of error from disk_open(), we should clean up properly. Reviewed by: allanjude, imp Differential Revision: https://reviews.freebsd.org/D12340 Notes: svn path=/head/; revision=323497
* boot1: remove BOOT1_MAXSIZE default valueEd Maste2017-09-111-1/+0
| | | | | | | | | | | | This Makefile relies on Makefile.fat providing the correct value for BOOT1_MAXSIZE and BOOT1_OFFSET. Since BOOT1_OFFSET had no default value here the build would already fail if Makefile.fat did not provide correct values. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=323436
* r323389 breaks the kernel build when WITHOUT_ZFS is defined in src.confToomas Soome2017-09-111-0/+4
| | | | | | | | | | Need to add #ifdef EFI_ZFS_BOOT guard into efi/loader/main.c PR: 222215 Reported by: Sylvain Garrigues Notes: svn path=/head/; revision=323428
* boot1 generate-fat: generate all templates at onceEd Maste2017-09-111-47/+50
| | | | | | | | | | | | | | | | | | | | | | | | | In advance of other changes to the fat template generation process, have generate-fat.sh create all template files at the same time so that they cannot get out of sync. Also correct a longstanding but where BOOT1_OFFSET was overwritten on each invocation. A previous version of this patch stored a per-arch offset (e.g. BOOT1_arm64_OFFSET) but that was deemed unnecessary. Instead just hardcode the known offset that applies to all archs (0x2d) and fail if the offset happens to be different. Ongiong work (using newfs_msdos in bsdinstall and adding msdosfs support to makefs) will eventually allow us to do away with this fat template hack altogether, but in the near term we have a few improvements that will build on this. Reviewed by: allanjude, imp, Eric McCorkle MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10931 Notes: svn path=/head/; revision=323407
* loader.efi: chain loader should provide proper device handleToomas Soome2017-09-105-47/+77
| | | | | | | | | | | | Since the efipart rewrite, the chain command was looking for device handle using interface applicable only for net devices. Disk partitions and zfs pools need their own approach to find the proper handle. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12287 Notes: svn path=/head/; revision=323389
* Be consistent and do return (1);Warner Losh2017-09-071-1/+1
| | | | | | | | Noticed by: tsoome@ Sponsored by: Netflix Notes: svn path=/head/; revision=323272