#
fa4a2394 |
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Defer kernel/module loading until boot or menu escape
Loading the kernel and modules can be really slow. Loading before the menu draws and every time one changes kernel/boot environment i
stand/lua: Defer kernel/module loading until boot or menu escape
Loading the kernel and modules can be really slow. Loading before the menu draws and every time one changes kernel/boot environment is even more painful.
Defer loading until we either boot, auto-boot, or escape to loader prompt. We still need to deal with configuration changes as the boot environment changes, but this is generally much quicker.
This commit strips all ELF loading out of config.load/config.reload so that these are purely for configuration. config.loadelf has been created to deal with kernel/module loads. Unloading logic has been ripped out, as we won't need to deal with it in the menu anymore.
Discussed in part with: allanjude
show more ...
|
#
27dd7ddf |
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: reload previously loaded kernel at config-load/reload
r329550 introduced config.kernel_loaded. config.load() doesn't provide a means of overriding the kernel to load, but that likely isn'
stand/lua: reload previously loaded kernel at config-load/reload
r329550 introduced config.kernel_loaded. config.load() doesn't provide a means of overriding the kernel to load, but that likely isn't necessary as it will not be a common case. When loading the kernel, just attempt to load the kernel previously loaded and specified in config.kernel_loaded.
If we haven't loaded a kernel yet, config.kernel_loaded will be unset/nil and the "default"/first kernel found will be loaded. If we've loaded a kernel, we'll try to load that same kernel again and fallback to the default kernel if we need to.
This in also in support of upcoming boot environment support.
show more ...
|
#
d4591301 |
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Store the loaded kernel as config.kernel_loaded
'nil' means the 'first kernel found in module_path', which is the same interpretation as passing 'nil' to loadkernel.
Otherwise, it denote
stand/lua: Store the loaded kernel as config.kernel_loaded
'nil' means the 'first kernel found in module_path', which is the same interpretation as passing 'nil' to loadkernel.
Otherwise, it denotes the name of a kernel that we've successfully loaded. When reloaded later, we will still need to do the full search again to locate the actual kernel in case things have changed, so just the name is good enough.
This is in support of upcoming boot environment support. vfs.root.mountfrom and currdev will be changed, then we will reload configuration and attempt to reload the currently chosen kernel unless we shouldn't.
show more ...
|
#
e402cd13 |
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: More style nits, config.lua
Some other points I think we need to be consistent on: - Spacing around string concatenation (always) - Test against 'nil' explicitly rather than relying on 'n
stand/lua: More style nits, config.lua
Some other points I think we need to be consistent on: - Spacing around string concatenation (always) - Test against 'nil' explicitly rather than relying on 'not' for things that reasonably won't be returning a boolean. e.g. loader.getenv
Eventually this will all get formalized somewhere.
show more ...
|
#
faf2ee29 |
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Remove some debugging bits that snuck in... gr...
|
#
15d8e03c |
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Fix module_path handling with multiple kernels
Once we've successfully loaded a kernel, we add its directory to module_path. If we switch kernels with the kernel selector, we again prepen
stand/lua: Fix module_path handling with multiple kernels
Once we've successfully loaded a kernel, we add its directory to module_path. If we switch kernels with the kernel selector, we again prepend the kernel directory to the current module_path and end up with multiple kernel paths, potentially with mismatched kernel/modules, added to module_path.
Fix it by caching module_path at load() time and using the cached version whenever we load a new kernel.
show more ...
|
#
7fc96e38 |
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Fix verbiage and some typos
"other_kernel" is decidedly not spelled "other_kern"
|
#
4afa0076 |
| 17-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: dumpModules => lsModules
rgrimes@ notes that this behavior is more befitting of the latter name than the former, and I'm inclined to agree.
Reported by: rgrimes
|
#
24a1bd54 |
| 17-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Style pass
These are the style points that I'd like to try and maintain in our lua scripts: - Parentheses around conditionals - Trailing semicolons, except on block terminators - s:method
stand/lua: Style pass
These are the style points that I'd like to try and maintain in our lua scripts: - Parentheses around conditionals - Trailing semicolons, except on block terminators - s:method(...) instead of string.method(s, ...) where applicable
There's likely more, but that'll get hammered out as we continue.
show more ...
|
#
18c286a0 |
| 17-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Try to load alternate kernels as directories first
This is the procedure that config.loadkernel tries to go through, but reloading kernel config didn't use this function. Amend config.loa
stand/lua: Try to load alternate kernels as directories first
This is the procedure that config.loadkernel tries to go through, but reloading kernel config didn't use this function. Amend config.loadkernel to take an optional other_kernel.
While here, be a little more verbose ("Trying to load kernel") so that it's easy to follow where we've gone wrong.
show more ...
|
#
4d290ffb |
| 17-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Correct test sense, this should have been 'not nil'
|
#
71049173 |
| 17-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Address some nits
1.) Instead of string.function(s, ...), use s:function(...) 2.) Don't try to concatenate `res`, it was just tested to be nil 3.) Note that "Loading configuration" is con
stand/lua: Address some nits
1.) Instead of string.function(s, ...), use s:function(...) 2.) Don't try to concatenate `res`, it was just tested to be nil 3.) Note that "Loading configuration" is configured modules, and be a little more precise in mentioning what failed ("loading of one or more modules")
show more ...
|
#
41e77b53 |
| 17-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Add debug method to dump modules
|
#
c990f0a9 |
| 17-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Correct some trivial errors in config
An empty module_path to start with isn't ideal, but if all modules are contained within a kernel directory (which is what we just tested) then it isn
stand/lua: Correct some trivial errors in config
An empty module_path to start with isn't ideal, but if all modules are contained within a kernel directory (which is what we just tested) then it isn't strictly an error. Don't assume that module_path has a value already.
When we fail to load the kernel, printing the result (which is guaranteed to be nil) is not intended; print the name of the kernel.
show more ...
|
#
088b4f5f |
| 12-Feb-2018 |
Warner Losh <imp@FreeBSD.org> |
Add the lua scripts from the lua-bootloader SoC
These are the .lua files from from Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur and Wojciech A. Koszek also contributed.
Obtain
Add the lua scripts from the lua-bootloader SoC
These are the .lua files from from Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur and Wojciech A. Koszek also contributed.
Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader Sponsored by: Google Summer of Code
Improve the SoC lua menu code to bring it in line with forth menu functionality
Submitted by: Zakary Nafziger Sponsored by: FreeBSD Foundation
Use loader.setenv and loader.unsetenv instead of loader.perform
Convert from include("/boot/foo.lua") to foo = require("foo"); to bring in line with latest lua module conventions.
Enforce a uniform style for the new .lua files: o hard tab indenation for 8 spaces o don't have if foo then bar; else bas; end on one line
MFC After: 1 month Relnotes: yes Differential Review: https://reviews.freebsd.org/D14295
show more ...
|