aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/userboot
Commit message (Collapse)AuthorAgeFilesLines
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-1424-3243/+0
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* Use proper include file. While <boot/userboot/userboot.h> works, itWarner Losh2017-11-131-1/+1
| | | | | | | | | | | | only works because we have -Isys on the command line. We also have -Isys/boot/userboot on the command line, so bring it in directly with <userboot.h>. No functional change, but it removes one hard to see dependency on the boot loader's location in sys/boot. Sponsored by: Netflix Notes: svn path=/head/; revision=325748
* Install the 4th files in sys/boot/forth instead of each loaderWarner Losh2017-11-102-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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
* loader: set options before including bsd.init.mkRoger Pau Monné2017-11-081-4/+4
| | | | | | | | | | | | | | | | | 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
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-312-4/+3
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* For amd64, compile both zfs and zfs32 libraries.Warner Losh2017-10-304-37/+2
| | | | | | | | | | | | 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
* We don't need to build a special ficl for userboot.Warner Losh2017-10-303-75/+1
| | | | | | | | | | | | | | | Prior to bringing efi into the system, amd64 systems were building 32-bit ficl only, while userboot required the 64-bit one. However, with efi, we now build both. userboot can and should use the one we build for the main tree (in fact, it has been for a while, though I didn't check to see if that was an intentional change before, or an accidental one in my cleanup). Eliminate the extra copy (and build time) for userboot. Sponsored by: Netflix Notes: svn path=/head/; revision=325173
* Use defs.mk values for userbootWarner Losh2017-10-304-22/+19
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325170
* 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-4/+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
* Kill the userboot copy of libstand.Warner Losh2017-10-124-26/+3
| | | | | | | | | | It's not needed (it's now identical to libsa, and seems to have been for some time). Sponsored by: Netflix Notes: svn path=/head/; revision=324552
* Move lib/libstand to sys/boot/libsaWarner Losh2017-10-121-7/+2
| | | | | | | | | | Move the sources to sys/boot. Make adjustments related to the move. Kill LIBSTAND_SRC since it's no longer needed. Sponsored by: Netflix Notes: svn path=/head/; revision=324551
* Rather than laying whack-a-mole with including the path to stand.h,Warner Losh2017-10-101-1/+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-094-3/+7
| | | | | | | | | | | | 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: F_READ/F_WRITE should be checked against masked flagToomas Soome2017-04-181-0/+1
| | | | | | | | | | | | | | | | | | The work to make it possible to avoid bcache via using F_NORA modifier did miss the fact that not all loader platforms are using the bcache, and so it is possible the modifier is not cleared, as bcache strategy function is not used. For fix, we make sure the checks are dont with masked flag. This patch does fix boot for platforms which do not use bcache. Reported by: emaste Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D10422 Notes: svn path=/head/; revision=317097
* loader: r316585 did miss userboot updateToomas Soome2017-04-092-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | The work to implement zfs reader to inspect all pool label copies did miss the userboot, this update does correct this issue. Since userboot is already using common/disk.c API (disk_open() etc), the fix is quite simple - we only need to make sure the userdisk_iocl() will call disk_ioctl(). In addition, the diskioctl callback does return int, not pointer. Note, the review request is actually addressing the sparc and userboot, but as testing the fix for sparc will take some more time, I am posting the userboot fix now. This patch is part of the implementation presented in review: https://reviews.freebsd.org/D10302 Once we have the sparc part tested, we will have the complete fix for the issue. Reviewed by: imp Notes: svn path=/head/; revision=316654
* loader: disk_cleanup was left in userboot_disk.cToomas Soome2017-03-201-1/+0
| | | | | | | | | | | | | | | In r315408, disk_cleanup was removed, which is called at sys/boot/userboot/userboot/userboot_disk.c:113. This causes bhyveload to fail. PR: 217935 Reported by: Fabian Freyer Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D10060 Notes: svn path=/head/; revision=315645
* loader: remove open_disk cacheToomas Soome2017-03-161-2/+2
| | | | | | | | | | | | | | | | | | As we provide the disk size verification and correction via disk_ioctl and disk state provided by disk_open(), we can not share the partition state in disk_devdesc structure. Also the sharing does make a lot of sense with ufs, as only one partition is open at any given time, but zfs pools do keep the disk devices open. To make sure we do get the correct information about the open device, just remove the cache. Reviewed by: allanjude, smh Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D9757 Notes: svn path=/head/; revision=315408
* Split the ficl CFLAGS when they refer to an arch-specific include path.Pedro F. Giffuni2017-03-011-1/+2
| | | | | | | | | | This is a minimal attempt to keep consistency in the Makefiles so that moving ficl to somwehere like contrib will be less error prone. MFC after: 1 week Notes: svn path=/head/; revision=314505
* sys: Replace zero with NULL for pointers.Pedro F. Giffuni2017-02-221-2/+2
| | | | | | | | | Found with: devel/coccinelle MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D9694 Notes: svn path=/head/; revision=314068
* dosfs support in libstand is broken since r298230Toomas Soome2016-12-302-9/+9
| | | | | | | | | | | | | | | | | | | | | | Apparently the libstand dosfs optimization is a bit too optimistic and did introduce possible memory corruption. This patch is backing out the bad part and since this results in dosfs reading full blocks now, we can also remove extra offset argument from dv_strategy callback. The analysis of the issue and the backout patch is provided by Mikhail Kupchik. PR: 214423 Submitted by: Mikhail Kupchik Reported by: Mikhail Kupchik Reviewed by: bapt, allanjude Approved by: allanjude (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8644 Notes: svn path=/head/; revision=310850
* Deduplicate loader vers.c Makefile rulesEd Maste2016-12-191-5/+0
| | | | | | | | | | | | | | 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-7/+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
* lsdev device name section headers should be printed by dv_print callback.Toomas Soome2016-11-192-0/+11
| | | | | | | | | | | | | | | | | | | lsdev command does walk over devsw list, prints list element name and will use dv_print() callback to print the device list. Unfortunately this approach will add unneeded noise when there are no particular devices detected. To remove "empty" device section headers, the dv_print() callback should print the header instead. In addition, fixed dv_print callback for md module. Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D8551 Notes: svn path=/head/; revision=308827
* Loader paged/pageable data is not always paged.Toomas Soome2016-11-082-10/+16
| | | | | | | | | | | | | | | | | | | This change does modify devsw dv_print() to return the int value, enabling walkers to interrupt the walk on non zero value from dv_print(). This will allow the pager_print actually to stop displaying data on user input, and additionally pager is used in various *dev_print callbacks, where it was missing. For test, lsdev [-v] command should display data by screenfuls and should stop when the key 'q' is pressed on pager prompt. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D5461 Notes: svn path=/head/; revision=308434
* Fix build WITHOUT_FORTHBaptiste Daroussin2016-10-141-1/+2
| | | | | | | | MFC after: 1 week Sponsored by: Gandi.net Notes: svn path=/head/; revision=307316
* Disable loop unrolling in skein for sys/bootAllan Jude2016-10-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | When tsoome@ added skein support to the ZFS boot code and zfsloader, it resulted in an explosion in code size, running close to a number of limits. The default for the C version of skein is to unroll all loops for skein-256 and 512 Disabling the loop unrolling saves 20-28kb from each binary boot1.efi gptzfsboot loader.efi userboot.so zfsloader Reviewed by: emaste, tsoome Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D7826 Notes: svn path=/head/; revision=306751
* Bug 212038 - svn commit: r304321 broken bhyve zvol VM bhyveload hang 100% WCPUToomas Soome2016-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | As the support for large blocks was enabled in loader zfs code, the heap in userboot was left not changed, resulting with failure of detecting and accessing zfs pools for bhyve virtual machines. This fix does set the heap to use same amount of memory as the zfsloader is using. To make it possible to test and verify loader functions, bhyve is providing very useful option, but it also means, we like to keep feature parity with [zfs]loader as close as possible. PR: 212038 Reported by: dfh0522@gmail.com Reviewed by: allanjude, grehan Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D7635 Notes: svn path=/head/; revision=304754
* Add SHA512, skein, large blocks support for loader zfs.Toomas Soome2016-08-183-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Updated sha512 from illumos. Using skein from freebsd crypto tree. Since loader itself is using 64MB memory for heap, updated zfsboot to use same, and this also allows to support zfs large blocks. Note, adding additional features does increate zfsboot code, therefore this update does increase zfsboot code to 128k, also I have ported gptldr.S update to zfsldr.S to support 64k+ code. With this update, boot1.efi has almost reached the current limit of the size set for it, so one of the future patches for boot1.efi will need to increase the limit. Currently known missing zfs features in boot loader are edonr and gzip support. Reviewed by: delphij, imp Approved by: imp (mentor) Obtained from: sha256.c update and skein_zfs.c stub from illumos. Differential Revision: https://reviews.freebsd.org/D7418 Notes: svn path=/head/; revision=304321
* Link bcache into userboot.so, was not added in r298230Allan Jude2016-04-191-0/+1
| | | | | | | | | This should help speed up bhyve boots too Reviewed by: olivier Notes: svn path=/head/; revision=298298
* A new implementation of the loader block cacheAllan Jude2016-04-183-8/+40
| | | | | | | | | | | | | | | | | | | | 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
* Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni2016-04-102-2/+2
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* Add more .NOMETA missed in r291320Bryan Drewery2016-03-111-1/+1
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296706
* userboot: use MK_CTF=no to disable CTFEd Maste2016-02-291-1/+1
| | | | | | | The NO_ form (e.g. NO_CTF) is deprecated. Notes: svn path=/head/; revision=296216
* Add vm_set_register() and vm_set_desc() callbacks. These callbacksMarcel Moolenaar2016-02-261-0/+15
| | | | | | | | | | | | | translate directly into calls to their namesake API functions in libvmmapi. It is an improvement over the existing setreg(), setmsr(), setcr() setgdt() and exec() callbacks in that the new additions give full control and don't assume we're booting FreeBSD, like exec() and don't assume one only wants to set the value of RSP, like setreg(). Notes: svn path=/head/; revision=296099
* Check that the userboot version is at least 3, rather thanMarcel Moolenaar2016-02-261-9/+10
| | | | | | | | | | | 3 exactly. The structure may be of a newer version and as long as it is backward compatible with 3, we can work with it. While here: whitespace nits. Notes: svn path=/head/; revision=296097
* DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-243-46/+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-27/+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
* Make it possible to specify the path to userboot.so with the -b flag.Juli Mallett2016-01-141-4/+8
| | | | | | | Reviewed by: neel Notes: svn path=/head/; revision=294047
* Only call init_zfs_bootenv() when the system was booted with ZFSAllan Jude2016-01-091-7/+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
* Update dependencies.Bryan Drewery2016-01-091-1/+0
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293451
* Reduce libstand Makefile duplicationEd Maste2016-01-081-129/+5
| | | | | | | | | | | | | | | | Userboot's copy of the libstand Makefile had more extensive changes compared to the one in sys/boot/libstand32, but it turns out these are not intentional and we can just include lib/libstand/Makefile as done for libstand32 in r293040. Reviewed by: imp, jhb Tested by: allanjude MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4793 Notes: svn path=/head/; revision=293435
* Add support for ZFS Boot Environments to userboot (for bhyve and others)Allan Jude2016-01-081-0/+55
| | | | | | | | | | | 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
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2016-01-071-1/+0
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293345
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2015-12-071-0/+1
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291972
* META MODE: Update dependencies with 'the-lot' and add missing directories.Bryan Drewery2015-12-015-0/+124
| | | | | | | | | | | | | | | | | 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
* Use CFLAGS_NO_SIMD in preference to varying lists of -mno-xxxx flags.Warner Losh2015-08-272-35/+2
| | | | | | | | | | | | Go ahead and defined -D_STANDALONE for all targets (only strictly needed for some architecture, but harmless on those it isn't required for). Also add -msoft-float to all architectures uniformly rather that higgley piggley like it is today. Differential Revision: https://reviews.freebsd.org/D3496 Notes: svn path=/head/; revision=287227
* userboot: enable bzipfs supportAndriy Gapon2015-06-031-1/+2
| | | | | | | | | | | Additionally, sort all real filesystems before the virtual ones. Differential Revision: https://reviews.freebsd.org/D2709 Reviewed by: grehan MFC after: 5 days Notes: svn path=/head/; revision=283939