aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/efi/loader
Commit message (Collapse)AuthorAgeFilesLines
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-1435-5371/+0
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* Install the 4th files in sys/boot/forth instead of each loaderWarner Losh2017-11-102-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* Move machine and other link creation to defs.mkWarner Losh2017-11-061-15/+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
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+2
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* For amd64, compile both zfs and zfs32 libraries.Warner Losh2017-10-301-19/+5
| | | | | | | | | | | | 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-294-27/+27
| | | | | | | | | | | 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
* Revert "Unify boot1 with loader" change r324646Warner Losh2017-10-172-0/+189
| | | | | | | | | | | | | | 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-161-0/+5
| | | | Notes: svn path=/head/; revision=324653
* Move all the ficl common code into ficl.mkWarner Losh2017-10-161-8/+0
| | | | | | | | 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-161-3/+1
| | | | | | | | | | | | 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
* Unify boot1 with loaderWarner Losh2017-10-162-189/+0
| | | | | | | | | | | 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-122-10/+11
| | | | | | | | | | | 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
* Rather than laying whack-a-mole with including the path to stand.h,Warner Losh2017-10-101-4/+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-091-2/+2
| | | | | | | | | | | 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-091-1/+1
| | | | | | | | | | | | 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
* 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-061-4/+12
| | | | | | | | | | | 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
* libefi: pdinfo_t pd_unit and pd_open should be unsignedToomas Soome2017-09-221-1/+1
| | | | | | | | | | 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
* 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
* loader.efi: chain loader should provide proper device handleToomas Soome2017-09-101-3/+35
| | | | | | | | | | | | 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
* Fix loader bug causing too many pages allocation when bootloader is U-BootMarcin Wojtas2017-09-051-0/+7
| | | | | | | | | | | | | | | | | | | | | FreeBSD loader expects to have mmsz variable set by bootloader. U-Boot behaviour is that if buffer size is not big enough to keep whole memory map, assign the smallest correct buffer size to sz and return error. In other words U-Boot assumes that nobody will need mmsz value when buffer is not filled with memory map, which is not true, so calculated pages value was too big to allocate. Solution: Simply assign default value to mmsz. Submitted by: Patryk Duda <pdk@semihalf.com> Obtained from: Semihalf Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D12194 Notes: svn path=/head/; revision=323174
* Link in libefi for boot1Warner Losh2017-08-261-5/+0
| | | | | | | | | | | Add libefi to the list of libraries we'll link in. Move EFI table definitions back to libefi so we don't have drift between the two efi_main routines. Sponsored by: Netflix Notes: svn path=/head/; revision=322938
* Cleanup efi_main return typeWarner Losh2017-08-261-3/+2
| | | | | | | | | | Make the return type of efi_main uniform. Declare the Exit() function as not returning. Move efi_main's declaration to the proper header. Sponsored by: Netflix Notes: svn path=/head/; revision=322931
* Move efi_main into efi/loaderWarner Losh2017-08-262-0/+188
| | | | | | | | | | | | | Move the efi_main routine out of libefi into sys/boot/efi/loader. Since boot1 has its own efi_main routine, this effectively prevents boot1 from linking with libefi. By moving it out, we can share code better (though though some refactoring with boot1's efi_main and loader.efi's efi_main is definitely in order). Sponsored by: Netflix Notes: svn path=/head/; revision=322930
* Make spinconsole platform independent and hook it up into EFI loader onMaxim Sobolev2017-08-253-4/+8
| | | | | | | | | | i386 and amd64. Not enabled on ARMs, those are lacking timer routines. MFC after: 2 moths Sponsored by: Sippy Software, Inc. Notes: svn path=/head/; revision=322896
* loader.efi: repace XXX with real comments in trap.cToomas Soome2017-08-151-2/+12
| | | | | | | | | | There are two missing comments marked as XXX in trap.c, fix this. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D12035 Notes: svn path=/head/; revision=322542
* Move EFI fmtdev functionality to libefiWarner Losh2017-08-043-222/+0
| | | | | | | | | | | This patch moves code necessary for the fmtdev functionality from loader to libefi, allowing other applications to make use of it Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D11862 Notes: svn path=/head/; revision=322056
* Move EFI ZFS functions to libefiWarner Losh2017-08-041-50/+4
| | | | | | | | | | | This patch moves some EFI ZFS functions from loader to libefi, allowing them to be used by anything that links against libefi. Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D11855 Notes: svn path=/head/; revision=322039
* Link EFI/uboot loaders with -znotextEd Maste2017-07-011-1/+1
| | | | | | | | | | | | | | | By default LLD links with relocations disallowed against readonly sections (e.g., .text), but the 32-bit ARM EFI & uboot boot bits require such relocations. -znotext is either ignored as an unknown -z option (in-tree lld 2.17.50) or is already the default (GNU ld or GNU gold from ports) so we can just add it unconditionally to allow building with LLD. This is similar to the change in r320179 for the kernel link. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=320547
* As with arm64 mark the EFI PE header as allocated on arm. This is neededAndrew Turner2017-06-291-1/+1
| | | | | | | | | for lld to link laoder.efi and boot1.efi. Reported by: emaste Notes: svn path=/head/; revision=320482
* loader.efi: Disable smbios for armEmmanuel Vadot2017-06-241-0/+4
| | | | | | | | | | The smbios code does a lot of unaligned access, since we don't really care about smbios info on ARM (not all board expose information and those who does don't expose useful ones) disable smbios for this arch (at least for now). Notes: svn path=/head/; revision=320304
* Utilize SYSROOT from r320119 in places where DESTDIR may be wanting WORLDTMP.Bryan Drewery2017-06-191-6/+0
| | | | | | | | | | | | | | Since buildenv exports SYSROOT all of these uses will now look in WORLDTMP by default. sys/boot/efi/loader/Makefile A LIBSTAND hack is no longer required for buildenv. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=320122
* Add chain loader support for loaderToomas Soome2017-06-161-0/+94
| | | | | | | | | | | | | | | | | | Implement simple chain loader in loader; this update does add chain command, taking device or file as argument to load and start new boot loader. In case of BIOS, the chain will read the boot block to address 0000:7c00 and jumps on it. In case of UEFI, the chain command is to be used with efi application, typically stored in EFI System Partition. The update also does add simple menu entry, if the variable chain_disk is set. The value of the variable chain_disk is used as argument for chain loading. Relnotes: yes Differential Revision: https://reviews.freebsd.org/D5992 Notes: svn path=/head/; revision=320011
* Set the right variable when overriding the default console speed.Mark Johnston2017-05-111-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=318193
* loader: network read reworkToomas Soome2017-05-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current read from network is working from up to down - we have some protocol needing the data from the network, so we build the buffer space for that protocol, add the extra space for headers and pass this buffer down to be filled by nif get call in hope, we have guessed the incoming packet size right. Amazingly enough this approach mostly does work, but not always... So, this update does work from down to up - we allocate buffer (based on MTU or frame size info), fill it up, and pass on for upper layers. The obvious problem is that when we should free the buffer - if at all. In the current implementation the upper layer will free the packet on error or when the packet is no longer needed. While working on the issue, the additional issue did pop up - the bios implementation does not have generic get/put interface but is using pxe udpsend/udpreceive instead. So the udp calls are gone and undi interface is implemented instead. Which in turn means slight other changes as we do not need to have duplicated pxe implementation and can just use dev_net. To align packet content, the actual read from nic is using shifted buffer by ETHER_ALIGN (2). Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10232 Notes: svn path=/head/; revision=317887
* loader.efi: ResetSystem does not use data with EFI_SUCCESSToomas Soome2017-05-011-2/+1
| | | | | | | | | | | | | | | | | | The current reboot command in efi/loader/main.c is passing extra data with ResetSystem, however, UEFI spec 2.6, page 265 does state: "ResetData is only valid if ResetStatus is something other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific where a minimum amount of ResetData is always required." Therefore we should use DataSize 0 and ResetData NULL - those are two last arguments for the call. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D10562 Notes: svn path=/head/; revision=317652
* loader.efi: only fetch zfs pool guid for the actual boot deviceToomas Soome2017-04-111-21/+9
| | | | | | | | | | | | | | | With the zfs probe cleanup, the mistake did slip in the probe code; instead of reading the pool GUID for the actual boot device (partition), we read GUID for first found pool from the boot disk. This will break the case when there are both zfs pool and ufs on the boot disk, and the ufs is used for boot, not zfs. Reviewed by: smh Differential Revision: https://reviews.freebsd.org/D10359 Notes: svn path=/head/; revision=316704
* Do not use -msoft-float with intention of disabling FP on aarch64Alexander Kabaev2017-04-071-1/+1
| | | | | | | | | | | GNU GCC does does recognise it as a valid option and we already use -mgeneral-regs-only that has the desired effect. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D10306 Notes: svn path=/head/; revision=316625
* loader: zfs reader should check all labelsToomas Soome2017-04-061-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | The current zfs reader is only checking first label from each device, however, we do have 4 labels on device and we should check all 4 to be protected against disk failures and incomplete label updates. The difficulty is about the fact that 2 label copies are in front of the pool data, and 2 are at the end, which means, we have to know the size of the pool data area. Since we have now the mechanism from common/disk.c to use the partition information, it does help us in this task; however, there are still some corner cases. Namely, if the pool is created without partition, directly on the disk, and firmware will give us the wrong size for the disk, we only can check the first two label copies. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D10203 Notes: svn path=/head/; revision=316585
* Restore EFI boot environment functionality broken in r313333Allan Jude2017-04-031-0/+1
| | | | | | | | Reported by: Graham Perrin, JT Pennington <q5sys@bsdnow.tv> Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=316436
* loader: simplify efi_zfs_probe and avoid double probing for zfs.Toomas Soome2017-03-301-43/+22
| | | | | | | | | | | | | | | | | The current efi_zfs_probe() is overcomplicated and can be made simpler. Still we need to pick up the device handle for our boot disk first, because the ESP does not have to be the first partition on the disk. Once we do have the handle for boot disk, we probe that disk with pointer for pool GUID. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D10198 Notes: svn path=/head/; revision=316280
* self_reloc.c: Pass -Wno-error=maybe-uninitialized to gcc versions greater ↵Enji Cooper2017-03-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | than 4.2.1 self_reloc.c doesn't initialize `rel` in all cases in the C code, however, the value might be initialized properly on the stack in the assembly code. For right now (because this doesn't seem to be breaking anything and my initializing the stack value could break something since it's called from assembly code) disable the warning for self_reloc.c. More investigation should be done to determine the appropriate response to this warning (either intialize the value or find a smarter way to deal with the warning). A long MFC timeout is being set for this change to allow a better solution for the issue to be developed in that time period. MFC after: 2 months Reported by: Jenkins (FreeBSD-head-amd64-gcc job) Tested with: amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc) Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=316119
* Mark the EFI PE header as allocated. While ld.bfd doesn't seem to careAndrew Turner2017-03-171-1/+1
| | | | | | | | | about not having this flag ld.lld fails to link without it. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=315452
* loader.efi: use stricter check for Hyper-VDexuan Cui2017-03-141-2/+7
| | | | | | | | | | | | | | | Some other hypervisors like Xen can pretend to be Hyper-V but obviously they can't implement all Hyper-V features. Let's make sure we're genuine Hyper-V here. Also fix some minor coding style issues. PR: 211746 MFC after: 2 weeks Sponsored by: Microsoft Notes: svn path=/head/; revision=315235
* loader.efi: only include the machine/ header files on x86Dexuan Cui2017-03-091-2/+2
| | | | | | | | | | | | The 2 files may not exist on other archs like aarch64 and hence we can have a build failure there. Reported by: lwhsu MFC after: 2 weeks Sponsored by: Microsoft Notes: svn path=/head/; revision=314962
* loader.efi: only reduce the size of the staging area on Hyper-VDexuan Cui2017-03-091-2/+50
| | | | | | | | | | | | | | | | | | | | Doing this on physical hosts turns out to be problematic, e.g. see comment 24 and 28 in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211746. To fix the real underlying issue correctly & thoroughly, IMO we need a relocatable kernel, but that would require a lot of complicated long term work: https://reviews.freebsd.org/D9686?id=25414#inline-56969 For now, let's only apply efi_verify_staging_size() to VMs running on Hyper-V, and restore the old behavior on physical machines since that has been working for people for a long period of time, though that's potentially unsafe... MFC after: 2 weeks Sponsored by: Microsoft Notes: svn path=/head/; revision=314956
* loader.efi: finally fix the off-by-one bug in efi_verify_staging_size()Dexuan Cui2017-03-081-0/+2
| | | | | | | | | | | | | r314828(loader.efi: fix an off-by-one bug in efi_verify_staging_size()) doesn't really fix the bug and this patch adds the missing part. It's a shame that I didn't make everything correct at the very beginning... MFC after: 2 weeks Sponsored by: Microsoft Notes: svn path=/head/; revision=314891