[syslinux] [PATCH] Implementation for sl_initramfs_add_file() in lua.c32

Fernando López flopez at linti.unlp.edu.ar
Tue Mar 29 13:12:59 PDT 2011


This is a possible implementation for syslinux.initramfs_add_file()
for the lua.c32 module, it adds a third parameter not documented, the
dst_filename as it is required for placing the new file in the
initramfs:
###########################################################
--- syslinux.orig/com32/lua/src/syslinux.c	2011-03-29 16:52:37.161106252 -0300
+++ syslinux/com32/lua/src/syslinux.c	2011-03-29 15:58:02.801113257 -0300
@@ -385,12 +385,10 @@ static int sl_initramfs_load_archive(lua
 static int sl_initramfs_add_file(lua_State * L)
 {
     struct initramfs *initramfs = luaL_checkudata(L, 1, SYSLINUX_FILE);
-    /* FIXME: This code is doing nothing */
-    //const char *filename = luaL_checkstring(L, 2);
-    void *file_data = NULL;
-    size_t file_len = 0;
-
-    return initramfs_add_file(initramfs, file_data, file_len,
file_len, "/testfile1", 0, 0755);
+    struct syslinux_file *file = luaL_checkudata(L, 2, SYSLINUX_FILE);
+    const char *dst_filename = luaL_checkstring(L, 3);
+    size_t file_len = file->size;
+    return initramfs_add_file(initramfs, file->data, file_len,
file_len, dst_filename, 0, 0755);
 }

 static int sl_boot_it(lua_State * L)
###########################################################

Applying this patch the lua code using this function should look like this:
syslinux.initramfs_add_file(initramfs, module, path)
where initramfs was created with syslinux.initramfs_init(), modules
has been loaded with syslinux.loadfile() and path is a string
containing the destintion path for the file.

-- 
Fernando Esteban Mariano López
Desarrollador de Lihuen / Lihuen Developer (http://lihuen.linti.unlp.edu.ar/)
Administrador del sitio Grid de la UNLP / UNLP's Grid site Administrator




More information about the Syslinux mailing list