aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/i386/loader
Commit message (Collapse)AuthorAgeFilesLines
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-148-965/+0
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* Install the 4th files in sys/boot/forth instead of each loaderWarner Losh2017-11-101-14/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Move LOADER_{NO,}_GELI_SUPPORT to MK_LOADER_GELIWarner Losh2017-11-101-9/+2
| | | | | | | | | | | | | | Transition to WITH/WITHOUT_LOADER_GELI to flag support or not of GELI in the boot loaders. Add HAVE_GELI so components can flag they need support (since it's too large to include everywhere). Add temporary warnings for the old forms to ease transition. Also, update test script to build without GELI on x86. Sponsored by: Netflix Notes: svn path=/head/; revision=325693
* Replace LOADER_FIREWIRE_SUPPORT variableWarner Losh2017-11-101-6/+5
| | | | | | | | | | | | Rename LOADER_FIREWIRE_SUPPORT to MK_LOADER_FIREWIRE. Only build libfirewire when this is "yes". Add note to updating. Fix build script to build this for x86 so the option doesn't decay. sparc64 supports ZFS, so also build it MK_ZFS=no. Sponsored by: Netflix Notes: svn path=/head/; revision=325692
* Remove LOADER_ZFS_SUPPORT as a Makefile variableWarner Losh2017-11-101-10/+2
| | | | | | | | | | | | | LOADER_ZFS_SUPPORT is entirely used to select whether or not to support ZFS in the loader. But it's not a user-servicable part (MK_ZFS is what's used for that) Change it to the more conventional HAVE_ZFS and move the ZFS support code into loader.mk. In addition, only build ZFS libraries and boot loaders when ZFS is enabled. Sponsored by: Netflix Notes: svn path=/head/; revision=325690
* loader: set options before including bsd.init.mkRoger Pau Monné2017-11-081-10/+10
| | | | | | | | | | | | | | | | | 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-6/+2
| | | | | | | | | | | | | | | | 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
* Define LIBFICL32 to be libficl.a on i386 and libficl32.a on amd64.Warner Losh2017-11-061-9/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325479
* This used to have bzip2 support too.Warner Losh2017-11-021-0/+1
| | | | Notes: svn path=/head/; revision=325339
* loader: fix BOOTSRC -> BOOTOBJ in a library pathAndriy Gapon2017-11-021-1/+1
| | | | Notes: svn path=/head/; revision=325338
* loader: re-enable gzip support for x86Roger Pau Monné2017-11-021-0/+1
| | | | | | | | | | | r324653 inadvertently disabled default gzip support on x86, re-enable. Sponsored by: Citrix System R&D Reviewed by: imp Differential revision: https://reviews.freebsd.org/D12913 Notes: svn path=/head/; revision=325332
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+1
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* For amd64, compile both zfs and zfs32 libraries.Warner Losh2017-10-301-0/+4
| | | | | | | | | | | | 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
* Use defs.mk name and prefer bsd.init.mkWarner Losh2017-10-301-16/+14
| | | | | | | | | | Also need to make some small tweaks to the Makefiles to use += rather than = due to small shift in include file order. Sponsored by: Netflix Notes: svn path=/head/; revision=325171
* End source directories with SRC rather than a hodgepodge of namesWarner Losh2017-10-221-2/+2
| | | | | | | | | | | | | | BOOTDIR->BOOTSRC FICLDIR->FICLSRC LDR_MI->LDRSRC This matches the patterns used in the rest of the system a bit vetter. Suggested by: rgrimes@ Sponsored by: Netflix Notes: svn path=/head/; revision=324877
* Use BOOTOBJ and BOOTDIR to find geli includes and libraries.Warner Losh2017-10-221-2/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=324845
* LOADER_foo_SUPPORTEDWarner Losh2017-10-161-17/+6
| | | | Notes: svn path=/head/; revision=324653
* Move all the ficl common code into ficl.mkWarner Losh2017-10-161-13/+9
| | | | | | | | 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-4/+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
* 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-4/+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
* loader: chain load relocate data declaration is badToomas Soome2017-06-291-4/+3
| | | | | | | | | | | | | The implementation is using fixed size array allocated in asm module, need to use proper array declaration for C source. CID: 1376405 Reported by: Coverity, cem Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D11321 Notes: svn path=/head/; revision=320467
* Add chain loader support for loaderToomas Soome2017-06-163-1/+145
| | | | | | | | | | | | | | | | | | 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
* Always build tftpfs support along with nfs for pxebootBaptiste Daroussin2017-05-271-2/+4
| | | | | | | This change was already done for loader.efi Notes: svn path=/head/; revision=318988
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-05-091-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=318000
* 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: 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
* Small cleanup to make i386/loader match efi/loader boot environment codeAllan Jude2017-04-031-1/+1
| | | | Notes: svn path=/head/; revision=316437
* Implement boot-time encryption key passing (keybuf)Allan Jude2017-04-012-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a general mechanism for providing encryption keys to the kernel from the boot loader. This is intended to enable GELI support at boot time, providing a better mechanism for passing keys to the kernel than environment variables. It is designed to be extensible to other applications, and can easily handle multiple encrypted volumes with different keys. This mechanism is currently used by the pending GELI EFI work. Additionally, this mechanism can potentially be used to interface with GRUB, opening up options for coreboot+GRUB configurations with completely encrypted disks. Another benefit over the existing system is that it does not require re-deriving the user key from the password at each boot stage. Most of this patch was written by Eric McCorkle. It was extended by Allan Jude with a number of minor enhancements and extending the keybuf feature into boot2. GELI user keys are now derived once, in boot2, then passed to the loader, which reuses the key, then passes it to the kernel, where the GELI module destroys the keybuf after decrypting the volumes. Submitted by: Eric McCorkle <eric@metricspace.net> (Original Version) Reviewed by: oshogbo (earlier version), cem (earlier version) MFC after: 3 weeks Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D9575 Notes: svn path=/head/; revision=316343
* Add explicit_bzero() to libstand, and switch GELIBoot to using itAllan Jude2017-03-311-2/+2
| | | | | | | | | | | Make sure sensitive memory is properly cleared when finished with it Reviewed by: Eric McCorkle <eric@metricspace.net> Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D9798 Notes: svn path=/head/; revision=316311
* loader: use strip -o instead of cp and strip in placeEd Maste2016-12-281-2/+1
| | | | | | | | | | | It is simpler and cleaner to have strip produce the stripped output directly than copying the input to the output first. MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=310661
* Deduplicate loader vers.c Makefile rulesEd Maste2016-12-191-5/+2
| | | | | | | | | | | | | | The Makefile rule to create vers.c for loader version info was previously duplicated in each of the various loader Makefiles. Instead, share a common rule in Makefile.inc. Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8841 Notes: svn path=/head/; revision=310267
* Reduce boot loader version string duplicationEd Maste2016-12-181-4/+2
| | | | | | | | | | | | | Instead of repeating "%s, Revision %s" "(%s %s)" in each loader, just create the full version string in vers.c Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8823 Notes: svn path=/head/; revision=310225
* Really make WITHOUT_FORTH (MK_FORTH==no) work. The recent inclusion ofWarner Losh2016-10-251-2/+2
| | | | | | | | | | | | | | | FICL definitions not in ficl/ficl32 files broke this generally. This makes that stuff conditional on BOOT_FORTH. Also, move definitions related to the architecture (FICL_CPUARCH and friends) into Makefile.ficl that all parts of the tree that include files with ficl need to include (but only if MK_FORTH == yes). In addition, had to fix library ordering issue with LIBSTAND to keep it last. Without boot forth, there's no references to memset to bring in memset.o from libstand.a to satisfy libgeliboot.a's use of it. Listing libstand last solves this issue (and it's the proper place for libstand to boot). Notes: svn path=/head/; revision=307942
* Netboot: allow both tftpfs and nfs in both pxeboot and loader.efiBaptiste Daroussin2016-08-311-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new 'netproto' variable which can be set for now to NET_TFTP or NET_NFS (default to NET_NONE) From the dhcp options if one sets the root-path option to: "ip:path", the loader will consider it is booting over NFS (meaning same behaviour as the default current behaviour) if the dhcp option "tftp server address" is set (option 150) the loader will consider it is booting over tftpfs, it will then consider the root-path options with 2 possible case 1. "path" then the IP of the tftp server will be the one passed by the option 150, and the files will be retrieved under "path" on the tftp server 2. "ip:path" then the IP of the tftp server will be the one passed in the option "overwritting the IP from the option 150. We could not "abuse" the rootpath option in the form or tftp://ip:path because this is already used for other purpose by iPXE preventing any chainload from iPXE to the FreeBSD loader. Given at each open(), the loader loops over all available filesystems and keep the "best" error, we needed to prevent tftpfs to fallback on nfs and vice versa. the tftpfs and nfs implementation in libstand now return EINVAL early if 'netproto' for that purpose. Reviewed by: tsoome Relnotes: yes Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D7628 Notes: svn path=/head/; revision=305125
* A new implementation of the loader block cacheAllan Jude2016-04-181-2/+2
| | | | | | | | | | | | | | | | | | | | The block cache implementation in loader has proven to be almost useless, and in worst case even slowing down the disk reads due to insufficient cache size and extra memory copy. Also the current cache implementation does not cache reads from CDs, or work with zfs built on top of multiple disks. Instead of an LRU, this code uses a simple hash (O(1) read from cache), and instead of a single global cache, a separate cache per block device. The cache also implements limited read-ahead to increase performance. To simplify read ahead management, the read ahead will not wrap over bcache end, so in worst case, single block physical read will be performed to fill the last block in bcache. Booting from a virtual CD over IPMI: 0ms latency, before: 27 second, after: 7 seconds 60ms latency, before: over 12 minutes, after: under 5 minutes. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: delphij (previous version), emaste (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D4713 Notes: svn path=/head/; revision=298230
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2016-03-211-0/+1
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=297154
* Implement GELI (AES-XTS and AES-CBC only) in gptboot and gptzfsbootAllan Jude2016-03-162-4/+38
| | | | | | | | | | | | Allows booting from a GELI encrypted root file system, via UFS or ZFS Reviewed by: gnn, smh (previous version), delphij (previous version) Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D4593 Notes: svn path=/head/; revision=296963
* Add more .NOMETA missed in r291320Bryan Drewery2016-03-111-1/+1
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296706
* Revert r269030. CLEANFILES is already added to .NOPATH since r241298.Bryan Drewery2016-03-111-1/+1
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296705
* DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-241-2/+0
| | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=295989
* Move init_zfs_bootenv to sys/boot/zfs/zfs.c instead of having a copy in each ↵Allan Jude2016-01-151-29/+0
| | | | | | | | | | | | loader While here, add a filter to ignore special datasets MFC after: 3 days Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=294072
* Return call to init_zfs_bootenv to its previous locationAllan Jude2016-01-091-1/+5
| | | | | | | | | | | | | | When called to early, new_currdev->d_type was not yet set zfs_fmtdev() would then return null While here, guard call to init_zfs_bootenv with if d_type == DEVT_ZFS Reported by: tsoome at me.com MFC after: 3 days Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=293612
* Only call init_zfs_bootenv() when the system was booted with ZFSAllan Jude2016-01-091-6/+12
| | | | | | | | | | | | Add a few other safeguards to ensure things do not break when the boot device cannot be determined Reported by: flo MFC after: 3 days Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=293454
* Add support for ZFS Boot Environments to userboot (for bhyve and others)Allan Jude2016-01-081-1/+2
| | | | | | | | | | | While here, also fix a possible null pointer Reported by: lattera MFC after: 3 days Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=293414
* Introduce the ZFS Boot Environments menu to the loader menuAllan Jude2015-12-311-0/+57
| | | | | | | | | | | | | | | | | | | | | If the system was booted with ZFS, a new menu item (#7) appears It contains an autogenerated list of ZFS Boot Environments This allows the user to switch to an alternate root file system Use Cases: - Revert a failed upgrade - Concurrently run different versions of FreeBSD with common home directory - Easier integration with the sysadmin/beadm utility Requested by: many Reviewed by: dteske MFC after: 10 days Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3167 Notes: svn path=/head/; revision=293001
* pxeboot: make the tftp loader use the option root-path directiveBaptiste Daroussin2015-12-161-5/+0
| | | | | | | | | | | | | | | | | | | | | | | pxeboot in tftp loader mode (when built with LOADER_TFTP_SUPPORT) now prefix all the path to open with the path obtained via the option 'root-path' directive. This allows to be able to use the traditional content /boot out of box. Meaning it now works pretty much like all other loaders. It simplifies hosting hosting multiple version of FreeBSD on a tftp server. As a consequence, pxeboot does not look anymore for a pxeboot.4th (which was never provided) Note: that pxeboot in tftp loader mode is not built by default. Reviewed by: rpokala Relnotes: yes Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D4590 Notes: svn path=/head/; revision=292344
* META MODE: Update dependencies with 'the-lot' and add missing directories.Bryan Drewery2015-12-011-0/+11
| | | | | | | | | | | | | | | | | This is not properly respecting WITHOUT or ARCH dependencies in target/. Doing so requires a massive effort to rework targets/ to do so. A better approach will be to either include the SUBDIR Makefiles directly and map to DIRDEPS or just dynamically lookup the SUBDIR. These lose the benefit of having a userland/lib, userland/libexec, etc, though and results in a massive package. The current implementation of targets/ is very unmaintainable. Currently rescue/rescue and sys/modules are still not connected. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291563
* META_MODE: Remove DEP_MACHINE from Makefile.depend files.Bryan Drewery2015-09-251-2/+0
| | | | | | | | | This has not been needed since r246865 in projects/bmake. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=288228