aboutsummaryrefslogtreecommitdiff
path: root/stand/lua
Commit message (Collapse)AuthorAgeFilesLines
* lualoader: add be-list and be-switch commandsKyle Evans2026-06-044-7/+83
| | | | | | | | | | | This is useful for driving BE changes from the loader command prompt, rather than having to use the menu. Note that the active carousel in the boot environment carousel doesn't currently reflect a switch in boot environments done this way- I'm considering this only a minor bug, as you probably can't or won't go back to the menu if you're using these commands. Reviewed by: imp (previous version)
* lualoader: allow the local module to filter out the BE listKyle Evans2026-04-082-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows something like the following local.lua to install a filter to implement its own notion of hidden BEs using a naming convention of a leading dot to hide them: -- file: /boot/lua/local.lua local core = require("core") local function be_hide(be) if core.isSingleUserBoot() then -- All BEs are accepted for single-user return true end local name = be:match("/([^/]+)$") if not name then -- Accept malformed BEs, for whatever reason return true end return name:match("^%.") == nil end if core.bootenvFilter then -- Just in case we need to be compatible with older versions of -- core.lua without the filtering functionality. core.bootenvFilter(be_hide) end -- EOF Requested by: Marek Zarychta Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D55359
* core.lua: follow symlinks when looking for bootable kernelsCraig Leres2026-03-091-1/+1
| | | | | | | PR: 293654 Reviewed by: kevans Approved by: kevans Differential Revision: https://reviews.freebsd.org/D55713
* lualoader: fix pruning of non-existent default kernelKyle Evans2026-01-071-0/+6
| | | | | | | | | | | | | | | Removing the kernel from the list of available kernels is sufficient to avoid rendering it in the list, but we need more for booting to actually work. Notably, the 'kernel' loader.conf var was left intact to its default value, so if one didn't use the kernel selector in the menu then we'd try to boot the nonexistent 'kernel' instead of the new default (first autodetected). There's room to improve the error messages here, but for now let's just make it actually work correctly. PR: 292232 Fixes: d04415c520b03 ("loader: lua: remove the default kernel [...]")
* stand/lua: Fix two typos in the manual pagesGordon Bergling2025-11-192-2/+2
| | | | | | | - s/Additionnaly/Additionally/ - s/commmand/command/ MFC after: 3 days
* cli.lua.8: Reflow literal commentsAlexander Ziaee2025-10-091-8/+10
| | | | | | | Reflow comments in literal text blocks so this manual is legible at MANWIDTH 78. MFC after: 1 day
* core.lua: Consistently check for single userWarner Losh2025-09-291-1/+1
| | | | | | | | While boot_single:lower() should always be in {yes,no}, it might not be. In one place we check == yes, and another ~= no. Make both places ~= no for consistency. We generally try to test != default. Sponsored by: Netflix
* loader: make disable-device more rebustWarner Losh2025-09-291-1/+9
| | | | | | | Check the number of arguments and ensure that the passed-in device to disable parses correctly. Sponsored by: Netflix
* stand: Remove support for FreeBSD 12.2 and earlierWarner Losh2025-09-291-12/+0
| | | | | | | | Remove 'pager' shim that was last not supported in FreeBSD 12.2, which went EOL on March 31, 2022. People have had enough time to upgrade the boot loader. Sponsored by: Netflix
* lualoader: Add distinct brand for installerJoseph Mingrone2025-06-242-0/+25
| | | | | | | | Make it obvious to users that the system is booting into the installer. Reviewed by: kevans, manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51001
* lualoader: adapt builtin brand/logo definitions as wellKyle Evans2025-06-181-31/+37
| | | | | | | | | | | | While these should be moved to the new format, it wasn't my intention to force them over immediately. Downstreams may embed their own brands in drawer.lua, and we shouldn't break them for something like this. Move adapt_fb_shim() up and use it for preloaded definitions to avoid forcing the matter for now. Perhaps in the future we'll start writing out warnings for those that do need adapted. Reported by: 0x1eef on IRC
* loader: Fix loader_brand = noneEmmanuel Vadot2025-06-171-1/+1
| | | | | | | | | | | Setting loader_brand to none in loader.conf now result in a lua error as we try to get a non-existant table Defines it Differential Revision: https://reviews.freebsd.org/D50875 Fixes: bef6d85b6de5 ("lualoader: allow graphical bits to be disabled with loader_gfx") Reviewed by: kevans, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG
* stand: lua: add a more productive commentKyle Evans2025-06-131-1/+3
| | | | | | | The global `shift` is a special little hack for shifting everything when the logo is gone, and we should explain that. Fixes: 33d3373faf30d ("stand: lua: convert orb to a new format [...]")
* stand: lua: convert orb to a new format that allows per-graphic shiftKyle Evans2025-06-133-51/+104
| | | | | | | | | | | | | | Previously, we had one shift that had to work for both the ASCII version and the image that we may draw if we have a framebuffer to play with. That makes it more difficult to get the positioning just right, so split them out into their own tables for convenience. While we're here, stop clipping off the bottom of the orb when the autoboot sequence is interrupted. There's plenty of space for it to move up a hair, so let's do that.. Reviewed by: imp, tsoome Differential Revision: https://reviews.freebsd.org/D50801
* lualoader: rename loop variable to cleanup luacheckKyle Evans2025-06-061-4/+4
| | | | | This shadows an `i` used for indexing earlier in the function, and we don't care that much about the name.
* lualoader: allow graphical bits to be disabled with loader_gfxKyle Evans2025-06-061-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Some people prefer the old ASCII art look and it's good to have a way to confirm that the fallbacks still work right on systems that have a functional framebuffer available. Add a loader_gfx loader.conf(5) variable to disable the eager use of graphics for these use-cases. While we're here, clean up the style in the area a little bit; the early porting that I did to lualoader did a lot of redundant ~= nil that has carried over into some of the later work. We can drop some of that, and also re-organize some of these variables to improve readability. ziaee notes that the positioning of the orb is a bit off; this is due to a change in positioning that happened in 1b4e1171315398dec ("loader: Fix orb position") to account for the image dimensions. This should be partially reverted to get it right; we shouldn't assume that we can use the same shift in gfx-* definitions for both the ASCII art and the associated image -- the {image, image_rl} pair should be converted to something more like an fbimg or gfx table that has the image, image width and a shift override to avoid messing up the ASCII positioning when disabled (or with no graphics available). Reviewed by: imp, manu, ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D50706
* loader: Fix beastie and fbsdbw logo positionsMarek Zarychta2025-05-293-1/+3
| | | | | | | | | | | Fix the beaste, beastiebw and fbsdbw postions broken after ee233742a569 PR: 285044, 286356 Fixes: 1b4e11713153 Reviewed by: imp MFC After: 2 days (14.3 candiate) Sponsored by: PANS Jarosław
* stand/lua manuals: Describe betterAlexander Ziaee2025-05-1212-23/+23
| | | | | | | | | | | | The lua boot loader module manuals were getting pulled into search results for FreeBSD, but not for "boot" or "loader". Reword them to increase clarity for boot or loader searches, as well as the FreeBSD search term which we've been scoping to system topic overview manuals. MFC after: 3 days Reviewed by: imp, mhorne Approved by: mhorne (mentor) Pull Request: https://github.com/freebsd/freebsd-src/pulls/1628
* loader: Add loader_menuEmmanuel Vadot2025-04-171-0/+8
| | | | | | | | | If set to 'none' then the menu isn't displayed. The 'brand' and 'logo' part are stil displayed. Differential Revision: https://reviews.freebsd.org/D49820 Reviewed by: imp, kevans Sponsored by: Beckhoff Automation GmbH & Co. KG
* loader: Add loader_autoboot_showEmmanuel Vadot2025-04-171-4/+7
| | | | | | | | It's used to control if the autoboot part of loader is displayed or not. Differential Revision: https://reviews.freebsd.org/D49819 Reviewed by: imp Sponsored by: Beckhoff Automation GmbH & Co. KG
* stand: lines with comments a '"' in loader.conf are ignoredCyrus Rahman2025-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | So the problem is that the lua parser in /boot/lua/config.lua is splitting the line on the '=', sending the first match to the key and the second to the value. In the problem case, the value is: '"test b" # This is "test_directive_b"' Then the value gets matched against QVALEXPR = '"(.*)"'. This cleans up the value by removing the first and last '"', but in this case turns it into: test b" # This is "test_directive_b which then gets rejected in processEnvVar() with MSG_FAILSYN_QUOTE, since values aren't allowed to contain '"'. Changing QVALEXPR to '([-%w_]+)' fixes this problem. Since the value is explicitly prevented from containing quotes, it's not unreasonable to load it from an expression that excludes them. The only other place this is used is in the 'exec="command"' expression, which also should not contain '"' in the command value. PR: 265001 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D35975
* stand: Fix brand positioning on framebuffer consoleJose Luis Duran2025-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The drawer.lua script ignores the values in loader_brand_x and loader_brand_y on framebuffer consoles, always positioning the brand at (1, 1). Allow it to be positioned by accepting the x and y values just like the text version. For example: /boot/lua/gfx-nanobsd.lua: return { brand = { graphic = { "" }, requires_color = true, image = "/boot/images/freebsd-logo-rev.png" } } /boot/loader.conf.d/bootloader.conf: loader_logo="none" loader_brand="nanobsd" loader_brand_x="15" PR: 255202 Reviewed by: manu, imp Approved by: emaste (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49092
* loader: Rework kernel menu sectionEmmanuel Vadot2025-01-091-10/+14
| | | | | | | | | | | | With pkgbase we can have long kernel name, so create a new section for the kernel name. Do not show the "default" text, we already show the "1 of X" part at the end of the line and the default kernel is always number 1 so it's a bit redundant. Differential Revision: https://reviews.freebsd.org/D48354 Reviewed by: imp, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG
* loader: Fix orb positionEmmanuel Vadot2025-01-093-4/+4
| | | | | | | | Fix the orb position to be aligned with the menu Differential Revision: https://reviews.freebsd.org/D48353 Reviewed by: imp, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG
* loader: set boot_safe when safe mode is selectedKyle Evans2024-12-141-0/+2
| | | | | | | | | This may be used to disable or limit functionality of some services when safe mode is selected. The particular value of boot_safe should not be considered significant, only its presence in the environment. Reviewed by: imp, tsoome Differential Revision: https://reviews.freebsd.org/D32172
* loader: Fix boot menu on BIOSWarner Losh2024-11-022-5/+36
| | | | | | | | | | | | | | | Only the gfx-enabled boot loader supports unicode. Otherwise, we have to use the old cons25 / ibmpc upper code page drawing characters. Check to see if we have the gfx.term_drawbox function. If we do, we support the unicode drawing characters. If we don't, then we have an older loader that doesn't support it *OR* we have the reduced function, text-only boot loader. In either of those cases, we need to use the old graphics characters. Abstract all those details into core.hasUnicode function. PR: 282465 MFC After: 2 day Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D47403
* manuals: Misc syntax fixesGraham Percival2024-10-151-0/+1
| | | | | | | | | | | | These were reported by `mandoc -T lint ...` as errors. The rendered output (in ascii and html) is not affected by this commit. Signed-off-by: Graham Percival <gperciva@tarsnap.com> Reviewed by: mhorne MFC after: 3 days Sponsored by: Tarsnap Backup Inc. Pull Request: https://github.com/freebsd/freebsd-src/pull/1459
* loader: Use Cyan instead of Blue for some menu itemsWarner Losh2024-10-111-2/+2
| | | | | | | | | BLUE often translates to DARK BLUE. On BLACK this is hard to read. Instead, use CYAN which looks good on both black and white backgrounds. Discussed with: kevans Sponsored by: Netflix
* loader: Fix 0 vs 1 confusion for column numbersWarner Losh2024-09-242-3/+3
| | | | | | | | | | | In two places we use '0' for a column number. However, the upper left hand corner of the screen is 1, 1. Fix those two confusions. Also, fix a comment that flipped the coordinates in a comment (I'm used to the vt100 convention where it's row, column (eg y, x)) and didn't notice the rest of the code uses x, y. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D46777
* loader: Use printc instead of print to fit in 24,80Warner Losh2024-09-241-3/+7
| | | | | | | | | | | | | | | | | | | print automatically adds a newline, while printc does not. Use printc in preference to print for managing the autoboot message. This means we can use line 24 safely on a 24x80 terminal, restoring some functionality that was lost in 101afbc6ee2f0. Note: we still set the default curosor position to 25,1 in screen.lua, but real VT100s (and successors) will treat any row larger than the pnumber of rows in a cursor motion command to be the last physical row (this is so you can move to 9999,9999 and do a cursor location query to get the size of the screen). Keeping that as is looks better on a typical VGA console. Fixes: 101afbc6ee2f0 Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D46771
* loader: Load platform entropy even without menuColin Percival2024-09-221-0/+2
| | | | | | | | | | | | | In 5c73b3e0a3db calls to core.loadEntropy were added to core.boot and core.autoboot; but neither of those is invoked if we disable the "beastie" menu. Add a core.loadEntropy call to the no-menu path. Reviewed by: imp MFC after: 1 week Sponsored by: Amazon Fixes: 5c73b3e0a3db ("Add support for getting early entropy from UEFI") Differential Revision: https://reviews.freebsd.org/D46637
* loader: Make EFI entropy size configurableColin Percival2024-09-221-1/+2
| | | | | | | | | | | Add a new loader variable entropy_efi_seed_size which defaults to 2048; if not defined (e.g. if the /boot/lua/ is updated but /boot/defaults/ isn't) the same 2048 default will be used. Reviewed by: Val Packett MFC after: 1 week Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D46632
* loader/menu: tweak for added lineWarner Losh2024-08-222-2/+2
| | | | | | | | | I added a line to the menu, but didn't adjust so things were a line off. Make the necessary adjustments. Fixes: 7cb65be96d47 Sponsored by: Netflix MFC After: 3 days
* stand: Use correct loader needs to be updated codeWarner Losh2024-07-301-3/+6
| | | | | | | | | | | | Use the correct loader code that adds an inactive highlighted menu item indicating that an update is needed. My laptop is the only machine that I have a boot menu. I'd debugged the menu part there, but had all the other changes, including my original menu code, on my server and hadn't copied it back before pushing. Fixes: 0eac99f76ec3 Sponsored by: Netflix
* stand: Add "Loader needs updating" to the first menu item"Warner Losh2024-07-291-0/+10
| | | | | | | | | When the boot loader version is too old, add a warning to the boot menu to maybe catch people's attention. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D45890
* stand: Print a warning of the loader is too oldWarner Losh2024-07-292-0/+25
| | | | | | | | | If the loader is < 3.0, print a warning that it's too old and needs to be upgraded. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D45889
* Revert "loader/lua: Remove workaround for command_error"Warner Losh2024-07-291-1/+6
| | | | | | | | | | | | | This reverts commit 552f3072af54820cf1805f712e2567bc1b7f046d. loader.command_error was added just after 11.2, but appears to not have been back ported to 11.x. 11.0 was the first lua loader release, so keep this compat shim until we sort out what to do. MFC After: 3 days Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D45883
* Revert "loader/lua: Remove compat shim for loader.lua_path"Warner Losh2024-07-291-1/+7
| | | | | | | | | | | | | | This reverts commit ab97d42addae97a389c6f22d6bba62ed954bb8e7. There's too many people in the field with FreeBSD 12.0 loader.efi that stubbed their toe on upgrading to 14.1 since they'd not updated loader.efi. While we sort out that mess, add back this workaround. Can revisit after 14.2 maybe. MFC After: 3 days Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D45882
* Revert "loader/lua: Remove pager shim"Warner Losh2024-07-291-0/+12
| | | | | | | | | | | | This reverts commit 8b9178cd0d35ff2beafebdd51c8c44ba2b5aeb0f. Really old loader.efi files persist in the field. Revert this to support it. We need to support this through at least 14.2 now, alas. MFC After: 3 days Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D45881
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* loader/lua: Remove workaround for command_errorWarner Losh2024-02-291-6/+1
| | | | | | | | | loader.command_error was available prior to stable/12 branching. No need to check if it is available or not. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44144
* loader/lua: Remove compat shim for loader.lua_pathWarner Losh2024-02-291-7/+1
| | | | | | | | | loader.lua_path was committed before stable/13 was branched, and merged in to for 12.2. Remove workaround for it not being present. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44143
* loader/lua: Remove pager shimWarner Losh2024-02-291-12/+0
| | | | | | | | | | | | Just after 12.2 and before the stable/13 branch, kevans added lpager.c to provide a pager interface for commands written in lua. It was merged into 12.3. Now that 12.2 is long since EOL, we can remove the pager shim here. Nobody needs that old loader + new lua scripts. Plus only one command is affected. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44142
* loader: Add loader.exitWarner Losh2024-02-271-0/+4
| | | | | | | | | | | | | Add loader.exit(status). While one can get alomst this behavior with loader.perform("quit"), quit doesn't allow a value to be returned to the firmware. The interpretation of 'status' is firmware specific. This can be used when autobooting doesn't work in scripts, for example, to allow the firmware to try something else... Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44094
* loader: Move drawer.lua over to gfx table.Warner Losh2024-02-161-6/+19
| | | | | | | | | | | | | Drawer.lua is the only bit of lua code in the base that uses any of the functons moved from the loader table to the gfx table. Move the main code to using the gfx dispatch. Add compat code for running on old loaders that creates the newer-style gfx table with the term_* functions we call in it populated. This will even work on the super old versions of the loader that don't have them (we'll still skip using them). Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D43908
* loader: Move gfx functions to gfx.lua.8Warner Losh2024-02-163-72/+124
| | | | | | | | | | Now that the fb_* and term_* functions are available in the gfx table, move the documentation to gfx.lua.8. Add information about backwards compatibility. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D43907
* loader: Document the lua loader table.Warner Losh2024-02-102-0/+248
| | | | | | | | Document all the public functions from the "loader" table. Sponsored by: Netflix Reviewed by: pauamma_gundo.com, tsoome, kevans Differential Revision: https://reviews.freebsd.org/D43701
* stand/lua: always allow overriding with local config filesStéphane Rochoy2024-02-022-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Loader now also read configuration files listed in local_loader_conf_files. Files listed here are the last ones read. And /boot/loader.conf.local was moved from loader_conf_files to local_loader_conf_files leaving only loader.conf and device.hints in loader_conf_files by default. The idea is to ensure local_loader_conf_files, i.e., /boot/loader.conf.local, can always be used to override other user defined settings. So the sequencing is now as follow: 1. Bootstrap: /boot/defaults/loader.conf 2. Read loader_conf_files files: /boot/device.hints /boot/loader.conf 3. Read loader_conf_dirs files: /boot/loader.conf.d/*.conf 4. And finally, rread local_loader_conf_files files: /boot/loader.conf.local Reviewed by: imp, kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/759
* stand/lua: per-product conf if requested via product_varsStéphane Rochoy2024-02-021-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | If product_vars is set, it must be a space separated list of environment variable names to walk through to guess the product. Each time a product can be guessed (i.e., the corresponding variable is defined), prepend /boot/loader.conf.d/PRODUCT/ to loader_conf_dirs. It can be typically used as follow: smbios.system.planar.maker="PLANAR_MAKER" smbios.system.planar.product="PLANAR_PRODUCT" smbios.system.product="PRODUCT" uboot.m_product="M_PRODUCT" product_vars="smbios.system.planar.maker smbios.system.planar.product smbios.system.product uboot.m_product" to read files found in the following directories, in that order: /boot/loader.conf.d/PLANAR_MAKER /boot/loader.conf.d/PLANAR_PRODUCT /boot/loader.conf.d/PRODUCT /boot/loader.conf.d/M_PRODUCT Reviewed by: imp, kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/759
* Revert "stand/lua: per-product conf if requested via product_vars"Warner Losh2024-02-021-25/+0
| | | | | | | This reverts commit 754cac4b283eb024a3a6a194130199c860e32ebf. No mail went out and commit message was wrong. Sponsored by: Netflix