Using save/ to keep downloads and partial progress
[rrq/tiniest.git] / muffin.lua
1 local sl = require "syslinux"
2 local vesa = require "vesa"
3 local dmi = require "dmi"
4 local pci = require "pci"
5
6 vesa.setmode("800x600")
7 --vesa.load_background "sample2.jpg"
8
9 for c in string.gmatch ("Hello World! - VESA mode", ".") do
10     io.write (c)
11     sl.msleep(10)
12 end
13
14 io.write("\n")
15
16
17 -- cmdline(ix) = concatenates the command line arguments from
18 -- the index ix and up, with space separation
19 function cmdline(ix)
20    local line = ""
21    while arg[ix] do
22       line = line .. " " .. arg[ix]
23       ix = ix + 1
24    end
25    return string.sub(line,2) -- drop the initial space
26 end
27
28 -- dumptable(tbl) = print table entries
29 function dumptable(name, tbl,vtype)
30    print("== begin "..name)
31    if tbl then
32       for k,v in pairs(tbl) do
33          if vtype == nill or type(v) == vtype then
34             print(k,v)
35          end
36       end
37    else
38       print(nil)
39    end
40    print( "== end " .. name )
41    return nil
42 end
43
44 -- dump_G(k) = print the value of _G[k]
45 function dump_G(k)
46    dumptable(k,_G[k],nil)
47    return nil
48 end
49
50 --[[
51 dumptable("tables",_G,"table")
52 dumptable("package.loaded",_G["package"]["loaded"], nil)
53 dumptable("pci.getidlist",pci.getidlist("/pci.ids"), nil)
54 ]]
55
56 -- [[
57 dmitable = dmi.gettable()
58 dumptable("dmitable",dmitable,nil)
59 --dumptable("dmitable.dmi_info",dmitable["dmi_info"],nil)
60 --]]
61
62 -- [[
63 -- dumptable("dmitable.system",dmitable.system,nil)
64 -- dumptable("dmitable.bios",dmitable.bios,nil)
65 --dumptable("dmitable.chassis",dmitable.chassis,nil)
66 --]]
67
68 print(arg[1].." "..cmdline(2))
69 x = sl.get_key(600000)
70
71 sl.boot_linux(arg[1],cmdline(2))
72
73 -- Return to vesamenu
74 sl.run_command("vesamenu")