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). -- Alex Bligh boot file: prompt 1 default xen4 timeout 100 serial 0 115200 display boot.msg label xen4 kernel lua.c32 append default.lua ipappend 3 default.lua: io.write("Lua ",_VERSION," chaining Xen4 through mboot.c32\n") bootstr = "images/xvp/xen-4.3-mini_4.3.0-20130729173244.gz noreboot dom0_mem=3072M,max:3072M,min:3072M guest_loglvl=none com1=115200,8n1 vga=text-80x60 console=com1 --- images/xvp/vmlinuz-3.8.0-32-generic console=hvc0 console=tty0 apparmor=0 vga=773 " .. arg[1] .. " " .. arg[2] .. " --- images/xvp/extility-node-4.0-2.img" io.write("Running " .. bootstr .. "\n") syslinux.run_kernel_image("mboot.c32", bootstr, 0, 0)
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
Alex Bligh <alex at alex.org.uk> writes:> 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)Yes. It's mentioned in com32/lua/doc/syslinux.asc.> 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 thatOK, I'll queue a patch for that.> or even better if it could be persuaded to autodetect based on file > extension as the rest of the system does.I'm not sure what changed exactly, but you can use run_command() instead, or pass a type specifier to run_kernel_image(): sl.run_kernel_image(".com32 mboot", bootstr, 0, 0) -- Regards, Feri.