[syslinux:master] lua: move the automenu test from the boot_linux to the boot_it binding
syslinux-bot for Ferenc Wágner
wferi at niif.hu
Sat Feb 14 11:09:31 PST 2015
Commit-ID: 6b68a381be780b83a1df0033fd82819a6d642676
Gitweb: http://www.syslinux.org/commit/6b68a381be780b83a1df0033fd82819a6d642676
Author: Ferenc Wágner <wferi at niif.hu>
AuthorDate: Mon, 13 Oct 2014 12:31:47 +0200
Committer: Ferenc Wágner <wferi at niif.hu>
CommitDate: Mon, 13 Oct 2014 12:44:15 +0200
lua: move the automenu test from the boot_linux to the boot_it binding
Signed-off-by: Ferenc Wágner <wferi at niif.hu>
---
com32/lua/test/automenu.lua | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/com32/lua/test/automenu.lua b/com32/lua/test/automenu.lua
index 1e66cca..891adbc 100644
--- a/com32/lua/test/automenu.lua
+++ b/com32/lua/test/automenu.lua
@@ -26,6 +26,17 @@ local function modifiers ()
return (single and " single" or "") .. ({" quiet",""," debug"})[verbosity]
end
+local function boot (kernel_path, initrd_path, cmdline)
+ print ("Loading " .. kernel_path .. " ...")
+ local kernel = sl.loadfile (kernel_path)
+ local initrd
+ if (initrd_path) then
+ print ("Loading " .. initrd_path .. " ...")
+ initrd = sl.initramfs():load (initrd_path)
+ end
+ sl.boot_it (kernel, initrd, cmdline)
+end
+
local function scan (params)
local sep = string.sub (params.dir, -1) == "/" and "" or "/"
if not params.items then params.items = {} end
@@ -35,14 +46,16 @@ local function scan (params)
local from,to,version = string.find (name, "^vmlinuz%-(.*)")
if from then
local initrd = params.dir .. sep .. "initrd.img-" .. version
- local initrd_param = ""
- if lfs.attributes (initrd, "size") then
- initrd_param = "initrd=" .. initrd .. " "
+ if not lfs.attributes (initrd, "size") then
+ initrd = nil
end
table.insert (params.items, {
- show = function () return name end,
+ show = function () return name .. (initrd and " +initrd" or "") end,
version = version,
- execute = function () sl.boot_linux (path, initrd_param .. params.append .. modifiers ()) end
+ execute = function ()
+ boot (path, initrd,
+ params.append .. modifiers ())
+ end
})
end
end
More information about the Syslinux-commits
mailing list