summaryrefslogtreecommitdiff
path: root/stand/lua
AgeCommit message (Collapse)Author
12 dayslualoader: fix pruning of non-existent default kernelKyle Evans
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 [...]")
2025-11-19stand/lua: Fix two typos in the manual pagesGordon Bergling
- s/Additionnaly/Additionally/ - s/commmand/command/ MFC after: 3 days
2025-10-09cli.lua.8: Reflow literal commentsAlexander Ziaee
Reflow comments in literal text blocks so this manual is legible at MANWIDTH 78. MFC after: 1 day
2025-09-28core.lua: Consistently check for single userWarner Losh
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
2025-09-28loader: make disable-device more rebustWarner Losh
Check the number of arguments and ensure that the passed-in device to disable parses correctly. Sponsored by: Netflix
2025-09-28stand: Remove support for FreeBSD 12.2 and earlierWarner Losh
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
2025-06-24lualoader: Add distinct brand for installerJoseph Mingrone
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
2025-06-18lualoader: adapt builtin brand/logo definitions as wellKyle Evans
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
2025-06-17loader: Fix loader_brand = noneEmmanuel Vadot
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
2025-06-12stand: lua: add a more productive commentKyle Evans
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 [...]")
2025-06-12stand: lua: convert orb to a new format that allows per-graphic shiftKyle Evans
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
2025-06-06lualoader: rename loop variable to cleanup luacheckKyle Evans
This shadows an `i` used for indexing earlier in the function, and we don't care that much about the name.
2025-06-06lualoader: allow graphical bits to be disabled with loader_gfxKyle Evans
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
2025-05-29loader: Fix beastie and fbsdbw logo positionsMarek Zarychta
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
2025-05-12stand/lua manuals: Describe betterAlexander Ziaee
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
2025-04-17loader: Add loader_menuEmmanuel Vadot
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
2025-04-17loader: Add loader_autoboot_showEmmanuel Vadot
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
2025-03-16stand: lines with comments a '"' in loader.conf are ignoredCyrus Rahman
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
2025-02-24stand: Fix brand positioning on framebuffer consoleJose Luis Duran
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
2025-01-09loader: Rework kernel menu sectionEmmanuel Vadot
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
2025-01-09loader: Fix orb positionEmmanuel Vadot
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
2024-12-13loader: set boot_safe when safe mode is selectedKyle Evans
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
2024-11-02loader: Fix boot menu on BIOSWarner Losh
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
2024-10-15manuals: Misc syntax fixesGraham Percival
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
2024-10-11loader: Use Cyan instead of Blue for some menu itemsWarner Losh
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
2024-09-24loader: Fix 0 vs 1 confusion for column numbersWarner Losh
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
2024-09-24loader: Use printc instead of print to fit in 24,80Warner Losh
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
2024-09-22loader: Load platform entropy even without menuColin Percival
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
2024-09-22loader: Make EFI entropy size configurableColin Percival
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
2024-08-22loader/menu: tweak for added lineWarner Losh
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
2024-07-29stand: Use correct loader needs to be updated codeWarner Losh
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
2024-07-29stand: Add "Loader needs updating" to the first menu item"Warner Losh
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
2024-07-29stand: Print a warning of the loader is too oldWarner Losh
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
2024-07-29Revert "loader/lua: Remove workaround for command_error"Warner Losh
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
2024-07-29Revert "loader/lua: Remove compat shim for loader.lua_path"Warner Losh
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
2024-07-29Revert "loader/lua: Remove pager shim"Warner Losh
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
2024-07-15Remove residual blank line at start of MakefileWarner Losh
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
2024-02-29loader/lua: Remove workaround for command_errorWarner Losh
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
2024-02-29loader/lua: Remove compat shim for loader.lua_pathWarner Losh
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
2024-02-29loader/lua: Remove pager shimWarner Losh
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
2024-02-26loader: Add loader.exitWarner Losh
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
2024-02-15loader: Move drawer.lua over to gfx table.Warner Losh
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
2024-02-15loader: Move gfx functions to gfx.lua.8Warner Losh
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
2024-02-10loader: Document the lua loader table.Warner Losh
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
2024-02-02stand/lua: always allow overriding with local config filesStéphane Rochoy
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
2024-02-02stand/lua: per-product conf if requested via product_varsStéphane Rochoy
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
2024-02-02Revert "stand/lua: per-product conf if requested via product_vars"Warner Losh
This reverts commit 754cac4b283eb024a3a6a194130199c860e32ebf. No mail went out and commit message was wrong. Sponsored by: Netflix
2024-02-02Revert "stand/lua: always allow overriding with local config files"Warner Losh
This reverts commit d3d0b735571d9562812ce5b343a6e91f7a795dbe. no mail sent out, and the commit message was wrong. Sponsored by: Netflix
2024-02-02stand/lua: always allow overriding with local config filesStéphane Rochoy
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
2024-02-02stand/lua: per-product conf if requested via product_varsStéphane Rochoy
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