[syslinux] Building a http query string including SMBIOS Serial Number to load a specific kernel

Leandro Becker stappers at stappers.nl
Tue Feb 23 10:36:05 PST 2016


On Mon, Feb 22, 2016 at 05:44:43PM +0100, Ferenc Wágner wrote:
> 
> Works fine for me with lpxelinux.0.  String concatenation is .. though,
> so fix that mistake of mine like
> 
> sl.run_command ("http://192.168.10.10/kernel.php?SN=" . serial . "...")
> -- 
> Regards,
> Feri.


My mistake :(
I was using pxelinux.0 instead of lpxelinux.0
Is now working fine.

For reference, this is my lua script:

-------------------------------------------------------------------
syslinux = require ("syslinux")
dmi = require ("dmi")

--get nice output
printf = function(s,...)
 return io.write(s:format(...))
end -- function

printf ("Getting SN from SMBIOS...\n")
dmi_table = dmi.gettable()
printf ("SN: %s\n", dmi_table.system.serial)

printf ("Loading kernel...\n")
kernel =
syslinux.loadfile("http://192.168.10.10/boot.php?type=kernel&NS="..dmi_table.system.serial
(
'http://192.168.10.10/boot.php?type=kernel&NS="..dmi_table.system.serial')
)
printf("Ok. Kernel file size %d\n", syslinux.filesize(kernel))

printf ("Loading initrd...\n")
initrdPath =
"http://192.168.10.10/boot.php?type=initrd&NS="..dmi_table.system.serial
(
'http://192.168.10.10/boot.php?type=initrd&NS="..dmi_table.system.serial')

initrd = syslinux.loadfile(initrdPath)
printf("Ok. Initrd file size %d\n", syslinux.filesize(initrd))

printf ("Booting...\n")
initramfs = syslinux.initramfs_init()
syslinux.initramfs_load_archive(initramfs, initrdPath)
syslinux.boot_it(kernel, initramfs, "boot=live config union=overlayfs
noswap edd=on nomodeset keyboard-model=abnt2 keyboard-layouts=br
locales=en_US.UTF-8 nosplash noeject
video=uvesafb:mode_option=800x600-16 i915.blacklist=yes
radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=no
fetch=ftp://192.168.10.10/filesystem.squashfs ocs_live_batch=\"no\"
ocs_prerun1=\"mount -t cifs //192.168.10.10/Clonezilla /home/partimag -o
user=cifsuser,password=cifspwd,sec=ntlm\" ocs_live_run=\"ocs-sr -g auto
-e1 auto -e2 -j2 -p true -batch restoredisk ask_user sda\"
ocs_live_extra_param=\"\"")
------------------------------------------------------------------------------

Thank you and my best regards to all!

Leandro Becker


More information about the Syslinux mailing list