CONFIG.LUA(8)
okay bestie, welcome to config.lua(8) β the System Manager's Manual page for the bootloader configuration module. π This one is lowkey iconic: it's all about configuration and module loading, and the functions are the main characters. iykyk. π
πΈ NAME
config.lua β bootloader configuration module. Periodt. β¨
π DESCRIPTION
config.lua contains configuration and module loading functionality. No cap. β¨
Before you hook into it or use anything it provides, it must be included with a statement such as the following:
local config = require("config")
β¨ Exported functions
The following functions are exported from config.lua, and they are fr fr the ones you need to know about:
config.getCarouselIndex(id)β Returns the currently chosen index in the carousel menu entry described byid. See the definition ofmenu.lua(8)for a more in-depth explanation of carousels. (Carousel lore, bestie. Obsessed. π )config.setCarouselIndex(id, idx)β Sets the chosen index for the carousel menu entry described byidtoidx. A lookup will be done as needed to determine what valueidxactually corresponds to.config.readConf(file, loaded_files)β Processesfileas a configuration file (e.g., asloader.conf) and then processes files listed in theloader_conf_filesvariable. Additionally, the top-level call toreadConfwill process files listed in theloader_conf_dirsandlocal_loader_conf_filesvariables (seeloader.conf(5)). The caller may optionally pass in a table as theloaded_filesargument; that table uses filenames as keys, and any non-nilvalue indicates that the file named by the key has already been loaded and should not be loaded again. No double-loading, slay. π«Άconfig.processFile(name, silent)β Processes and parsesnameas a configuration file. Returnstrueifnameexists and parses without error,falseotherwise. Ifsilentistrue,config.processFile()will not consider a failure to read the file as a failure. πconfig.parse(text)β Parsestextas a configuration file. This is used internally byconfig.processFile()to parse the contents of a configuration file. Returnstrueif parsing succeeds without error,falseif an error occurred. A message is also printed to the console if an error is encountered. πconfig.loadKernel(other_kernel)β Attempts to loadother_kernelas a kernel. Ifother_kernelis unset,config.loadKernel()will attempt to loadkernel. Otherwise, it will try to loadkernelfirst from/boot/{other_kernel}, then from{other_kernel}. The latter is tried in case an absolute path has been specified to the kernel to use.module_pathis amended to include the directory the kernel was found in if either of these paths result in a loaded kernel. If no kernel was loaded from either of these paths,config.loadKernel()will attempt to load a kernel named{other_kernel}frommodule_pathinstead of attempting to load a kernel namedkernel. Returnstrueif a kernel was loaded,falseif no kernel was loaded. π₯config.selectKernel(kernel)β Setskernelto the kernel that will be loaded when eitherautobootorbootare invoked. This is usually called by the menu system as the kernel selector carousel is toggled through. πconfig.load(file, reload)β Loadsfileas a configuration file. Iffileis not specified,/boot/defaults/loader.confis used.config.load()will then silently attempt to process any files specified inloader_conf_filesafterfilehas been processed.nextboot(8)configuration will also be checked as part ofconfig.load(). Before returning, allconfig.loadedhooks will be run ifreloadis not set totrue. β¨config.reload(file)β Reloadsfileas a configuration file.config.reload()will restore the environment to how it existed before the last config was loaded, then it will invokeconfig.load(file). Before returning, allconfig.reloadedhooks will be run. πconfig.loadelf()β Loads all ELF objects, the selected kernel as well as any modules configured to be preloaded inloader.conf(5). This will be called by the Lua interceptedautobootandbootcommands. πconfig.enableModule(modname)β Marks a module namedmodnameto be loaded duringconfig.loadelf(). If the module was previously blacklisted, then it will be forcefully allowed to load. πͺconfig.disableModule(modname)β Marks a module namedmodnameto not be loaded duringconfig.loadelf(). π«config.isModuleEnabled(modname)β Checks if the module namedmodnamewill be loaded duringconfig.loadelf(). It checks both that the module is marked for loading and that it is either forced or not blacklisted. βconfig.getModuleInfo()β Returns a table withmodulesandblacklisttables describing the modules that the config module has been made aware of vialoader.conf(5)as well as a representation ofmodule_blacklist. π¦
πͺ Defined Hooks
The following hooks are defined in config.lua:
config.buildenv(env)config.loaded()config.reloaded()kernel.loaded()modules.loaded()
Note that the config.buildenv() hook is only invoked when an environment needs to be built to execute a lua configuration file that has been specified in loader_conf_files. It will be invoked for each configuration file encountered. π
π SEE ALSO
π AUTHORS
The config.lua file was originally written by Pedro Souza (pedrosouza@FreeBSD.org). Later work and this manual page was done by Kyle Evans (kevans@FreeBSD.org). π«Ά
Debian, March 29, 2025 β thatβs the source/version and date for this manual page. config.lua(8) Byeee bestie! π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- π the page's license: BSD-2-Clause
- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms