aboutsummaryrefslogtreecommitdiff
path: root/stand/common
Commit message (Collapse)AuthorAgeFilesLines
* loader: rename gfx_interp_md to gfx_interp_refWarner Losh2024-02-243-3/+3
| | | | | | | | | We have the call to gfx_interp_ref to bring in the .o so that we get the linker set item to add the language bindings at the right time. Where we call it is not the right time... So the _ref name is better. Change it before we have too many others like it. Sponsored by: Netflix
* loader: These files have no copyrightable materialWarner Losh2024-02-224-0/+8
| | | | | | | These files have no copyrightable material, and so are in the public domain. Sponsored by: Netflix
* libsa: Remove redundant sys/cdefs.hWarner Losh2024-02-2225-31/+0
| | | | Sponsored by: Netflix
* loader: Retire CTASSERTWarner Losh2024-02-211-4/+0
| | | | | | | | | The project is moving away from CTASSERT in favor of _Static_assert. Cleanup the few instances in the loader proactively. Sponsored by: Netflix Reviewed by: manu, tsoome Differential Revision: https://reviews.freebsd.org/D44006
* loader: Move to using linker sets to bring in optional bitsWarner Losh2024-02-161-26/+3
| | | | | | | | | The graphics stuff is optional. When it is pulled into the system, we use a linker set to initialize the lua bindings for it now. Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D43906
* loader: Remove gfx_fb_stub.c, it's no longer neededWarner Losh2024-02-161-76/+0
| | | | | | | | | | Now that we draw in the gfx bindings for all our interpreters only when graphics support is compiled in, we can eliminate this from all the loaders that don't have graphics support. Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D43905
* loader: Only create gfx 4th bindings when gfx is availableWarner Losh2024-02-161-0/+1
| | | | | | | | | | | | Only create the gfx bindings for 4th when it's compiled into the loader. We do this with a linker set that only gets brought in to those loaders that call gfx_framework_init. This calls gfx_interp_md() will will drag in gfx_loader.c which will add to the linker set that registers these bindings. Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D43904
* loader: Add prototype for gfx_interp_mdWarner Losh2024-02-162-0/+10
| | | | | | | | | | This function will be used to draw in the graphics bindings when the loader is compiled with graphics (gfx) support. Provide definitions for lua and the simple interpreter. 4th support is forthcoming. Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D43903
* loader: Create new gfx tableWarner Losh2024-02-161-0/+27
| | | | | | | | | | Create a new gfx global table. Put into it all the graphics bindings that we have in loader today. For now, have compatability binding for loader. Remove them from loader. Sponsored by: Netflix Reviewed by: kevans, jhb Differential Revision: https://reviews.freebsd.org/D43902
* loader: Fetch initial script from loader_lua envWarner Losh2024-02-141-1/+3
| | | | | | | | | Sometimes it is nice to override the initial script that we run. Make it possible by fetching loader_lua from the env and using that instead of the default if prsent. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D43819
* libsecureboot do not report expected unverified filesSimon J. Gerraty2024-02-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default only report unverified files at severity VE_WANT and above. This inlcudes *.conf but not *.hints, *.cookie or *.tgz which get VE_TRY as their severity. If Verbose is set to 0, then VerifyFlags should default to 0 too. Thus the combination of module_verbose=0 VE_VEBOSE=0 is sufficient to make the loader almost totally silent. When verify_prep has to find_manifest and it is verified ok return VE_NOT_CHECKED to verify_file so that it can skip repeating verify_fd Also add better debugging output for is_verified and add_verify_status. vectx handle compressed modules When verifying a compressed module (.ko.gz or .ko.bz2) stat() reports the size as -1 (unknown). vectx_lseek needs to spot this during closing - and just read until EOF is hit. Note: because of the way libsa's open() works, verify_prep will see the path to be verified as module.ko not module.ko.bz2 etc. This is actually ok, because we need a separate module.ko.bz2 entry so that the package can be verified, and the hash for module.ko is of the uncompressed file which is what vectx will see. Re-work local.trust.mk so site.trust.mk need only set VE_SIGN_URL_LIST (if using the mentioned signing server) interp.c: restrict interactive input Apply the same restrictions to interactive input as for unverified conf and hints files. Use version.veriexec when LOADER_VERIEXEC is yes Reviewed by: kevans Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D43810
* loader: Move build_font_module to gfx_fb.cWarner Losh2024-02-022-87/+89
| | | | | | | The font module is part and parsel of the gfx_fb support. Move it to gfx_fb.c where it can access the data it needs. Sponsored by: Netflix
* stand: Use modern function definitionsWarner Losh2024-01-281-1/+1
| | | | | | Use modern function definitions for functions with no args. Sponsored by: Netflix
* Stop #defining FREEBSD_ELFJohn Baldwin2023-12-123-3/+0
| | | | | | | | | | | | This was originally used (along with FREEBSD_AOUT) to prefer the use of ELF in various tools instead of a.out as part of the a.out to ELF transition in the 3.x days. The last use of it was removed from <link.h> in commit 66422f5b7a1a6055f0b2358268eb902aab6e2e3e back in 2002, but various files still #define it. Reviewed by: kevans, imp, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42964
* stand: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2711-11/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* stand: Remove ancient SCCS tags.Warner Losh2023-11-271-2/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-163-3/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1636-72/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1610-20/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* base: Remove support for the VTOC8 partitioning schemeMarius Strobl2023-07-262-101/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The removal of the sparc64 support in February 2020 obsoleted the VTOC8 partitioning scheme as no other FreeBSD platform makes use of it. Moreover, the code is bitrotting as nothing defines e. g. LOADER_VTOC8_SUPPORT any more and, thus, should go now, too. With this change, the following commits are reverted as far as VTOC8 is concerned and parts haven't already previously been deleted along with prior sparc64 removals: 094fcb157d4c98211899cf09d06e2cf19149b7e0 a7d366e9589c95feda6f3bc78c59c6355d51f126 ba8d50d08b9df4e8213f9a6997ff6792ecebcd9b The alignment example d9711c28efc4ec89ba5ea11f8fd63e9d0a7fc81b added to the VTOC8 section of gpart.8 is folded into the MBR one. This should finally conclude the deorbit of sparc64-specific bits. We had joy, we had fun we ran Unix on a Sun. But that source and the song of FreeBSD have all gone. Credits to Michael Bueker for the original "Unix on a Sun" and Rod McKuen for the "Seasons in the Sun" lyrics.
* stand: Make non-matching console names OKerWarner Losh2023-05-111-2/+2
| | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D39984
* stand: Fix warning about variable unusedWarner Losh2023-05-011-3/+9
| | | | | | | dflag is unused when LOADER_VERIEXEC isn't defined, so move it under the ifdef. Sponsored by: Netflix
* loader: Change version calculation to be more consistent.Stephen J. Kiernan2023-04-193-2/+2
| | | | | | | | | | | | Use 1000 * major + minor when calculating the version number that gets set in the Ficl environment or lua loader property. This allows for more room if the minor number needs to go above 9. Add loader.version property to lua loader. Reviewed by: imp Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D39631
* stand: fix buffer overflow in getrootmount()Robert Wing2023-02-251-4/+5
| | | | | | | Reviewed by: imp, allanjude Sponsored By: Beckhoff Automation GmbH & Co. KG Sponsored By: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38734
* loader: always install help filesMitchell Horne2023-02-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address two issues with current help file logic: The existing condition prevents the common help file from being installed when there are no additional help files defined. This results in no loader.help on EFI platforms, for example. Second, due to the fact that we build and install multiple loader types, each successive install will clobber the previous loader.help. The result is that we could lose type-specific commands, or possibly list them in loaders that do not have such commands. Instead, give each loader type a uniquely named help file. The EFI loader will look for /boot/loader.help.efi, userboot will look for /boot/loader.help.userboot, etc. The interpreter variant has no effect on which help file is loaded. This leaves the old /boot/loader.help unused. Some credit for the final approach goes to Mathieu <sigsys@gmail.com> for their version of the fix in https://reviews.freebsd.org/D22951. PR: 267134 Reported by: Daniel O'Connor <darius@dons.net.au> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28591
* kboot: Don't need an arch pointer to get segmentsWarner Losh2023-02-031-3/+0
| | | | | | | | | | There's no need for an arch pointer to get segments. We can call the routine directly since we don't need this code to be called from different context where a pointer is needed. Sponsored by: Netflix Reviewed by: kevans, andrew Differential Revision: https://reviews.freebsd.org/D38266
* stand: only compute symidx on x86Warner Losh2023-02-021-1/+8
| | | | | | | | | We only use symidx on x86, so only compute it on x86 to fix a set but not used warning on aarch64. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38246
* loader: md: Use default func for fmtdev and parsedevEmmanuel Vadot2023-01-271-2/+0
| | | | | | | | | | The default function are enough for md so use them instead of the disks ones that doesn't work for it anymore. Reviewed by: imp Sponsored by: Beckhoff Automation GmbH & Co. KG MFC after: now Differential Revision: https://reviews.freebsd.org/D38218
* stand: Separate base and cli parts of nvstoreWarner Losh2023-01-132-160/+3
| | | | | | | | | | | | | | | zfs lives in libsa. However, it depends on nvstore (and other things) that are in common. Fix part of this layering violation by splitting nvstore into a libsa piece (which is the base implementation) and keeping a much smaller common piece (to implement the nvstore command). This just leaves zfs' knowledge of device names that's specific to common and its calling platform specific init code to resolve. Add a nvstore.h file for these two parts to communicate private things and move the public nvstore api from bootstrap.h to stand.h. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D38043
* stand: create common set_currdevWarner Losh2023-01-112-0/+18
| | | | | | | | | | | | Pull together the nearly identical copies of set_currdev in i386, userboot and efi. Other boot loaders have variances that might be fine to use the common routine, or not. Since they are harder to test for me, and ofw and uboot do handle these setting differently, leave them be for now. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38005
* stand: Move dev_cleanup into libsaWarner Losh2023-01-112-13/+0
| | | | | | | | | | | | | | Since dev_cleanup() walks through all the devsw devices with dv_cleanup rotuines, move it into libsa rather than having it in 'common'. Logically, it operates only on things that are in libsa, and would never be different for different loaders: either people would call it as is, or they'd do the loop themselves with 'special' things inline between calls to cleanup (not that I think that will ever be needed though). Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38004
* stand: Create common gen_setcurrdev and replace codeWarner Losh2023-01-112-1/+18
| | | | | | | | | | Replace 4 identical copies of *_setcurrdev with gen_setcurrdev to avoid having to create a 5th copy. uboot_setcurrdev is actually different and needs to remain separate (even though it's quite similar). Sponsored by: Netflix Reviewed by: fuz@fuz.su, kevans Differential Revision: https://reviews.freebsd.org/D38003
* stand: update prototypes for md_load and md_load64Warner Losh2022-12-051-0/+3
| | | | | | | | | | | These are declared as extern in a number of files (some with the wrong return type). Centralize this in modinfo.h and remove a few extra stray declarations as well that are no longer used. No functional change. Note: I've not tried to cope with the bi_load() functions which are the same logical thing. These will be handled separately. Sponsored by: Netflix
* kboot: Add md_addr to metadataWarner Losh2022-12-042-1/+4
| | | | | | Save the address of where the metadata is loaded. Sponsored by: Netflix
* stand: parsedev API change: devspec now points to start of full device nameWarner Losh2022-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | To support more flexible device matching, we now pass in the full devspec to the parsedev routines. For everything execpt uboot, this is just a drop in (since everything except uboot and openfirmware always uses disk...: and/or zfs:, but openfirmware isn't really affected). uboot we kludge around it by subtracting 4 from where the rest of the device name starts. This is unforunate, and can compute the address one before the string. But we never dereference that address. uboot needs more work, and this is an acceptable UB until that other work happens. OFW doesn't really use the parsedev routines these days (since none of the supported device uses this... yet). It too needs more work, but it needs device matching support first. Sponsored by: Netflix Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D37553
* stand: For all disk drivers, connect dv_parsedev to disk_parsedevWarner Losh2022-11-302-0/+2
| | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37339
* stand: Change disk_parsedev() APIWarner Losh2022-11-302-2/+7
| | | | | | | | | | | Change the first argument to disk_parsedev() to be a pointer to a struct devdesc *. This now gets filled in with a malloc'd structure that's returned to the caller that the caller is repsonsible for freeing. Most places in the tree passed in a malloc'd pointer anyway, and this moves knowledge of disk_devdesc more firmly into the disk.[ch] code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37335
* stand: Remove unused enumWarner Losh2022-11-041-5/+0
| | | | | | | | enum disk_ioctl is unused. It's only ever defined. All of the stand code uses DIOCGSECTORSIZE and DIOCGMEDIASIZE instead, both to query and to implement ioctl. Sponsored by: Netflix
* stand: Nuke double-semicolonsElliott Mitchell2022-11-021-1/+1
| | | | | | | | | A distinct number of double-semicolons have ended up in FreeBSD. Take a pass at getting rid of many of these harmless typos. Reviewed by: emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/609 Differential Revision: https://reviews.freebsd.org/D31717
* geli: Move check for DEVT_DISK into geli_probe_and_attachWarner Losh2022-10-231-3/+1
| | | | | | | We only work on DEVT_DISK disks, so move that into the probe to drive the point home better. Sponsored by: Netflix
* loader: fix elf lookup_symbol type filteringKyle Evans2022-10-141-3/+2
| | | | | | | | | | | | | | | | | | The existing logic doesn't seem to make much sense, as we won't filter on the type if st_shndx != SHN_UNDEF. In practice, this breaks booting 12.3 kernels on newer loaders, as they do have a `kernphys` symbol of the wrong type (NOTYPE, rather than OBJECT) -- we end up deriving the wrong value for copy_staging. It's unclear if this version makes any more sense, but it seems to match what rtld's matched_symbol() does. Loader doesn't need to care about STT_FUNC w/ UND shndx, because we won't encounter those; in kmods, undefined (kernel) functions are NOTYPE. Reported by: Christian McDonald <cmcdonald netgate com> Reviewed by: imp, kib, tsoome MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D36975
* stand: fix mismergeWarner Losh2022-09-161-1/+0
| | | | | | | | Remove stray line from mismerge of 5d1531d9d4e7. This is no longer needed. Fixes: 5d1531d9d4e7 Sponsored by: Netflix
* stand/elf: Only support swapping headers on powerpc.Warner Losh2022-09-161-0/+16
| | | | | | | | | Powerpc is currently the only architecture that we support more than one endian. It's the only one that benefits from this swapping, so restrict the code to there. This saves about 1k in the i386 BIOS loader. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36577
* stand: collapse all copies of *copyenv into md_copyenvWarner Losh2022-09-163-28/+40
| | | | | | | | Use the efi's bi_copyenv to md_copyenv and place it in modinfo.c. Remove all other nearly identical and efi's has the best error handling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36574
* stand: Move MOD_xxx macros from modinfo.h to .cWarner Losh2022-09-162-64/+65
| | | | | | | | Now that MOD_xxx macros are modinfo.c, they don't need to be in modinfo.h. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36573
* stand: Move md_copymodules into modinfo.c and reduce copiesWarner Losh2022-09-163-43/+88
| | | | | | | | | | md_copymodules, bi_copymdoules, bi_copymodules32 (x2) and bi_copymodules64 (x2) are all the same routine... Replace them all with md_copymodules. This saves about 800 bytes on i386 BIOS loader, which is a nice bonus. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36572
* stand: Create common/modinfo.hWarner Losh2022-09-162-60/+73
| | | | | | | | | | Move all the MOD_xxx macros to this header. Each user of this interface is currently required to define MOD_ALIGNMENT(l). modinfo was selected because it sits inbetween modules and metadata and will make it easier to migrate to new, shared intefaces. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36571
* stand: Create MOD_ALIGN macro and use it everywhereWarner Losh2022-09-161-3/+4
| | | | | | | | To further reduce the differences between the different MOD_xxx macros, use MOD_ALIGN to do the proper alignment for the given use. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36570
* stand: Add interp_has_builtin_cmd to see if we have a commandWarner Losh2022-09-012-0/+10
| | | | | | | | interp_has_builtin_cmd() will try to lookup the passed in command and returns true if it was found, false otherwise. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36364
* stand: separate the command lookup from the command executionWarner Losh2022-09-011-12/+19
| | | | | | | | | Factor out interp_lookup_cmd to search for a command from interp_builtin_cmd. This simplifies the latter and can be used to expand lua to ask if a command exists. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36363