1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
|
Syslinux LUA User Guide
=======================
Marcel Ritter <Marcel.Ritter@rrze.uni-erlangen.de>
Invocation
----------
Running +lua.c32+ only results in an interactive shell.
......................................................
KERNEL lua.c32
......................................................
By using the +APPEND+ parameter you can specify a lua
script to be executed:
......................................................
KERNEL lua.c32
APPEND /testit.lua
......................................................
Modules
-------
Modules must be explicitly loaded into the namespace
before use, for example:
......................................................
syslinux = require ("syslinux")
......................................................
SYSLINUX
~~~~~~~~
.syslinux.version()
Returns version string
.syslinux.derivative()
Returns running Syslinux's derivative (ISOLINUX, PXELINUX or SYSLINUX).
See com32/lua/test/syslinux-derivative.lua for an example.
.syslinux.sleep(s)
Sleep for +s+ seconds
.syslinux.msleep(ms)
Sleep for +ms+ milliseconds
.run_command(command)
Execute syslinux command line +command+.
_Example_:
......................................................
syslinux.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
......................................................
.run_default()
FIXME
.local_boot()
FIXME
.final_cleanup()
FIXME
.boot_linux(kernel, cmdline, [mem_limit], [videomode])
FIXME
.run_kernel_image(kernel, cmdline, ipappend_flags, type)
FIXME
.loadfile(filname)
Load file +filename+ (via TFTP)
.filesize(file)
Return size of +file+ (loaded by loadfile())
.filename(file)
Return name of +file+ (loaded by loadfile())
.in itramfs_init()
Return empty initramfs object
.initramfs_load_archive(initramfs, filename)
Load contents of +filename+ into +initramfs+. Initialize
+initramfs+ with initramfs_init() before use.
.initramfs_add_file(initramfs, file)
Adds +file+ to +initramfs+. +initramfs+ needs to be
initialized, +file+ has been loaded by loadfile().
_Example_:
......................................................
-- get nice output
printf = function(s,...)
return io.write(s:format(...))
end -- function
kernel = syslinux.loadfile("/SuSE-11.1/x86_64/linux")
printf("Filename/size: %s %d\n", syslinux.filename(kernel), syslinux.filesize(kernel))
initrd = syslinux.loadfile("/SuSE-11.1/x86_64/initrd")
printf("Filename/size: %s %d\n", syslinux.filename(initrd), syslinux.filesize(initrd))
initrd = syslinux.initramfs_init()
syslinux.initramfs_load_archive(initrd, "/SuSE-11.1/x86_64/initrd");
syslinux.boot_it(kernel, initrd, "init=/bin/bash")
syslinux.sleep(20)
......................................................
DMI
~~~
.dmi_supported()
Returns +true+ if DMI is supported on machine, +false+ otherwise.
.dmi_gettable()
Returns a list if key-value pairs. The key is one of the DMI property strings:
FIXME list
_Example_:
......................................................
if (dmi.supported()) then
dmitable = dmi.gettable()
for k,v in pairs(dmitable) do
print(k, v)
end
print(dmitable["system.manufacturer"])
print(dmitable["system.product_name"])
print(dmitable["bios.bios_revision"])
if ( string.match(dmitable["system.product_name"], "ESPRIMO P7935") ) then
print("Matches")
syslinux.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
else
print("Does not match")
syslinux.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
end
end
......................................................
PCI
~~~
.pci_getinfo()
Return list of value pairs (device_index, device) of all PCI devices.
.pci_getidlist(filename)
Load a tab separated list of PCI IDs and their description.
Sample files can be found here: http://pciids.sourceforge.net/
_Example_:
......................................................
-- get nice output
printf = function(s,...)
return io.write(s:format(...))
end
-- get device info
pciinfo = pci.getinfo()
-- get plain text device description
pciids = pci.getidlist("/pci.ids")
-- list all pci busses
for dind,device in pairs(pciinfo) do
-- search for device description
search = string.format("%04x%04x", device['vendor'], device['product'])
printf(" %04x:%04x:%04x:%04x = ", device['vendor'], device['product'],
device['sub_vendor'], device['sub_product'])
if ( pciids[search] ) then
printf("%s\n", pciids[search])
else
printf("Unknown\n")
end
end
-- print(pciids["8086"])
-- print(pciids["10543009"])
-- print(pciids["00700003"])
-- print(pciids["0070e817"])
-- print(pciids["1002437a1002437a"])
......................................................
VESA
~~~~
.getmodes()
Return list of available VESA modes.
_Example_:
......................................................
-- get nice output
printf = function(s,...)
return io.write(s:format(...))
end
-- list available vesa modes
-- only one supported right now, not of much use
modes = vesa.getmodes()
for mind,mode in pairs(modes) do
printf("%04x: %dx%dx%d\n", mode['mode'], mode['hres'], mode['vres'], mode['bpp'])
end
......................................................
.setmode()
Set (only currently supported) VESA mode.
.load_background(filename)
Load +filename+ from TFTP, and use it as background image.
_Example_:
......................................................
-- get nice output
printf = function(s,...)
return io.write(s:format(...))
end
-- lets go to graphics land
vesa.setmode()
printf("Hello World! - VESA mode")
-- some text to display "typing style"
textline=[[
From syslinux GSOC 2009 home page:
Finish the Lua engine
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.
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.
]]
-- do display loop
-- keep in mind: background change will not erase text!
while ( true ) do
vesa.load_background("/background1.jpg")
syslinux.sleep(1)
for i = 1, #textline do
local c = textline:sub(i,i)
printf("%s", c)
syslinux.msleep(200)
end
syslinux.sleep(10)
......................................................
|