aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/common
Commit message (Collapse)AuthorAgeFilesLines
...
* The file_loadraw function grew an argument, update install functionStephen J. Kiernan2016-11-111-1/+1
| | | | | | | | | | | | | accordingly. Reviewed by: imp Approved by: sjg (mentor) MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D8494 Notes: svn path=/head/; revision=308534
* Loader paged/pageable data is not always paged.Toomas Soome2016-11-085-16/+27
| | | | | | | | | | | | | | | | | | | 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
* Add full softfloat and hardfloat support for MIPS.Ruslan Bukin2016-10-311-1/+1
| | | | | | | | | | | | | | This adds new target architectures for hardfloat: mipselhf mipshf mips64elhf mips64hf. Tested in QEMU only. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D8376 Notes: svn path=/head/; revision=308130
* Really make WITHOUT_FORTH (MK_FORTH==no) work. The recent inclusion ofWarner Losh2016-10-252-0/+5
| | | | | | | | | | | | | | | 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
* Create a new linker set, Xficl_compile_set which contains a list ofWarner Losh2016-10-142-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | functions to call at the appropriate time to register new forth words. In the past we've done this with ifdef soup, but now if the file is included in the build, we'll get the new forth words. Use this new functionality to move the pci bios stuff out of loader.c by moving it to biospci.c. Move the pnp functionality to common/pnp.c. Move the inb/outb forth words to the i386 sysdep.c file where their implementation is defined. Adjust the efi linker scripts and build machinery to cope. his should be an invisible change to forth scripts and user experience. Differential Revision: https://reviews.freebsd.org/D8145 Notes: svn path=/head/; revision=307324
* Remove fetching of pInterp. Currently, there's no actual effect otherWarner Losh2016-10-141-6/+0
| | | | | | | | | | | | | | than to store the location of a forth word that is subsequently never used. It was last used before the 2.03 ficl upgrade in r51786. It was only used from r43614 (so Feb-Sept 1999) on head and in the 3.x branch (merged r43715 3.1 -> EOL). Remove it since nobody cared enough to report the bug in the last 18 years rather than fix it. It's need seems to have passed in the 2.03 ficl update. Differential Revision: https://reviews.freebsd.org/D8150 Notes: svn path=/head/; revision=307323
* The file /boot/boot.conf existed for the 3.0 release (r38764). It wasWarner Losh2016-10-142-9/+2
| | | | | | | | | | | | replaced by /boot/loader.rc for 3.1 (r42682). In May 2000, this was documented as deprecated (r61942) (between FreeBSD 4.0 and 4.1). Remove it since it's not been the preferred method in 17 years and has been deprecated for 16. Differential Revision: https://reviews.freebsd.org/D8142 Notes: svn path=/head/; revision=307322
* Stop closing the network device when netbooting for loaders using the commonBaptiste Daroussin2016-10-131-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | dev_net.c code. The NETIF_OPEN_CLOSE_ONCE flag was added in r201932 to prevent that behaviour on some architectures (sparc64 and powerpc64) the default was left to always open and close the device for each open and close of a file by the loader because it was necessary for u-boot on arm. Since it has been added, the flag was turned on for every arches including the u-boot loader for arm. This also fixes netbooting on RPi3 (tested by gonzo@) For the loader.efi it greatly speeds up netbooting Reviewed by: emaste, gonzo, tsoome Approved by: gonzo MFC after: 1 month Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D8230 Notes: svn path=/head/; revision=307238
* The bootloader self relocation code was slightly wrong for theAndrew Turner2016-10-071-4/+10
| | | | | | | | | | | | | | | | R_AARCH64_RELATIVE relocation found on arm64. It would try to add the contents of the memory location being relocated to the base address and the relocation addend. This worked when the contents was zero, however this now seems to be set to the value of the addend so we add this twice. Fix this by just setting the memory to the computed value. Reviewed by: emaste MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8177 Notes: svn path=/head/; revision=306812
* loader command interpreter should reset command_errmsgToomas Soome2016-09-271-3/+5
| | | | | | | | | | | | | | | | | | | | | The command interpreter does leave command_errmsg as is after printing its content, assuming the next command will reset it in bf_command(). However, in case the forth native word is defined as builtin, the bf_command is not used and forth words will also end up the command_errmsg content printed. Since command_errmsg is pointer to actual error message, which can be static read only string, we can not just set *command_errmsg = '\0', instead we need to reset the pointer itself. Illumos issue: https://www.illumos.org/issues/7405 Reported by: Igor Kozhukhov. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8032 Notes: svn path=/head/; revision=306380
* ufsread: Do not cast struct direct from void *Emmanuel Vadot2016-09-141-7/+7
| | | | | | | | | This cause alignment problem on ARM (and possibly other archs), instead copy it. MFC after: 1 week Notes: svn path=/head/; revision=305814
* Remove code that crept in r305125 by accidentBaptiste Daroussin2016-09-131-2/+2
| | | | | | | Reported by: tsoome Notes: svn path=/head/; revision=305769
* Netboot: allow both tftpfs and nfs in both pxeboot and loader.efiBaptiste Daroussin2016-08-311-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add tftpfs support for the EFI loaderBaptiste Daroussin2016-08-231-0/+5
| | | | | | | | | | Allow netbooting on efi without having to setup any NFS server by rebuilding the loader with LOADER_TFTP_SUPPORT like for the i386 pxeloader Sponsored by: Gandi.net Notes: svn path=/head/; revision=304677
* loader is filling fixed length command_errbuf with sprintf() and is trustingToomas Soome2016-08-206-34/+64
| | | | | | | | | | | | | | strings provided by user/config files. This update is replacing sprintf with snprintf for cases the command_errbuf is built from dynamic content. PR: 211958 Reported by: ecturt@gmail.com Reviewed by: imp, allanjude Approved by: imp (mentor), allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D7563 Notes: svn path=/head/; revision=304532
* Improve boot loader quote parsingAllan Jude2016-07-301-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | parse() is the boot loader's interp_parse.c is too naive about quotes both single and double quotes were allowed to be mixed, and single quotes did not follow the usual semantics (re variable expansion). The old code did not check for terminating quotes This update implements: * distinguishing single and double quote * variable expansion will not be done inside single quote protected area * will preserve inner quote for values like "value 'some list'" * ending quote check. this diff does not implement ending quote order check, it shouldn't be too hard, needs some improvements on parser state machine. PR: 204602 Submitted by: Toomas Soome <tsoome@me.com> Relnotes: yes Differential Revision: https://reviews.freebsd.org/D6000 Notes: svn path=/head/; revision=303556
* bcache should support reads shorter than sector sizeAllan Jude2016-07-301-1/+3
| | | | | | | | | | | | dosfs (fat file systems) can perform reads of partial sectors bcache should support such reads. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D6475 Notes: svn path=/head/; revision=303555
* Fix typo.Warner Losh2016-05-181-1/+1
| | | | | | | Spotted by: Matteo Riondato Notes: svn path=/head/; revision=300156
* Also add comment about the bug I comments in the forth.Warner Losh2016-05-181-0/+8
| | | | Notes: svn path=/head/; revision=300146
* Fix several instances where the boot loader ignored pager_outputWarner Losh2016-05-186-17/+30
| | | | | | | | | | return value when it could return 1 (indicating we should stop). Fix a few instances of pager_open() / pager_close() not being called. Actually use these routines for the environment variable printing code I just committed. Notes: svn path=/head/; revision=300117
* It sure would be nice to use printf with wide strings. Implement %S toWarner Losh2016-05-172-0/+6
| | | | | | | | | | do that. The C_WIDEOUT flag indicates that the console supports it. Mark the EFI console as supporting this. MFC After: 3 days Notes: svn path=/head/; revision=300056
* sys/boot/common: use of spaces vs. TAB.Pedro F. Giffuni2016-05-124-51/+51
| | | | | | | No functional change. Notes: svn path=/head/; revision=299499
* bcache read ahead may attempt to read past end of diskAllan Jude2016-05-011-8/+39
| | | | | | | | | | | | | The new bcache code does not know the size of the disk, and therefore may attempt to read past the end of the disk while trying to fill its read-ahead cache. This is usually not an issue, it fails gracefully on all of my machines, but some BIOSes seem to retry the reads for up to 30 seconds each, resulting in a long stall during boot Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: jhb, np Differential Revision: https://reviews.freebsd.org/D6109 Notes: svn path=/head/; revision=298900
* sys/boot: make use of the howmany() macro when available.Pedro F. Giffuni2016-04-261-5/+6
| | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298645
* sys: use our roundup2/rounddown2() macros when param.h is available.Pedro F. Giffuni2016-04-211-1/+1
| | | | | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted. Notes: svn path=/head/; revision=298433
* sys/boot: use our nitems() macro when it is available through param.h.Pedro F. Giffuni2016-04-191-1/+1
| | | | | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current Notes: svn path=/head/; revision=298309
* A new implementation of the loader block cacheAllan Jude2016-04-185-209/+283
| | | | | | | | | | | | | | | | | | | | 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-101-1/+1
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* Use the ABI-prescribed name for SHT_X86_64_UNWIND in the loader andKonstantin Belousov2016-04-081-1/+1
| | | | | | | | | kernel linker, after the r297686. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=297702
* If the dhcp server provided an interface-mtu option, transcribe the valueIan Lepore2016-03-211-0/+6
| | | | | | | | | | | to the boot.netif.mtu env var, which will be picked up by pre-existing code in nfs_mountroot() and used to configure the interface accordingly. This should bring the same functionality when the bootp/dhcp work is done by loader(8) as r297150 does for the in-kernel BOOTP case. Notes: svn path=/head/; revision=297151
* Implement GELI (AES-XTS and AES-CBC only) in gptboot and gptzfsbootAllan Jude2016-03-164-3/+4
| | | | | | | | | | | | 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
* Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,Dimitry Andric2016-03-061-0/+3
| | | | | | | | | | | | | | | | the boot loader should not skip over these anymore while loading images. Otherwise the kernel can still panic when it doesn't find the .eh_frame section belonging to the .rela.eh_frame section. Unfortunately this will require installing boot loaders from sys/boot before attempting to boot with a new kernel. Reviewed by: kib MFC after: 2 weeks X-MFC-With: r296419 Notes: svn path=/head/; revision=296428
* Fix ubldr build failure on mipsn32 and mipsn32el targets.Stanislav Galabov2016-03-041-1/+1
| | | | | | | Approved by: adrian (mentor) Notes: svn path=/head/; revision=296378
* Fix build failure introduced by r296182Stanislav Galabov2016-02-291-1/+0
| | | | | | | Approved by: adrian (mentor) Notes: svn path=/head/; revision=296186
* These changes attempt to put things in order before the introduction of MIPSStanislav Galabov2016-02-292-2/+3
| | | | | | | | | | | | | | | | | | ubldr. The changes are mostly dealing with removing unnecessary casts from the U-Boot API (we're passing only pointers, no obvious reason to cast them to uint32_t), cleaning up some compiler warnings and using the proper printf format specifiers in order to be able to compile cleanly for both 32-bit and 64-bit MIPS targets. Reviewed by: imp Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5312 Notes: svn path=/head/; revision=296182
* Don't set the offset when loading the kernel on the arm loader.efi. TheAndrew Turner2016-02-091-1/+6
| | | | | | | | | | | copyin and copyout code handle virtual addresses such that they will take a virtual address and convert it into a valid physical address. It may also mean we fail to boot as the elf files load address could be 0. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=295429
* Fix EFI platform build failuresSteven Hartland2016-02-061-1/+1
| | | | | | | | | | | | | | With warnings now enabled some plaforms where failing due to warnings. * Fix st_size printed as a size_t when its actually an off_t. * Fix pointer conversion in load_elf for some 32bit platforms due to 64bit off in ef. MFC after: 2 days X-MFC-With: Sponsored by: Multiplay Notes: svn path=/head/; revision=295356
* Fix mistake when transitioning to the new defines with ZFS loader. IWarner Losh2016-01-271-1/+1
| | | | | | | | | | | hate adding yet another define, but it is the lessor of the evil choices available. Kill another evil by removing PATH_BOOT3 and replacing it with PATH_LOADER or PATH_LOADER_ZFS as appropriate. PR: 206659 Notes: svn path=/head/; revision=294925
* RBX_ defines are in rbx.h, move it there.Warner Losh2016-01-261-0/+61
| | | | | | | Differential Revision: https://reviews.freebsd.org/D5038 Notes: svn path=/head/; revision=294766
* Move all the separate copies of the same strings into paths.h. There'sWarner Losh2016-01-261-0/+39
| | | | | | | | | nothing machine specific about these. Differential Revision: https://reviews.freebsd.org/D5038 Notes: svn path=/head/; revision=294765
* Prevent loader.conf load failure due to unknown console entriesSteven Hartland2016-01-211-27/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When processing loader.conf if console contained an entry for an unsupported console then cons_set would return an error refusing to set any console. This has two side effects: 1. Forth would throw a syntax error and stop processing loader.conf at that point. 2. The value of console is ignored. #1 Means other important loader.conf entries may not be processed, which is clearly undesirable. #2 Means the users preference for console aren't applied even if they did contain valid options. Now we have support for multi boot paths from a single image e.g. bios and efi mode the console preference needs to deal with the need to set preference for more than one source. Fix this by: * Returning CMD_OK where possible from cons_set. * Allowing set with at least one valid console to proceed. Reviewed by: allanjude MFC after: 1 week Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D5018 Notes: svn path=/head/; revision=294506
* Fix EFI UFS cachingSteven Hartland2016-01-211-7/+23
| | | | | | | | | | | | | | | | | | | | | | EFI was mixing caching in two separate places causing issues when multiple partitions where tested. Eliminate this by removing fsstat and re-factoring fsread into fsread_size, adding basic parameter validation. Also: * Enhance some error print outs. * Fix compilation under UFS1_ONLY and UFS2_ONLY * Use sizeof on vars instead of structs. * Add basic parameter validation to fsread_size. MFC after: 1 week X-MFC-With: r293268 Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D4989 Notes: svn path=/head/; revision=294493
* Ensure boot fsread correctly probes all partitionsSteven Hartland2016-01-151-1/+8
| | | | | | | | | | | | | | | | | The boot code fsread was caching the result of meta data request and reusing it even for calls with inode = 0, which is used to partitions trigger a probe. The result was that success was incorrectly returned for all partition probes after the first valid success, even for partitions which are not UFS. MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay Notes: svn path=/head/; revision=294059
* Make common boot file_loadraw name parameter constSteven Hartland2016-01-152-8/+7
| | | | | | | | | | | | | Fix compiler warnings about dropping const qualifier by changing file_loadraw name param to const, and updating method to make that the case (it was abusing the variable). MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay Notes: svn path=/head/; revision=294058
* Improve non-interactive forth cmd error reportingSteven Hartland2016-01-133-11/+37
| | | | | | | | | | | | | | | | | | | | | | Non-interactive forth command errors where silent even for critical issues e.g. failing to load a required kernel module or mfs_root. This resulted in later unexplained and hard to trace errors such as mount root failures. This introduces additional command return codes that are treated appropriately by the non-interactive command processor (bf_command). * CMD_CRIT = print error * CMD_FATAL = panic Also fix minor style(9) issues with command_load return codes. MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay Notes: svn path=/head/; revision=293835
* Enable warnings in EFI boot codeSteven Hartland2016-01-127-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set WARNS if not set for EFI boot code and fix the issues highlighted by setting it. Most components are set to WARNS level 6 with few being left at lower levels due to the amount of changes needed to fix at higher levels. Error types fixed: * Missing / invalid casts * Missing inner structs * Unused vars * Missing static for internal only funcs * Missing prototypes * Alignment changes * Use of uninitialised vars * Unknown pragma (intrinsic) * Missing types etc due to missing includes * printf formatting types Reviewed by: emaste (in part) MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D4839 Notes: svn path=/head/; revision=293724
* Remove hidden "Not ufs" printfs from boot codeSteven Hartland2016-01-091-1/+0
| | | | | | | | | | | | Remove the printf("Not ufs\n") from the boot code which was hidden by the local printf implementations, allowing these to have that code removed too. MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay Notes: svn path=/head/; revision=293461
* Make detection of GPT a bit more reliable.Andrey V. Elsukov2015-12-101-1/+6
| | | | | | | | | | | | | When we are detecting a partition table and didn't find PMBR, try to read backup GPT header from the last sector and if it is correct, assume that we have GPT. Reviewed by: rpokala MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D4282 Notes: svn path=/head/; revision=292057
* 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
* Implement simple ops for umass_diskZbigniew Bodek2015-11-272-0/+46
| | | | | | | | | | | | | | | The initial IOCTL implementation supports reading disk physical geometry. Two additional functions were added. They allow reading/writing raw data to the disk (default partition). Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4143 Notes: svn path=/head/; revision=291402