1 Syslinux LUA User Guide
2 =======================
3 Marcel Ritter <Marcel.Ritter@rrze.uni-erlangen.de>
8 Running +lua.c32+ only results in an interactive shell.
9 ......................................................
11 ......................................................
13 By using the +APPEND+ parameter you can specify a lua
14 script to be executed:
15 ......................................................
18 ......................................................
28 Returns version string
30 .syslinux.derivative()
32 Returns running Syslinux's derivative (ISOLINUX, PXELINUX or SYSLINUX).
33 See com32/lua/test/syslinux-derivative.lua for an example.
41 Sleep for +ms+ milliseconds
45 Execute syslinux command line +command+.
48 ......................................................
49 syslinux.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
50 ......................................................
64 .boot_linux(kernel, cmdline, [mem_limit], [videomode])
68 .run_kernel_image(kernel, cmdline, ipappend_flags, type)
74 Load file +filename+ (via TFTP)
78 Return size of +file+ (loaded by loadfile())
82 Return name of +file+ (loaded by loadfile())
86 Return empty initramfs object
88 .initramfs_load_archive(initramfs, filename)
90 Load contents of +filename+ into +initramfs+. Initialize
91 +initramfs+ with initramfs_init() before use.
93 .initramfs_add_file(initramfs, file)
95 Adds +file+ to +initramfs+. +initramfs+ needs to be
96 initialized, +file+ has been loaded by loadfile().
99 ......................................................
101 printf = function(s,...)
102 return io.write(s:format(...))
105 kernel = syslinux.loadfile("/SuSE-11.1/x86_64/linux")
107 printf("Filename/size: %s %d\n", syslinux.filename(kernel), syslinux.filesize(kernel))
109 initrd = syslinux.loadfile("/SuSE-11.1/x86_64/initrd")
111 printf("Filename/size: %s %d\n", syslinux.filename(initrd), syslinux.filesize(initrd))
113 initrd = syslinux.initramfs_init()
114 syslinux.initramfs_load_archive(initrd, "/SuSE-11.1/x86_64/initrd");
116 syslinux.boot_it(kernel, initrd, "init=/bin/bash")
120 ......................................................
129 Returns +true+ if DMI is supported on machine, +false+ otherwise.
133 Returns a list if key-value pairs. The key is one of the DMI property strings:
137 ......................................................
138 if (dmi.supported()) then
140 dmitable = dmi.gettable()
142 for k,v in pairs(dmitable) do
146 print(dmitable["system.manufacturer"])
147 print(dmitable["system.product_name"])
148 print(dmitable["bios.bios_revision"])
150 if ( string.match(dmitable["system.product_name"], "ESPRIMO P7935") ) then
152 syslinux.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
154 print("Does not match")
155 syslinux.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
160 ......................................................
168 Return list of value pairs (device_index, device) of all PCI devices.
170 .pci_getidlist(filename)
172 Load a tab separated list of PCI IDs and their description.
173 Sample files can be found here: http://pciids.sourceforge.net/
177 ......................................................
179 printf = function(s,...)
180 return io.write(s:format(...))
184 pciinfo = pci.getinfo()
186 -- get plain text device description
187 pciids = pci.getidlist("/pci.ids")
189 -- list all pci busses
190 for dind,device in pairs(pciinfo) do
192 -- search for device description
193 search = string.format("%04x%04x", device['vendor'], device['product'])
195 printf(" %04x:%04x:%04x:%04x = ", device['vendor'], device['product'],
196 device['sub_vendor'], device['sub_product'])
198 if ( pciids[search] ) then
199 printf("%s\n", pciids[search])
205 -- print(pciids["8086"])
206 -- print(pciids["10543009"])
207 -- print(pciids["00700003"])
208 -- print(pciids["0070e817"])
209 -- print(pciids["1002437a1002437a"])
210 ......................................................
218 Return list of available VESA modes.
221 ......................................................
223 printf = function(s,...)
224 return io.write(s:format(...))
227 -- list available vesa modes
228 -- only one supported right now, not of much use
229 modes = vesa.getmodes()
231 for mind,mode in pairs(modes) do
232 printf("%04x: %dx%dx%d\n", mode['mode'], mode['hres'], mode['vres'], mode['bpp'])
234 ......................................................
239 Set (only currently supported) VESA mode.
241 .load_background(filename)
243 Load +filename+ from TFTP, and use it as background image.
246 ......................................................
248 printf = function(s,...)
249 return io.write(s:format(...))
252 -- lets go to graphics land
255 printf("Hello World! - VESA mode")
257 -- some text to display "typing style"
259 From syslinux GSOC 2009 home page:
261 Finish the Lua engine
263 We already have a Lua interpreter integrated with the Syslinux build. However, right now it is not very useful. We need to create a set of bindings to the Syslinux functionality, and have an array of documentation and examples so users can use them.
265 This is not a documentation project, but the documentation deliverable will be particularly important for this one, since the intended target is system administrators, not developers.
270 -- keep in mind: background change will not erase text!
273 vesa.load_background("/background1.jpg")
277 for i = 1, #textline do
278 local c = textline:sub(i,i)
285 ......................................................