This line is no longer needed as fallback, and should have been deleted
in 7870a52598 instead of commented out, but 26 years later, I have a
high degree of confidence that old change was right and we won't need
this line as a fallback.
Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D45880
Load a splash screen that vt(4) can use if the "splash" env variable is defined.
For now only png is supported and decoding is done in loader and not in kernel
compared to splash screen support in sc(4).
For using this add:
boot_mute="YES"
splash="/boot/images/freebsd-logo-rev.png"
in loader.conf
Differential Revision: https://reviews.freebsd.org/D45932
Reviewed by: imp, tsoome
Sponsored by: Beckhoff Automation GmbH & Co. KG
The longest command we have is "efi-autoresizecons". That combined with
the two spaces before and after the command gives us a total of 23
characters including the null-terminator.
Also move the two trailing spaces to their own pager_output call so they
don't get truncated if the command is too long and increase the minimum
string length to 20 in order to fix alignment issues caused by the
increased buffer size.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1277
Assume you have loader configured to load linux64, which has a
dependency on both linux_common and mqueuefs but neither the kernel
nor kernel config in question have the mqueuefs module included.
When the load command for linux64 fails to find mqueuefs, it will
free both linux64 and linux_common as they were loaded first, but only
linux64 gets removed from the module list. As a result, future
traversals hit an easy use-after-free with linux_common.
Fix it so that we unlink the entire tail of the list. Anything after
the initially loaded module is, by definition, a dependency on the
loaded module while we're still in the load command, so we can just
discard the entire tail. If linux_common were loaded before linux64, it
should not move to a position during this load where it would suddenly
be missing from the view presented to the kernel.
Reported by: philip
Reviewed by: imp, philip, tsoome
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45731
Create interp_preinit() to initialize the scripting language to run
scripts. Make sure you can call it multiple times, but only the first
one has effect, After it's call, you can run scripts in the scripting
language. At the moment, no functional change.
Sponsored by: Netflix
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
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
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
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
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
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
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
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
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
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 66422f5b7a back in
2002, but various files still #define it.
Reviewed by: kevans, imp, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42964
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
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
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:
094fcb157da7d366e958ba8d50d08b
The alignment example d9711c28ef
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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