aboutsummaryrefslogtreecommitdiff
path: root/stand/liblua
Commit message (Collapse)AuthorAgeFilesLines
* lua: Update to 5.4.4Warner Losh2023-02-081-0/+73
| | | | | | | | | | | | | | | Merge commit '755d9301ca89f02956fd17858b9d4d821ab5c972' from the vendor branch. This updates us from lua 5.4.2 to 5.4.4. In addition, it switches around how we flavor liblua for the boot loader and flua. This is done to reduce diffs with upstream and make it easier to import new versions (the current method has too many conflicts to resolve by hand): we include luaconf.local.h from luaconf.h (the only change to this file is now that #include at the end). We then define what we need to: for flua (which does very little) and one for stand (which creates the new FLOAT type out of int64). Sponsored by: Netflix
* lua: reduce diffs between luaconf.h copiesEd Maste2023-01-261-3/+4
| | | | | | | | | | | | | Upstream luaconf.h is contrib/lua/src/luaconf.h.dist, while userland lua and loader lua have copies in lib/liblua/luaconf.h and stand/liblua/luaconf.h. Adjust whitespace, VCS tags, etc. to match upstream's version, for ease of comparison. Reviewed By: imp Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38206
* stand: Add lua binding loader.has_commandWarner Losh2022-09-011-2/+17
| | | | | | | | Give scripts the ability to determine if the currently running loader has provided a command. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36365
* EFI secure boot VECTX related changesEric van Gyzen2021-04-301-3/+2
| | | | | | | | | | | | | | When VECTX is enabled as a kernel option and non-EFI loaders are built, many reads will fail due to the mis-match of whether LOADER_VERIEXEC_VECTX or not in readin.h. Source that includes bootstrap.h must ensure the kernel option agrees with the compile time CFLAGS in the various make related files. Submitted by: bret_ketchum@dell.com (original revision) Reviewed by: sjg, bdrewery, dab, bret_ketchum@dell.com MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29993
* contrib/lua: update to 5.4.2Kyle Evans2021-01-141-136/+108
| | | | Merge commit '0ea45b9cd43ce1247eb3eee9bfd5cee3d19068e7' into main
* loader: implement framebuffer consoleToomas Soome2021-01-022-0/+194
| | | | | | | | | | | | | | | | | | | | | | | 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
* stand: liblua: add a pager moduleKyle Evans2020-12-123-1/+91
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=368591
* Only set WARNS if not definedKyle Evans2020-09-111-1/+1
| | | | | | | | | | | | | This would allow interested parties to do experimental runs with an environment set appropriately to raise all the warnings throughout the build; e.g. env WARNS=6 NO_WERROR=yes buildworld. Not currently touching the numerous instances in ^/tools. MFC after: 1 week Notes: svn path=/head/; revision=365631
* veloader use vectx API for kernel and modulesSimon J. Gerraty2020-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vectx API, computes the hash for verifying a file as it is read. This avoids the overhead of reading files twice - once to verify, then again to load. For doing an install via loader, avoiding the need to rewind large files is critical. This API is only used for modules, kernel and mdimage as these are the biggest files read by the loader. The reduction in boot time depends on how expensive the I/O is on any given platform. On a fast VM we see 6% improvement. For install via loader the first file to be verified is likely to be the kernel, so some of the prep work (finding manifest etc) done by verify_file() needs to be factored so it can be reused for vectx_open(). For missing or unrecognized fingerprint entries, we fail in vectx_open() unless verifying is disabled. Otherwise fingerprint check happens in vectx_close() and since this API is only used for files which must be verified (VE_MUST) we panic if we get an incorrect hash. Reviewed by: imp,tsoome MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D23827 Notes: svn path=/head/; revision=358811
* stand: liblua: drop default buffer size to 128Kyle Evans2019-12-121-5/+1
| | | | | | | | | | | | | | | | Lua allocates LUAL_BUFFERSIZE buffers on the stack for various string functions (string.format, string.gsub) -- this works out to be somewhat significant and not necessary, based on how we use string operations. Dropping it risks having to allocate per call to format/gsub, but this is not the case for our usage. This simply stops allocating 8K buffers on the stack when luaL_Buffer is used. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22500 Notes: svn path=/head/; revision=355640
* Regularize my copyright noticeWarner Losh2019-12-043-3/+3
| | | | | | | | | | | | o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Notes: svn path=/head/; revision=355394
* Add flua to the base system, install to /usr/libexecKyle Evans2019-11-183-376/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever extensions we need for base system operations. We currently support a subset of lfs and lposix that are used in the rewrite of makesyscall.sh into lua, added in r354786. flua is intentionally written such that one can install standard lua and some set of lua modules from ports and achieve the same effect. linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added in. This is similar to what we do in stand/. linit.c has been renamed to make it clear that this has flua-specific bits. luaconf has been slightly obfuscated to make extensions more difficult. Part of the problem is that flua is already hard enough to use as a bootstrap tool because it's not in PATH- attempting to do extension loading would require a special bootstrap version of flua with paths changed to protect the innocent. src.lua.mk has been added to make it easy for in-tree stuff to find flua, whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1. Reviewed by: brooks, emaste (both earlier version), imp Differential Revision: https://reviews.freebsd.org/D21893 Notes: svn path=/head/; revision=354833
* liblua: add loader.lua_pathKyle Evans2019-11-021-0/+2
| | | | | | | | | | | | As described previously, loader.lua_path is absolute path where scripts are installed. A future commit will use this to build paths for dofile in try_include, rather than the current pcall/require setup that makes it more difficult to coordinate loader aborts from local.lua -- we do not need the flexibility of require(), and local.lua is in-fact not a 'module-like' file as we will not be referencing anything from it. Notes: svn path=/head/; revision=354246
* stand: consolidate knowledge of lua pathKyle Evans2019-11-022-2/+2
| | | | | | | | | | | | | Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. MFC after: 1 week Notes: svn path=/head/; revision=354245
* Enable veriexec for loaderSimon J. Gerraty2019-02-262-0/+18
| | | | | | | | | | | | | | | | This relies on libbearssl and libsecureboot to verify files read by loader in a maner equivalent to how mac_veriexec Note: disabled by default. Use is initially expected to be by embeded vendors Reviewed by: emaste, imp Sponsored by: Juniper Networks Differential Revision: D16336 Notes: svn path=/head/; revision=344568
* Create new EINTEGRITY error with message "Integrity check failed".Kirk McKusick2019-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | An integrity check such as a check-hash or a cross-correlation failed. The integrity error falls between EINVAL that identifies errors in parameters to a system call and EIO that identifies errors with the underlying storage media. EINTEGRITY is typically raised by intermediate kernel layers such as a filesystem or an in-kernel GEOM subsystem when they detect inconsistencies. Uses include allowing the mount(8) command to return a different exit value to automate the running of fsck(8) during a system boot. These changes make no use of the new error, they just add it. Later commits will be made for the use of the new error number and it will be added to additional manual pages as appropriate. Reviewed by: gnn, dim, brueffer, imp Discussed with: kib, cem, emaste, ed, jilles Differential Revision: https://reviews.freebsd.org/D18765 Notes: svn path=/head/; revision=343111
* Move LUA_ROOT to /boot/luaWarner Losh2018-10-281-3/+3
| | | | | | | | While this is mostly unused today, this is a better place than /usr/local/lua. Notes: svn path=/head/; revision=339831
* lualoader: Improve module loading diagnosticsKyle Evans2018-10-251-0/+9
| | | | | | | | | | | | | | | | | Some fixes: - Maintain historical behavior more accurately w.r.t verbose_loading; verbose_loading strictly prints "${module_name...}" and later "failed!" or "ok" based on load success - With or without verbose_loading, dump command_errbuf on load failure. This usually happens prior to ok/failed if we're verbose_loading Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D17694 Notes: svn path=/head/; revision=339702
* MFV r337586: lua: Update to 5.3.5Kyle Evans2018-08-141-0/+7
| | | | | | | | | | Bugfix release, nothing too major. Tested with: lualoader via userboot, lualoader live Differential Revision: https://reviews.freebsd.org/D16665 Notes: svn path=/head/; revision=337810
* For our INT64 implementation, we can compare integers and numbersWarner Losh2018-08-141-3/+1
| | | | | | | | | directly because they are the same thing. Reviewed by: kevans@ Notes: svn path=/head/; revision=337809
* Use M. Warner Losh everywhere on my copyrights.Warner Losh2018-05-013-6/+3
| | | | | | | Remove 'All Rights Reserved' where I can. Notes: svn path=/head/; revision=333143
* lualoader: Expose loader.parse and add cli_execute_unparsedKyle Evans2018-03-071-0/+19
| | | | | | | | | | | | | | | | | This will be used for scenarios where the command to execute is coming in via the environment (from, for example, loader.conf(5)) and is thus not necessarily trusted. cli_execute_unparsed will immediately be used for handling module_{before,after,error} as well as menu_timeout_command. We still want to offer these variables the ability to execute Lua-intercepted loader commands, but we don't want them to be able to execute arbitrary Lua. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D14580 Notes: svn path=/head/; revision=330616
* liblua: Add loader.interpretKyle Evans2018-03-031-0/+20
| | | | | | | | | | | | | | This allows lua to pass back a command string to be executed as if it were typed at the loader prompt- loader tries to execute the string first as pure lua, then parses it and gives lua a chance to intercept before it tries to execute it itself. This will be used to implement menu_timeout_command, among other things, which *should* be used to execute basic loader commands independent of the chosen interpreter. Notes: svn path=/head/; revision=330339
* liblua: Use putc instead of printf for printcKyle Evans2018-03-021-4/+4
| | | | | | | | | | | | | | printc does not need the features or the overhead of printf. It does not take formatting strings, and it pipes the single string argument through an "%s" format. Instead, use putc directly. This pipes the string through in its entirety as a series of 'unsigned char's, generally straight to the console emulator. Discussed with: tsoome Notes: svn path=/head/; revision=330284
* lualoader: Register loader.printc as global printcKyle Evans2018-03-021-0/+3
| | | | Notes: svn path=/head/; revision=330282
* liblua: Implement write supportKyle Evans2018-02-243-7/+107
| | | | | | | | | | | Write support (even if it only works on UFS) will be needed for nextboot functionality. Reviewed by: cem, imp Differential Revision: https://reviews.freebsd.org/D14478 Notes: svn path=/head/; revision=329895
* Centralize lua definesWarner Losh2018-02-231-2/+3
| | | | | | | | | | We need to ensure that we defined Numbers as int64_t everywhere we build for lua. Previously, we were compiling part of the code with Numbers as int64_t and part as double. Move lua number definition to a more-central location Notes: svn path=/head/; revision=329857
* lualoader: Remove nasty hack for not printing out ".0"Kyle Evans2018-02-211-0/+1
| | | | | | | | | | luaconf.h has a LUA_COMPAT_FLOATSTRING option that may be defined to do this instead of needing intstring. Reported by: Dan Nelson Notes: svn path=/head/; revision=329756
* loader.lua: Expose errno table to luaConrad Meyer2018-02-203-1/+214
| | | | | | | | | Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14454 Notes: svn path=/head/; revision=329656
* liblua: Add loader.machine and loader.machine_arch propertiesKyle Evans2018-02-201-0/+7
| | | | | | | | | | | | | Provisioned from MACHINE/MACHINE_ARCH on the system, expose loader.machine and loader.machine_arch respectively. These may be used to hide ACPI option on non-applicable archs. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D14446 Notes: svn path=/head/; revision=329650
* Lua lfs.attributes: Provide a more consistent error returnConrad Meyer2018-02-201-4/+13
| | | | | | | | | | | | | | | In the remaining error case, return a 3-tuple consistent with the other error return case. Document how to invoke lfs.attributes() and detect/decode error return in example comments. Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14451 Notes: svn path=/head/; revision=329649
* Implement loader.commandWarner Losh2018-02-201-0/+26
| | | | | | | | | This is just like loader.perform, except it takes pre-parsed arguments. Review: https://reviews.freebsd.org/D14448 Notes: svn path=/head/; revision=329643
* liblua: Fix missing '}' in lutil.c after r329499Kyle Evans2018-02-181-0/+1
| | | | Notes: svn path=/head/; revision=329503
* Lua loader: Add barebones "lfs" moduleConrad Meyer2018-02-183-1/+367
| | | | | | | | | | | | | | | Add a Lua FileSystem module, an emulation of a subset of the permissively licensed (MIT) Lua library of the same name[0], to our loader's Lua environment. [0]: https://github.com/keplerproject/luafilesystem/ Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14418 Notes: svn path=/head/; revision=329500
* interp_lua: Register io/loader with regular Lua module systemConrad Meyer2018-02-182-6/+11
| | | | | | | | | Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14421 Notes: svn path=/head/; revision=329499
* liblua: Emulate DIR, opendir, fdopendir, closedirConrad Meyer2018-02-172-0/+44
| | | | | | | | | | | | In a similar fashion to FILE, provide thin shims for the standard directory manipulation functions. Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14417 Notes: svn path=/head/; revision=329474
* liblua: Clean up io/loader C module registrationConrad Meyer2018-02-172-52/+26
| | | | | | | | | | | Utilize registration APIs Lua provides to make module definition a little cleaner. Discussed with: imp Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=329473
* Add Lua as a scripting langauge to /boot/loaderWarner Losh2018-02-129-0/+1502
liblua glues the lua run time into the boot loader. It implements all the runtime routines that lua expects. In addition, it has a few standard 'C' headers that nueter various aspects of the LUA build that are too specific to lua to be in libsa. Many refinements from the original code to improve implementation and the number of included lua libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default module path. Numerous cleanups from the original GSoC project, including hacking libsa to allow lua to be built with only one change outside luaconf.h. Add the final bit of lua glue to bring in liblua and plug into the multiple interpreter framework, previously committed. Add LOADER_LUA option, currently off by default. Presently, this is an experimental option. One must opt-in to using this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been lightly tested, so keep a backup copy of your old loader handy. The menu code, coming in the next commit, hasn't been exhaustively tested. A LUA boot loader is 60k larger than a FORTH one, which is 80k larger than a no-interpreter one. Subtle changes in size may tip things past some subtle limit (the binary is ~430k now when built with LUA). A future version may offer coexistance. Bump FreeBSD version to 1200058 to mark the milestone. Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur, Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh reworked it extensively into its current form. Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader Sponsored by: Google Summer of Code Relnotes: Yes MFC After: 1 month Differential Review: https://reviews.freebsd.org/D14295 Notes: svn path=/head/; revision=329166