Add Lua as a scripting langauge to /boot/loader
Needs ReviewPublic

Authored by imp on Sat, Feb 10, 9:03 AM.

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 OK
Unit
No Unit Test Coverage
Build Status
Buildable 14938
Build 15050: arc lint + arc unit
imp created this revision.Sat, Feb 10, 9:03 AM
imp edited the test plan for this revision. (Show Details)Sat, Feb 10, 9:23 AM
imp added reviewers: emaste, tsoome, manu, dteske.
tsoome accepted this revision.Sat, Feb 10, 9:39 AM

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

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

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

imp added a comment.Sat, Feb 10, 9:52 AM

Moved to /boot/lua

juan.molina_club.fr added inline comments.
UPDATING
55

Typo: s/loot/boot

imp updated this revision to Diff 39150.Sat, Feb 10, 4:34 PM
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.Sat, Feb 10, 4:34 PM
imp updated this revision to Diff 39151.Sat, Feb 10, 4:35 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?

imp added a comment.Sat, Feb 10, 9:58 PM

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.