# Configure loader in /boot



## Alain De Vos (Jun 17, 2021)

Is it possible to configure my /boot directory in order for the /boot/loader to present me with different options, ie different kernels , different root partions, different partitions to chainload ?
If so which files do I have to edit ?
Currently I have a root partition and kernel configured in loader.conf but this is all without options except boot in singe or multi-user mode.


----------



## SirDice (Jun 18, 2021)

The "beasty" menu you see when you boot a standard FreeBSD is being run by loader(8). Up until a few years ago it was written in Forth, nowadays it's LUA. The loader(8) on a modern FreeBSD 13.0 installation already allows you to select the kernel and a boot environment.


----------



## grahamperrin@ (Apr 9, 2022)

Alain De Vos said:


> … loader to present me with different options, ie …



FreeBSD bugs: 

237653 – LUA loader cannot choose ZFS pool to boot
263172 – boot loader menu: boot environments: present an orderly list of environments from which to choose


----------



## kirin (Apr 13, 2022)

SirDice said:


> The "beasty" menu you see when you boot a standard FreeBSD is being run by loader(8). Up until a few years ago it was written in Forth, nowadays it's LUA. The loader(8) on a modern FreeBSD 13.0 installation already allows you to select the kernel and a boot environment.


LUA? this lua?


----------



## SirDice (Apr 13, 2022)

kirin said:


> LUA? this lua?


loader(8) itself is written in C, but it has LUA builtin. And yes, it's that LUA. The 'old' loader had a Forth compiler, the entire 'beasty' menu was written in Forth. It's still there, you can switch back and forth (yes, pun intended). 


```
dice@molly:~ % ls -il /boot/loader /boot/loader_*
444825 -r-xr-xr-x  3 root  wheel  495616 Apr 10 17:37 /boot/loader
444937 -r-xr-xr-x  1 root  wheel  434176 Apr 10 17:37 /boot/loader_4th
444941 -r-xr-xr-x  1 root  wheel  805376 Apr 10 17:37 /boot/loader_4th.efi
707519 -r-xr-xr-x  1 root  wheel  438272 Mar 17 09:34 /boot/loader_4th.old
444825 -r-xr-xr-x  3 root  wheel  495616 Apr 10 17:37 /boot/loader_lua
444696 -r-xr-xr-x  2 root  wheel  892928 Apr 10 17:37 /boot/loader_lua.efi
708100 -r-xr-xr-x  1 root  wheel  499712 Mar 17 09:34 /boot/loader_lua.old
444504 -r-xr-xr-x  1 root  wheel  372736 Apr 10 17:37 /boot/loader_simp
444942 -r-xr-xr-x  1 root  wheel  747520 Apr 10 17:37 /boot/loader_simp.efi
708101 -r-xr-xr-x  1 root  wheel  376832 Mar 17 09:34 /boot/loader_simp.old
```

If you're interested in the LUA part, have a look in /boot/lua.


----------



## kirin (Apr 13, 2022)

SirDice said:


> loader(8) itself is written in C, but it has LUA builtin. And yes, it's that LUA. The 'old' loader had a Forth compiler, the entire 'beasty' menu was written in Forth. It's still there, you can switch back and forth (yes, pun intended).
> 
> 
> ```
> ...


that's the last thing i'd expect to be written in lua


----------

