path: root/stand
Commit message (Collapse)AuthorAgeFilesLines
* stand/efi: add modulep to kernel metadataRoger Pau Monné2021-02-161-3/+6
| | | | | | | | | | | | | | This mirrors the functionality of the BIOS amd64 bi_load function, that stashes the absolute address of the module metadata. This is required for booting as a Xen dom0 that does relocate the modulep and the loaded modules, and thus requires adjusting the offset. No functional change introduced, further patches will make use of this functionality for Xen dom0 loading. Sponsored by: Citrix Systems R&D Reviewed by: imp Differential revision: https://reviews.freebsd.org/D28496
* stand/efi: allow not exiting boot servicesRoger Pau Monné2021-02-166-14/+20
| | | | | | | | | | | | | | | | | | Xen requires that UEFI BootServices are enabled in order to boot, so introduce a new parameter to bi_load in order to select whether BS should be exited. No functional change introduced in this patch, as all current users of bi_load request BS to be exited. Further changes will make use of this functionality. Note the memory map is still appended to the kernel metadata, even when it could be modified by further calls to the Boot Services, as it will be used to detect if the kernel has been booted from UEFI. Sponsored by: Citrix Systems R&D Reviewed by: tsoome, imp Differential revision: https://reviews.freebsd.org/D28495
* pxeboot(8): remove antiquated informationGuangyuan Yang2021-02-151-16/+7
| | | | | | | | | | | | | While I was there: - Fix some typos - Fix an excessive argument "indent" reported by mandoc -Tlint - Replace a dead link with the one suggested by https://www.uefi.org/uefi Submitted by: linimon (in part) Reviewed by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27774
* loader_lua: consider userboot console as serialToomas Soome2021-02-141-1/+4
| | | | | | | | We use ascii box chars with serial console because we do not know if terminal can draw unixode box chars. Same problem is about userboot console. MFC after: 5 days
* loader: do not autoselect smaller font than 8x16 with high res displayToomas Soome2021-02-092-3/+21
| | | | | | | | | | The VT screen buffer size is calculated based on our default built in (8x16) font. With high-resolution display, we want to use at least 8x16 font, or we will have large unused areas on screen. MFC after: 1 week
* loader: remove BORDER_PIXELSToomas Soome2021-02-093-18/+11
| | | | | | | | BORDER_PIXELS is left over from picking up the source from illumos port. Since FreeBSD VT does not use border in terminal size calculation, there is no reason why should loader use it. MFC after: 1 week
* loader.efi: There are systems without ConOut, also use ConOutDevToomas Soome2021-02-041-0/+2
| | | | | | | | Conout does contian the default output device name. ConOutDev does contain all possible output device names, so we can use it as fallback, when there is no ConOut. PR: 253253
* stand/amd64: remove unused addr parameter from bi_load64Roger Pau Monné2021-02-014-10/+10
| | | | | | | | | | | All callers of bi_load64 pass 0 as the addr parameter, so just remove it and always calculate the last load address from the module chain. No functional change. Sponsored by: Citrix Systems R&D Reviewed by: tsoome, imp Differential revision: https://reviews.freebsd.org/D28412
* lualoader: position hyphens at the beginning of character classesKyle Evans2021-01-311-4/+4
| | | | | | | | | | | According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction between ranges and classes is not defined and hyphens must be specified at either the beginning or the end of a set if they are not escaped. Move all such occurrences to the beginning. Reported-by: _parv (twitter) MFC-after: 3 days
* userboot: provide stub gfx functionsToomas Soome2021-01-303-5/+80
| | | | | | | | Make sure we have needed functions present, to avoi getting undefined symbols error(s). PR: 253088 Reported by: John Kennedy
* stand: lua: enhance lfs.dir() to speed up kernels_autodetectKyle Evans2021-01-291-2/+6
| | | | | | | | | | | | | | | | This eliminates a lot of stat() calls that happen when lualoader renders the menu with the default settings, and greatly speeds up rendering on my laptop. ftype is nil if loader/loader.efi hasn't been updated yet, falling back to lfs.attributes() to test. This is technically incompatible with lfs, but not in a particularly terrible way. Reviewed-by: cem MFC-after: 4 days Differential Revision: https://reviews.freebsd.org/D27542
* stand/multiboot: adjust the protocol between loader and kernelRoger Pau Monné2021-01-291-117/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a currently ad-hoc protocol to hand off the FreeBSD kernel payload between the loader and the kernel itself when Xen is in the middle of the picture. Such protocol wasn't very resilient to changes to the loader itself, because it relied on moving metadata around to package it using a certain layout. This has proven to be fragile, so replace it with a more robust version. The new protocol requires using a xen_header structure that will be used to pass data between the FreeBSD loader and the FreeBSD kernel when booting in dom0 mode. At the moment the only data conveyed is the offset of the start of the module metadata relative to the start of the module itself. This is a slightly disruptive change since it also requires a change to the kernel which is contained in this patch. In order to update with this change the kernel must be updated before updating the loader, as described in the handbook. Note this is only required when booting a FreeBSD/Xen dom0. This change doesn't affect the normal FreeBSD boot protocol. This fixes booting FreeBSD/Xen in dom0 mode after 3630506b9daec9167a89bc4525638ea45a00769e. Sponsored by: Citrix Systems R&D MFC after: 3 days Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D28411
* Remove obsolete code gated on _ARM_ARCH_*Andrew Turner2021-01-281-2/+0
| | | | | | | This is all code only run on ARMv4 and ARMv5. Support for these have been dropped from FreeBSD. Differential Revision: https://reviews.freebsd.org/D28314
* loader: unload command should reset tg_kernel_supported in gfx_stateToomas Soome2021-01-281-0/+2
| | | | | | | | | While loading kernel, we check if vt/vbe backend support is included in kernel and set the tg_kernel_supported flag in gfx_state. unload command needs to reset this flag to allow next load to perform this check with new kernel. Reported by: jhb
* Fix loader detection of vbefb support on !amd64Dimitry Andric2021-01-271-2/+2
| | | | | | | | | | | | | | | | On i386, after 6c7a932d0b8baaaee16eca0ba061bfa6e0e57bfd, the vbefb vt driver was no longer detected by the loader, if any kernel module was loaded after the kernel itself. This was caused by the parse_vt_drv_set() function being called multiple times, resetting the detection flag. (It was called multiple times, becuase i386 .ko files are shared objects like the kernel proper, while this is not the case on amd64.) Fix this by skipping the set_vt_drv_set lookup if vbefb was already detected. Reviewed by: tsoome
* stand: ensure that the efi directory's dependencies are correctKyle Evans2021-01-271-0/+1
| | | | | | | | | | | | | | | | | | efi, like the various ${MACHINE} directories, should have a dependency on the enabled interpreters. The general rule here is that any top-level directory that has a program at any depth within that includes loader.mk should add ${INTERP_DEPENDS} added to its dependencies so that the appropriate ficl/lua bits are ready before they begin. Note that the only directories in-tree that require it but will not get it in a more appropriate manner are i386 (on amd64), efi, and userboot. i386 and userboot are handled explicitly in Makefile.amd64 where they are added to S.yes. Reported-by: bcran MFC-after: 3 days
* loader: start kernel in text mode when there is no vbefb vt driverToomas Soome2021-01-264-9/+74
| | | | | If kernel is built without VT vbefb driver, make sure we start kernel in text mode.
* lualoader: improve loader.conf var processingKyle Evans2021-01-241-22/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lualoader was previously not processing \ as escapes; this commit fixes that and does better error checking on the value as well. Additionally, loader.conf had some odd restrictions on values that make little sense. Previously, lines like: kernel=foo Would simply be discarded with a malformed line complaint you might not see unless you disable beastie. lualoader tries to process these as well as it can and manipulates the environment, while forthloader did minimal processing and constructed a `set` command to do the heavy lifting instead. The lua approach was re-envisioned from building a `set` command so that we can appropriately reset the environment when, for example, boot environments change. Lift the previous restrictions to allow unquoted values on the right hand side of an expression. Note that an unquoted value is effectively: [A-Za-z0-9-][A-Za-z0-9-_.]* This commit also stops trying to weirdly limit what it can handle in a quoted value. Previously it only allowed spaces, alphanumeric, and punctuation, which is kind of weird. Change it here to grab as much as it can between two sets of quotes, then let processEnvVar() do the needful and complain if it finds something malformed looking. My extremely sophisticated test suite is as follows: <<EOF X_01_simple_string="simple" X_02_escaped_string="s\imple" X_03_unquoted_val=3 X_04_unquoted_strval=simple_test X_05_subval="${X_03_unquoted_val}" X_06_escaped_subval="\${X_03_unquoted_val}" X_07_embedded="truth${X_03_unquoted_val}" X_08_escaped_embedded="truth\${X_03_unquoted_val}" X_09_unknown="${unknown_val}" X_10_unknown_embedded="truth${unknown_val}" X_11_crunchy="crunch$unknown_val crunch" X_12_crunchy="crunch${unknown_val}crunch" Y_01_badquote="te"lol" Y_02_eolesc="lol\" Y_02_noteolesc="lol\\" Y_03_eolvar="lol$" Y_03_noteolvar="lol\$" Y_04_badvar="lol${" exec="echo Done!" EOF Future work may provide a stub loader module in userland so that we can formally test the loader scripts rather than sketchy setups like the above in conjunction with the lua-* tools in ^/tools/boot.
* loader: create built in font from bold font faceToomas Soome2021-01-232-2/+2
| | | | | We did replace full version of default font 8x16v with bold, also use bold version for built in font.
* Reuse the amd64 loader relocation code on arm64Andrew Turner2021-01-201-13/+22
| | | | | | | | There is no need to keep multiple copies of the relocation code. The amd64 code works on arm64 with a few small changes to relocation types. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D28213
* loader: comment on rgb_to_color_index()Toomas Soome2021-01-191-1/+9
| | | | Add small comment block about rgb_to_color_index().
* loader: handle malloc failures in vbe_init, use consistent namingToomas Soome2021-01-191-16/+24
| | | | | | | | | | | | Handle malloc failures in vbe_init(). If it should so happen and we do get malloc failure in vbe_init(), use original mode list. Replace nitems with nentries to have naming consistency and avoid confusion with nitems() macro. Reported by: yuripv, rpokala
* loader: update gfx moduleToomas Soome2021-01-171-42/+76
| | | | | Update from illumos review process. Add more comments, drop memory buffer from blt functions.
* loader: Use TERM_EMU for arm and arm64Emmanuel Vadot2021-01-171-3/+0
| | | | | | | | | | Even if it didn't behave well previously this is fixed. Tested on: OrangePi One (armv7 u-boot) (serial only and serial + HDMI) Tested on: Pine64-LTS (aarch64 u-boot) (serial only and serial + HDMI) Tested on: Honeycomb (aarch64 EDK2) (serial only) Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D28153
* loader: Partial revert of 987eabdc2ae1Emmanuel Vadot2021-01-171-4/+1
| | | | | | | The arm relocation code doesn't not work and make loader not loading dependancies. Reported by: Dr. Rolf Jansen <freebsd-rj@obsigna.com>
* loader.efi: commands gop, uga and autoresize should use cached dataToomas Soome2021-01-171-30/+17
| | | | | We are setting up pointers for gop or uga protocol in efi_find_framebuffer(), reuse those pointers.
* loader.efi: variable 'hlist' is uninitializedToomas Soome2021-01-171-0/+1
| | | | framebuffer.c:481:65: error: variable 'hlist' is uninitialized
* loader.efi: unused variable 'mode'Toomas Soome2021-01-171-1/+0
| | | | | framebuffer.c:707:8: error: unused variable 'mode' [-Wunused-variable] u_int mode;
* loader.efi: handle multiple gop instancesToomas Soome2021-01-161-1/+36
| | | | | | | | Some systems may provide multiple GOP instances and not all are bound to hardware. The current loader is picking up the first GOP, which may not be usable. Instead we load the GOP handle array, and test every handle to have registered ConOut protocol. If ConOut is present, we can use this GOP handle to open GOP protocol.
* loader.efi: Use Blt with gop as defaultToomas Soome2021-01-161-2/+5
| | | | | System with FB address 0x4000000000 does not draw, Blt() is doing fine. I think, we can assume the Blt will usually work.
* loader: create local copy of mode list provided by vbeinfoblockToomas Soome2021-01-161-33/+49
| | | | | Apparently some systems do corrupt mode list memory area, so we need to use local copy instead.
* lualoader: use floor division to get correct typeKyle Evans2021-01-151-1/+1
| | | | | | | | | | | | | | | | | This fixes the positioning of the "Welcome to FreeBSD" heading, which was misplaced after the recent update to Lua 5.4. The issue was previously masked by a compatibility knob in Lua 5.3 that would cause float-tagged numbers to render faithfully without the decimal component. Lua 5.4 dropped that and ensures that it always prints a decimal component, even if it has to append a ".0" to the value. Standard division produces a "float", floor division (//) can be used to guarantee an integer. Floating point operations have been completely ripped out of the liblua compiled for the bootloader, so this is a nop. This is decidedly better than trying to hack out the float tag entirely. Reported-by: mjg, probably others MFC-after: 3 days
* loader: do not update palette in text mode (real fix)Toomas Soome2021-01-151-1/+1
| | | | | | Apparently palette update while in text mode, will cause some adapters to end up with blank display. Previous update had condition reversed.
* pkgfs_open: follow symlinksSimon J. Gerraty2021-01-151-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | Caller is not interested in symlinks follow them. Throw an error if too many links encountered. Reviewed by: stevek Sponsored by: Juniper Networks --This line, and those below, will be ignored-- > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > MFH: Ports tree branch name. Request approval for merge. > Relnotes: Set to 'yes' for mention in release notes. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization. > Empty fields above will be automatically removed. Change-Id: I4ef92ff256f503c620dc5bba79ed93b32cb2330d
* contrib/lua: update to 5.4.2Kyle Evans2021-01-141-136/+108
| | | | Merge commit '0ea45b9cd43ce1247eb3eee9bfd5cee3d19068e7' into main
* Revert "loader.efi: disable workaround for serial console on non-x86"Toomas Soome2021-01-131-4/+0
| | | | | | This patch is creating some issues, reverting it. This reverts commit 8b18395487506d3602205e5844e0b67ba0c0dc80.
* loader.efi: initial terminal size should base on UEFI terminal sizeToomas Soome2021-01-131-6/+6
| | | | | | We do select font based on desired terminal size, we do query UEFI terminal size with conout->QueryMode(), but by mistake, the fallback values are used.
* loader.efi: disable workaround for serial console on non-x86Toomas Soome2021-01-121-0/+4
| | | | | As efi console is drawn and with functional comconsole driver, we can use proper terminal emulator on efi framebuffer console.
* loader.efi: reworked framebuffer setupToomas Soome2021-01-126-63/+90
| | | | | | | | | | | | | | Pass gfx_state to efi_find_framebuffer(), so we can pick between GOP and UGA in efi_find_framebuffer(), also we can then set up struct gen_fb in gfx_state from efifb and isolate efi fb data processing into framebuffer.c. This change does allow us to clean up efi_cons_init() and reduce BS->LocateProtocol() calls. A little downside is that we now need to translate gen_fb back to efifb in bootinfo.c (for passing to kernel), and we need to add few -I options to CFLAGS.
* loader.efi: efifb_mask_from_pixfmt is missing PixelBltOnlyToomas Soome2021-01-111-0/+1
| | | | We are missing way to set RGB masks for BLT only framebuffer.
* loader: term_image_display() should test screen_bufferToomas Soome2021-01-102-0/+6
| | | | Make sure screen_buffer is not NULL.
* loader: really use bold font for vga text modeToomas Soome2021-01-072-1/+7
| | | | | 8x16v turns out to be too thin and hard to read, use bold font instead.
* stand: remove bogus dependency from libsa32Kyle Evans2021-01-071-2/+0
| | | | libsa32 is independent of libsa, they can build in parallel if needed.
* stand: avoid adding fdt SUBDIR_DEPEND if WITHOUT_FDT is setKyle Evans2021-01-071-0/+2
| | | | | | This unbreaks the efi build if WITHOUT_FDT is set. Reported by: peterj
* Fix dateMateusz Piotrowski2021-01-071-1/+1
| | | | | | It's 2021 already. Reported by: delphij
* loader: do not update palette in text modeToomas Soome2021-01-071-1/+1
| | | | | Apparently palette update while in text mode, will cause some adapters to end up with blank display.
* Fix a couple of typos and formatting issuesMateusz Piotrowski2021-01-061-6/+10
* loader: instead of hw.vga.textmode, use screen.textmodeToomas Soome2021-01-062-9/+31
| | | | | | | | | | | | | 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.
* loader: remove left over call to unsetenv()Toomas Soome2021-01-061-1/+0
| | | | We do not touch kern.vt.fb.default_mode.
* loader: rewrite vidc_install_fontToomas Soome2021-01-061-32/+34
| | | | | | | | | 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.