Commit Graph

1214 Commits

Author SHA1 Message Date
Mateusz Piotrowski
3efe9b3e77 Fix a couple of typos and formatting issues 2021-01-06 16:19:15 +01:00
Toomas Soome
babda0952f loader: instead of hw.vga.textmode, use screen.textmode
hw.vga.textmode is directing VT VGA backend to use text mode.

The default screen mode for BIOS loader is text, and default
screen mode for VT VGA backend is graphics (unless we are running on
hypervisor or hw.vga.textmode is set to 1). Using hw.vga.textmode
for loader does remove possibility to have graphical mode VT VGA with
text mode loader.

screen.textmode can have possible values "0" to disable text mode,
and "1" to set text mode.
2021-01-06 14:38:55 +02:00
Toomas Soome
31c2bcad7e loader: remove left over call to unsetenv()
We do not touch kern.vt.fb.default_mode.
2021-01-06 14:35:26 +02:00
Toomas Soome
99870c70ba loader: rewrite vidc_install_font
Instead of trying to set reasonable register values, save significant
register values, then prepare for font upload and then restore
registers from saved data.

This seems to fix text mode for most cases where text mode breakage
was reported.
2021-01-06 10:20:04 +02:00
Toomas Soome
58661b3ba9 loader: only use vidc_install_font() with vga controller
If the controller does not support VGA, we should not
touch VGA registers.
2021-01-05 00:49:18 +02:00
Toomas Soome
8c1dda1171 loader: vidc_load_palette() does not need arguments
Remove left over argument from vidc_load_palette.
2021-01-05 00:49:08 +02:00
Toomas Soome
b2a8d7a9b5 loader: fix powerpc build with gfx_fb
Need to add stub data and gfx functions to make linking happy.
2021-01-04 16:57:58 +00:00
Toomas Soome
e24d4e72c0 loader: fix mips build with gfx_fb
Need to add stub data and gfx functions to make linking happy.
2021-01-04 16:57:50 +00:00
Toomas Soome
4f9139397e loader: fix uboot build with gfx_fb
Need to add stub data and gfx functions to make linking happy.
2021-01-03 20:45:37 +02:00
Toomas Soome
a3479cfd22 loader: fix build on non-x86 platforms
Need to build pnglite with all.

Reported by: Herbert J. Skuhra
2021-01-03 00:04:56 +02:00
Toomas Soome
3630506b9d loader: implement framebuffer console
Draw console on efi.
Add vbe framebuffer for BIOS loader (vbe off, vbe on, vbe list,
vbe set xxx).
autoload font (/boot/fonts) based on resolution and font size.
Add command loadfont (set font by file) and
variable screen.font (set font by size). Pass loaded font to kernel.

Export variables:
screen.height
screen.width
screen.depth

Add gfx primitives to draw the screen and put png image on the screen.
Rework menu draw to iterate list of consoles to enamble device specific
output.

Probably something else I forgot...

Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27420
2021-01-02 21:41:36 +02:00
Eric van Gyzen
670d2ad820 efi loader: fix typos in a comment
...mostly because it's a harmless way to try the shiny new git repo.

Sponsored by:	Dell EMC Isilon
2021-01-01 11:38:39 -06:00
Kyle Evans
8b4c3a03f9 stand: fix WITHOUT_FORTH/WITHOUT_LOADER_LUA build
Previously having ficl/liblua in LIB32LIST with their respective option
turned OFF would be relatively harmless, as we wouldn't act on it unless we
were building the non-32 variant. As of ac5f382a9d, however, these are
now used for dependencies in some cases and must reflect what's actually
going to be built.
2021-01-01 00:22:48 -06:00
Kyle Evans
ac5f382a9d stand: properly declare subdir deps or .WAIT, do parallel build
buildworld already runs the stand build in parallel[1], so make it easier to
identify ordering issues by properly establishing dependencies or adding
.WAIT where needed.

Everything in stand/ relies on libsa, either directly or indirectly, because
libsa build is where the stand headers get installed and it gets linked in
most places.

Interpreters depend on their libs, machine dirs usually depend on top-level
libs that are getting built and at least one of the interpreter flavors.

For i386, order btx/libi386/libfirewire before everything else using a
big-ol-.WAIT hammer. btx is the most common dependency, but the others are
used sporadically. This seems to be where the race reporting on the mailing
list is- AFAICT, the following sequence is happening:

1.) One of the loaders gets built based on stale btx/btxldr
2.) btx/btxldr gets rebuilt
3.) installworld triggers loader rebuild because btx was rebuilt after

This seems like the most plausible explanation, as they've verified system
time and timestamps.

While we're here, let's switch stand/ over to a completely parallel build so
we can work out these kinds of issues in isolation rather than in the middle
of a larger build.

Reviewed by:	bdragon, sjg, tsoome
Tested by:	bdragon (-j1024, no failures, significant speed improvement)
Differential Revision:	https://reviews.freebsd.org/D23411
2020-12-31 11:15:45 -06:00
Kyle Evans
72cf7db3aa lualoader: add loader_conf_dirs support (loader.conf.d)
loader_conf_dirs is the supporting mechanism for the included
/boot/loader.conf.d directory.  When lualoader finishes processing all of
the loader_conf_files it finds after walking /boot/defaults/loader.conf,
it will now check any and all loader_conf_dirs and process files ending
in ".conf" as if they were a loader.conf.

Note that loader_conf_files may be specified in a loader.conf.d config
file, but loader_conf_dirs may *not*. It will only be processed as specified
in /boot/defaults/loader.conf and any loader_conf_files that were loaded
from there.

Reviewed by:	allanjude, freqlabs, rpokala, tsoome
Includes suggestion from:	imp
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D25608
2020-12-31 10:37:05 -06:00
Toomas Soome
2ae5841472 libsa: xdrproc_t should return bool
Since our xdr translation function are returning bool, so should
xdrproc_t.

Issue reported by gcc 10 build.
2020-12-27 23:25:18 +02:00
Kyle Evans
29842cb36e lualoader: fix lua-lint run
luacheck rightfully complains that i is unused in the show-module-options
loop at the end (it was used for some debugging in the process).

We've added a new pager module that's compiled in, so declare that as an
acceptable global.
2020-12-17 18:29:30 +00:00
Kyle Evans
7ed84fa14b lualoader: cli: provide a show-module-options loader command
This effectively dumps everything lualoader knows about to the console using
the libsa pager; that particular lua interface was added in r368591.

A pager stub implementation has been added that just dumps the output as-is
as a compat shim for older loader binaries that do not have lpager. This
stub should be moved into a more appropriate .lua file if we add anything
else that needs the pager.
2020-12-17 18:24:36 +00:00
Warner Losh
4d6047edb6 Drop EFI_STAGING_SIZE back down to 64M
vmware can't cope with anything larger than 64MB. Drop this back to
64MB everywhere but arm.

PR: 251866
MFC After: 1 week
2020-12-17 17:02:09 +00:00
Toomas Soome
d3eae37553 loader: allow loader to accept zfs feature com.delphix:bookmark_written
We do not need to actually read bookmarks, just whitelist this feature.

Reported by:	mjg
2020-12-15 22:37:03 +00:00
Toomas Soome
eba724f361 loader: allow loader to accept zfs feature com.datto:bookmark_v2
We do not need to actually read bookmarks, just whitelist this feature

Reported by:	jpaetzel
2020-12-15 21:48:35 +00:00
Jessica Clarke
f32672272f loader: Ignore the .interp section on RISC-V
Without this we risk having the .interp section be placed earlier in the
file and mess with section offsets; in particular it has been seen to be
placed at the start of the file and cause the PE/COFF header to not be
at address 0. This is the same fix as was done for arm64 in r365578.

Reviewed by:	mhorne, imp
Approved by:	mhorne, imp
Differential Revision:	https://reviews.freebsd.org/D27603
2020-12-14 00:54:05 +00:00
Jessica Clarke
c46f7610d4 loader: Print autoboot countdown immediately, not at 9
For the first second otime and ntime are equal so no message gets
printed. Instead we should print the countdown right from the start,
although we do it at the end of the first iteration so that if a key has
already been pressed then the message is suppressed.

Reviewed by:	imp
Approved by:	imp
Differential Revision:	https://reviews.freebsd.org/D26935
2020-12-14 00:46:24 +00:00
Kyle Evans
0a0d522b36 stand: liblua: add a pager module
This is nearly a 1:1 mapping of the pager API from libsa.  The only real
difference is that pager.output() will accept any number of arguments and
coerce all of them to strings for output using luaL_tolstring (i.e. the
__tostring metamethod will be used).

The only consumer planned at this time is the upcoming "show-module-options"
implementation.

MFC after:	1 week
2020-12-12 21:25:38 +00:00
Kyle Evans
10aeb6cdab lualoader: config: fix module enabled check
A last minute rewrite left this logically wrong; if it's present in
modules_blacklist, then we do not load it.
2020-12-12 14:53:34 +00:00
Kyle Evans
4634bb1f40 lualoader: provide module-manipulation commands
Specifically, we have:
- enable-module
- disable-module
- toggle-module

These can be used to add/remove modules to be loaded or force modules to be
loaded in spite of modules_blacklist. In the typical case, a user is
expected to use them to recover an issue happening due to a module directive
they've added to their loader.conf or because they discover that they've
under-specified what to load.

MFC after:	1 week
2020-12-12 05:57:42 +00:00
Hans Petter Selasky
eb2f5fa4dc Properly define the bool type in the BSD kernel shim.
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-07 16:08:31 +00:00
Toomas Soome
9de6a13e0f loader: xdr_array is missing count
The integer arrays are encoded in nvlist as counted array <count, i0, i1...>,
loader xdr_array() is missing the count. This will affect the pool import when
there are hole devices in pool.

Also fix the new data add and print functions.
2020-12-07 11:25:18 +00:00
Hans Petter Selasky
cc7b5411e6 Add missing busdma prototypes for load and unload and implement dummy sync
function for kernel bootloader shim code.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-07 10:51:19 +00:00
Hans Petter Selasky
34602358c0 Tidy up code a bit. Add missing section comments.
No functional change.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-07 10:21:01 +00:00
Conrad Meyer
78599c32ef Add CFI start/end proc directives to arm64, i386, and ppc
Follow-up to r353959 and r368070: do the same for other architectures.

arm32 already seems to use its own .fnstart/.fnend directives, which
appear to be ARM-specific variants of the same thing.  Likewise, MIPS
uses .frame directives.

Reviewed by:	arichardson
Differential Revision:	https://reviews.freebsd.org/D27387
2020-12-05 00:33:28 +00:00
Hans Petter Selasky
abbf48c558 Fix mis-spelled macro in the kernel shim.
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-04 16:51:59 +00:00
Hans Petter Selasky
454f1fdec1 Add more macros, types and prototypes for building kernel code into bootloaders.
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-04 14:52:41 +00:00
Hans Petter Selasky
1784a6d64a Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel
shim code in line with the rest of the kernel, sys/x86/include/_types.h.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-04 14:50:55 +00:00
Toomas Soome
cd56ababd3 ficl: make dump a bit friendlier
would be nice to have dump to output hex and ascii.
2020-12-01 23:07:05 +00:00
Toomas Soome
dba7640e44 ficl: instead of pad, emit can use local variable
Pad in forth is used as "scratchpad" and internal implementations
should not use it. Ficl does not really follow this rule and this can fire back.
emit has no need to use pad, we can use local variable instead.
2020-12-01 22:28:02 +00:00
Maxim Sobolev
fd2ef8ef5a Unobfuscate "KERNLOAD" parameter on amd64. This change lines-up amd64 with the
i386 and the rest of supported architectures by defining KERNLOAD in the
vmparam.h and getting rid of magic constant in the linker script, which albeit
documented via comment but isn't programmatically accessible at a compile time.

Use KERNLOAD to eliminate another (matching) magic constant 100 lines down
inside unremarkable TU "copy.c" 3 levels deep in the EFI loader tree.

Reviewed by:	markj
Approved by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D27355
2020-11-25 23:19:01 +00:00
Hans Petter Selasky
a2dd1caade Fix build of USB bootloader code by adding checks for _STANDALONE being defined.
Currently the USB bootloader code is not part of buildworld.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-18 13:22:22 +00:00
Toomas Soome
fc7cf7241f zfsboot: add prototype for main()
Some compilers are complaining about missing prototype.

PR:		251150
Reported by:	markiyan.kushnir@gmail.com
2020-11-15 14:04:27 +00:00
Toomas Soome
3e9f0f1d29 loader: cstyle cleanup of console.c
cstyle cleanup only, no functional changes intended.
2020-11-14 10:56:40 +00:00
Toomas Soome
83a252c6a1 loader: cstyle cleanup of bootstrap.h did miss a bit
correct small issues - misplaced comment and typos.
2020-11-08 09:49:51 +00:00
Toomas Soome
90b307a897 loader: cstyle cleanup of bootstrap.h
No functional changes intended.
2020-11-08 09:35:41 +00:00
Warner Losh
1ef64e3da5 loader: add aarch64 support for zstd
We don't have NEON available in the boot loader, so we have to disable
it. OpenZFS included ZSTD which used the wrong symbol to bring in neon
support. Change to use the code that's been submitted upstream as a
pull request to both.

__ARM_NEON is the proper symbol, defined in ARM C Language Extensions
Release 2.1 (https://developer.arm.com/documentation/ihi0053/d/). Some
sources suggest __ARM_NEON__, but that's the obsolete spelling from
prior versions of the standard.

OpenZFS Pull Request: https://github.com/openzfs/zfs/pull/11055
ZSTD Pull Request: https://github.com/facebook/zstd/pull/2356
2020-10-28 21:18:04 +00:00
Toomas Soome
e416eecbb9 loader: revert r342161 and r342151
We are using asize property from pool label and we do not depend
on partition data to find last two pool labels and to validate LBA for disk IO.

This does allow us to re-enable support for partitionless disk setups.
2020-10-22 20:02:02 +00:00
Michal Meloun
5b5438c6f3 Add 'netserver' command to EFI loader.
In some environments is difficult to access bootp/dhcp
configuration as "standard user". Add a command that allows to set
or display the URI of the network server used as "net:" device.
Currently only tftp and nfs protocols are supported.

Typical usage pattern is:
netserver tftp://192.168.168.1/path_to_obj_dir/arm.armv7/sys/GENERIC/
boot net:kernel

Reviewed by:	imp, kevans
MFC after:	4 weeks
Differential Revision: https://reviews.freebsd.org/D26736
2020-10-14 13:13:14 +00:00
Andrew Turner
b9aa4537b2 Use adrp in the arm64 efi loader
On startup the arm64 efi loaders need to know PC-relative addresses.
Previously we used the adr instruction to find this address, however this
instruction is limited to +/- 1MiB.

Switch to adrp to find the 4k page the address is within and an add to
set the bottom 12 bits. This lets us address +/- 4GiB which should be
large enough for now.

Reported by:	imp
MFC after:	2 weeks
Sponsored by:	Innovate UK
2020-10-13 16:51:05 +00:00
Warner Losh
e694696956 Force __BMI__ experimental instructions off.
The OpenZFS code that uses the BMI instructions is broken. Forcibly
disable them to prevent their use. When enabled, the build breaks.
This fixes the build when compiled for a core with BMI instructions.
This is the same fix committed in r364777, for the same issue.

Submitted by: Jung-uk Kim
2020-10-13 04:37:57 +00:00
Warner Losh
df13933e33 Add back org.freebsd:zstd_compress to features_for_read
This list is the of features that are allowed on the whole pool,
not the list of features that are implemented.
2020-10-13 03:49:12 +00:00
Warner Losh
9257c69b1c Turn off zstd on aarch64
loader support for zstd and zfs doesn't work for aarch64. Disable it
to unbreak the build.
2020-10-13 02:36:16 +00:00
Warner Losh
2fec3ae896 Add zstd support to the boot loader.
Add support to the _STANDALONE environment enough bits of the kernel
that we can compile it. We still have a small zstd_shim.c since there
were 3 items that were a bit hard to nail down and may be cleaned up
in the future. These go hand in hand with a number of commits to
sys/sys in the past weeks, should this need be MFCd.

Discussed with: mmacy (in review and on IRC/Slack)
Reviewed by: freqlabs (on openzfs repo)
Differential Revision: https://reviews.freebsd.org/D26218
2020-10-12 22:19:07 +00:00