aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lua/doc/syslinux.asc
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lua/doc/syslinux.asc')
-rw-r--r--com32/lua/doc/syslinux.asc336
1 files changed, 149 insertions, 187 deletions
diff --git a/com32/lua/doc/syslinux.asc b/com32/lua/doc/syslinux.asc
index 424c51f1..6475d42f 100644
--- a/com32/lua/doc/syslinux.asc
+++ b/com32/lua/doc/syslinux.asc
@@ -23,270 +23,232 @@ Modules
Modules must be explicitly loaded into the namespace
before use, for example:
......................................................
-syslinux = require ("syslinux")
+local sl = require "syslinux"
......................................................
+Using +local+, as above, is good practice in scripts, but it must be
+omitted when working interactively.
SYSLINUX
~~~~~~~~
-.syslinux.version()
+version()::
+Return the Syslinux version string.
-Returns version string
+derivative()::
+Return the running Syslinux derivative
+(the string +ISOLINUX+, +PXELINUX+ or +SYSLINUX+).
-.syslinux.derivative()
+sleep(s)::
+Sleep for +s+ seconds.
-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)
+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")
+local sl = require "syslinux"
+sl.run_command "memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw"
......................................................
-.run_default()
+run_default()::
+Execute the default command in the configuration.
-FIXME
+local_boot(type)::
+Do a local boot. The +type+ values are described in the documentation
+of the LOCALBOOT configuration item.
-.local_boot()
+final_cleanup(flags)::
+Restore sane hardware and software status before booting. If +flags+
+is 3, keep the PXE and UNDI stacks in memory (see the _keeppxe_ option).
+Only needed in special circumstances.
-FIXME
+boot_linux(kernel[,cmdline])::
+Load and boot the Linux kernel at path +kernel+. Initramfs images are
+loaded according to the +initrd+ option in +cmdline+. The
++BOOT_IMAGE+ parameter is added to the command line with the value of
++kernel+.
-.final_cleanup()
+IMAGE_TYPE::
+A table mapping the various kernel type strings to the integer +type+
+parameter of +run_kernel_image()+.
-FIXME
+run_kernel_image(kernel, cmdline, ipappend_flags, type)::
+Load the specified +kernel+ and run it with +cmdline+. See also the
+documentation of the IPAPPEND configuration item; +type+ is one of
+the values of the +IMAGE_TYPE+ table.
-.boot_linux(kernel, cmdline, [mem_limit], [videomode])
+loadfile(filename)::
+Return a _file_ object with the contents of file +filename+ loaded.
+Its methods are:
-FIXME
+size():::
+Return the size of a loaded _file_.
-.run_kernel_image(kernel, cmdline, ipappend_flags, type)
+name():::
+Return the name of a loaded _file_.
-FIXME
+initramfs()::
+Return an empty _initramfs_ object. Its methods are:
-.loadfile(filname)
+load(filename):::
+Load contents of +filename+ into an _initramfs_ and return the
+extended object.
-Load file +filename+ (via TFTP)
+add_file(filename[,data[,do_mkdir[,mode]]]):::
+Add +filename+ of +mode+ containing +data+ to an _initramfs_ and
+return the extended object.
+If +do_mkdir+, create parent directories, too. +mode+ defaults
+to 7*64+5*8+5 (which is 0755 in octal).
-.filesize(file)
+size():::
+Returns the current size of an _initramfs_.
-Return size of +file+ (loaded by loadfile())
+boot_it(kernel[,initramfs,[cmdline]])::
+Boot the loaded +kernel+ (a _file_ object) with an optional
++initramfs+ (an _initramfs_ object or +nil+) and +cmdline+.
-.filename(file)
+_Example_:
+......................................................
+local sl = require "syslinux"
-Return name of +file+ (loaded by loadfile())
+kernel = sl.loadfile "/SuSE-11.1/x86_64/linux"
+print("File name: " .. kernel:name() .. " size: " .. kernel:size())
-.in itramfs_init()
+initrd1 = "/SuSE-11.1/x86_64/initrd"
-Return empty initramfs object
+initrd = sl.initramfs()
+initrd:load(initrd1)
+print ("File name: " .. initrd1 .. " size: " .. initrd:size())
-.initramfs_load_archive(initramfs, filename)
+sl.boot_it(kernel, initrd, "init=/bin/bash")
+......................................................
-Load contents of +filename+ into +initramfs+. Initialize
-+initramfs+ with initramfs_init() before use.
+KEY::
+Table containing the return values of +get_key()+ for special (eg. function)
+keys.
-.initramfs_add_file(initramfs, file)
+KEY_CTRL(key)::
+Return the code for the Ctrl-modified version of the given ASCII code.
-Adds +file+ to +initramfs+. +initramfs+ needs to be
-initialized, +file+ has been loaded by loadfile().
+get_key(timeout)::
+Wait at most +timeout+ ms for a key press.
+Return the ASCII code of the pressed key, some other value of the +KEY+
+table, or +KEY.NONE+ on timeout.
-_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)
-
-......................................................
+config_file()::
+Return the path of the current config file.
+ipappend_strs()::
+Return the table of SYSAPPEND (formerly IPAPPEND) strings. See also
+the documentation of those configuration items.
+
+reboot([warm_boot])::
+Reboot. If +warm_boot+ is nonzero, perform a warm reboot.
DMI
~~~
-.dmi_supported()
-
-Returns +true+ if DMI is supported on machine, +false+ otherwise.
-
-.dmi_gettable()
+supported()::
+Return true if DMI is supported on machine, false otherwise.
-Returns a list if key-value pairs. The key is one of the DMI property strings:
-FIXME list
+gettable()::
+Return DMI info as a nested table.
_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
+local sl = require "syslinux"
+local dmi = require "dmi"
+
+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")
+ sl.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
+ else
+ print("Does not match")
+ sl.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)
+getinfo()::
+Return the table of all PCI devices, keyed by the device index.
+Each device is described by a table of its properties.
+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()
+local pci = require "pci"
--- 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
+for dind, device in pairs (pci.getinfo()) do
+ local vendor = string.format ("%04x", device.vendor)
+ local main_id = vendor .. string.format ("%04x", device.product)
+ local sub_id = string.format ("%04x%04x", device.sub_vendor, device.sub_product)
+ io.write (string.format ("%s:%s = %s %s (%s)\n", main_id, sub_id, pciids[vendor],
+ pciids[main_id], pciids[main_id .. sub_id] or "unknown subdevice"))
end
-
--- print(pciids["8086"])
--- print(pciids["10543009"])
--- print(pciids["00700003"])
--- print(pciids["0070e817"])
--- print(pciids["1002437a1002437a"])
......................................................
VESA
~~~~
-.getmodes()
-
+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
-......................................................
+local vesa = require "vesa"
+for mind,mode in pairs(vesa.getmodes()) do
+ print (string.format ("%04x: %dx%dx%d", mode.mode, mode.hres, mode.vres, mode.bpp))
+end
+......................................................
-.setmode()
-
-Set (only currently supported) VESA mode.
-
-.load_background(filename)
+setmode()::
+Set the 640x480 VESA mode.
-Load +filename+ from TFTP, and use it as background image.
+load_background(filename)::
+Load +filename+ (a PNG, JPEG or LSS-16 format image), and tile it as
+background image. The text already present is not erased.
_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)
+local sl = require "syslinux"
+local vesa = require "vesa"
-......................................................
+vesa.setmode()
+vesa.load_background "sample2.jpg"
+for c in string.gmatch ("Hello World! - VESA mode", ".") do
+ io.write (c)
+ sl.msleep(200)
+end
+
+vesa.load_background "PXE-RRZE_small.jpg"
+sl.sleep(3)
+......................................................