Page MenuHomeFreeBSD

Add Lua as a scripting langauge to /boot/loader
AbandonedPublic

Authored by imp on Feb 10 2018, 9:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 30, 1:17 PM
Unknown Object (File)
Sat, Mar 30, 1:13 PM
Unknown Object (File)
Sat, Mar 30, 1:13 PM
Unknown Object (File)
Sat, Mar 30, 1:13 PM
Unknown Object (File)
Sat, Mar 30, 12:20 PM
Unknown Object (File)
Feb 20 2024, 7:37 PM
Unknown Object (File)
Feb 18 2024, 8:16 AM
Unknown Object (File)
Feb 13 2024, 1:02 PM

Details

Summary

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" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built almost unmodified.

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, Warner Losh,
Pedro Arthur, Zakary Nafziger and Wojciech A. Koszek also contributed.

Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Release Notes: Yes
MFC After: 1 month

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

Improve the SoC lua menu code to bring it in line with forth
menu functionality

Submitted by: Zakary Nafziger

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
Release notes: yes

Test Plan

So far, I've just used the userboot test program to test it. It's finally getting through it all, so I through I'd post it for review.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14923
Build 15035: arc lint + arc unit

Event Timeline

imp added reviewers: emaste, tsoome, manu, dteske.

Im sure there is still much to do, but go for it.

This revision is now accepted and ready to land.Feb 10 2018, 9:39 AM

As an note, please install scripts into /boot/lua - so we wont pollute the whole /boot.

imp edited the test plan for this revision. (Show Details)

Fix reviews so far, plus add color.lua

This revision now requires review to proceed.Feb 10 2018, 4:34 PM

this time include all revs

I presume the commit will have Sponsored bys for Google Summer of Code, Netflix, and the FreeBSD Foundation; any others?

I presume the commit will have Sponsored bys for Google Summer of Code, Netflix, and the FreeBSD Foundation; any others?

As appropriate, of course. In the past we've not done this, so I'll use my judgement here. Wasn't going to put Netflix's name on it because the Lua stuff was a side project to the UEFI boot stuff that Netflix was paying me for.