Lua is a scripting language, small and simple, easy to ’embed’ into an application. I just noticed, Lua is in the EDK-II trunk! The UEFI port is based on Lua 5.2.3, released on November 2013. The UEFI copyrights are dated 2013-2014, so I missed this Lua change for a long time! 😦 Emulex Corporation did the intial UEFI port, and Intel Corporation did some final build/file packaging changes. So, thanks Emulex and Intel!
Here’s the mandatory hello-world in Lua, “ported to UEFI”:
print(“Hello UEFI World”)
To install Lua on UEFI: On your UEFI System Partition (ESP), create \Efi\Tools directory, and copy Lua.efi there. That is the standalone Lua interpreter. Also create the directory \Efi\Stdlib\lib\Lua on your ESP, this is the default location Lua will look for scripts. There are a few sample scripts in the Lua source tree’s AppPkg/Applications/Lua/scripts directory, or you can ignore these and just add your own scripts in this directory.
One known issue: EOF characters, ^D or ^Z, are not properly recognized by the console and can’t be used to terminate an application. Use os.exit() to exit Lua.
This means you can write UEFI scripts in UEFI Shell scripts, Python, and Lua, given the language options on TianoCore. (There’s also a Ruby port outside TianoCore.org, more on that in an upcoming blog.)
From security perspective, you also need to worry about Lua language issues, too. The ESP is FAT-based on most vendors systems (except for Mac OS X which uses HFS+ and Linaro mentions using Ext2/Ext3 on their AArch64 port, but I haven’t confirmed this in code yet), so little ACL security to protect the global Lua binary and scripts on \Efi\Stdlib\lib\Lua. (Similar concerns with the Python for UEFI implementation.)
For more information, from the EDK-II trunk, see: