[syslinux] lua not working on syslinux-6.03-pre18

Alex Bligh alex at alex.org.uk
Mon Jun 30 10:20:52 PDT 2014


On 30/06/2014 16:30, Alex Bligh wrote:
> I've upgraded from syslinux-4.05 to syslinux-6.03-pre18 (pre11 was the same)
> and am having some issues getting lua.c32 to work. I'm using lpxelinux.0
> if that's relevant.
> 
> My boot file and the contents of default.lua are below. As you can see they
> are fantastically simple. Essentially I'm just using lua to put the results
> of ipappend in the right place on the command line.
> 
> The symptom is that the two io.write()s work as expected, then I see:
> 
> default.lua:6: attempt to index global 'syslinux' (a nil value)
> 
> This would suggest that somehow the syslinux global is not defined,
> so run_kernel_image is not working. Is there some special magic I need
> to import this? This was working in 4.05 (albeit I have necessarily
> had to change some other stuff).


To follow up on my own email, it would appear two things have changed.

Firstly, this line:

   syslinux.run_kernel_image("mboot.c32", bootstr, 0, 0)

no longer works at all as is. I think it was broken (probably
intentionally) by this commit:

commit 4bbaf68cbf6c9a4c850f71b19bfb9604b9327efb
Author: Ferenc Wágner <wferi at niif.hu>
Date:   Sun Oct 13 22:30:16 2013 +0200

    lua: reactivate the syslinux extension module

    Under Lua 5.2 modules are not expected to set global variables
    to reduce namespace pollution. Explicit require() is preferred.


What you now need is something like:

   local sl = require "syslinux"
   sl.run_kernel_image("mboot.c32", bootstr, 0, 0)


Except that this ALSO won't work, because run_kernel_image is now
(it seems) much more fussy about image types, so the required
code is actually:

   local sl = require "syslinux"
   sl.run_kernel_image("mboot.c32", bootstr, 0, 7)

with 7 being the magic number as per:

   #define IMAGE_TYPE_COM32        7

It would be useful if there were some Lua constants for that or even
better if it could be persuaded to autodetect based on file extension
as the rest of the system does.

-- 
Alex Bligh


More information about the Syslinux mailing list