Hi, the first attached patch extends the argument parsing code to allow (shell like) spaces. A config like LABEL BIOSupdate KERNEL dmiselect.c32 APPEND "ESPRIMO P5925" "memdisk initrd=/dos/FSC-E5925.img raw" will result in args[]: ESPRIMO P5925 memdisk initrd=/dos/FSC-E5925.img raw instead of (current code): "ESPRIMO P5925" "memdisk initrd=/dos/FSC-E5925.img raw" What's that good for? Example code can be found in dmiselest.c32 (second patch). This c32 module uses code from dmitest to check the current hardware it's running on. You can specify a list of known "system names" and a command line to execute if the machine type matches. The test scripts is used to apply BIOS updates to different kinds of machines, without the need to select the correct image yourself. Other usage scenarios should be easy to find. Let me know if I can do something to get this merged into syslinux. Bye, Marcel -------------- next part -------------- A non-text attachment was scrubbed... Name: syslinux-3.72-args.diff Type: text/x-patch Size: 857 bytes Desc: not available URL: <http://www.zytor.com/pipermail/syslinux/attachments/20081204/ffcf9bbb/attachment.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: syslinux-3.72-dmiselect.diff Type: text/x-patch Size: 4430 bytes Desc: not available URL: <http://www.zytor.com/pipermail/syslinux/attachments/20081204/ffcf9bbb/attachment-0001.bin>
On Thu, Dec 4, 2008 at 9:15 AM, Marcel Ritter <Marcel.Ritter at rrze.uni-erlangen.de> wrote:> Hi, > > the first attached patch extends the argument parsing code to allow (shell > like) spaces. A config like >Nice idea.> > What's that good for? Example code can be found in dmiselest.c32 (second > patch). > > This c32 module uses code from dmitest to check the current hardware > it's running on. > You can specify a list of known "system names" and a command line to > execute if the > machine type matches. >Nice. I can think of another enhancement, though (probably better as another module, say dmiselbios.c32 or dmiselectbios.c32). If the parameters were triples instead of pairs, you could feed it a BIOS version string and compare the string values to choose whether to run the BIOS updater. I'd love to be able to do this on systems in my organization (except I'll have to figure out how to automate the installer).> > Let me know if I can do something to get this merged into syslinux. >Did you read doc/SubmittingPatches.txt? -- "No one ever says, 'I can't read that ASCII E-mail you sent me.'"
On Thu, Dec 04, 2008 at 03:15:14PM +0100, Marcel Ritter wrote:> + * dmiselect.c > + * > + * Run command depending on systems DMI information (example: system's > + * product name. Options are pairs of value: <system name> <action>. > + * > + * Usage: > + * > + * label BIOSupdate > + * kernel dmiselect.c32 > + * append "ESPRIMO P5925" "memdisk initrd=/dos/FSC-E5925.img raw" "ESPRIMO P7935" "memdisk initrd=/dos/FSC-P7935-108.img raw"Good idea (unfortunately, not all machines can be flashed with memdisk due to compatibility issues with protected mode); however, the interface using a single long command line is not ideal. The ethersel.c32 module does a similar thing with PCI device IDs, but reads the PCI ID list from a file. IMHO this is better than using a long command line (which currently has a 2047 character limit). Also it would be nice to have support for matching other DMI strings, not only system.product_name - so the file format should not have just two fields per line. E.g., something like this: # DMI system.product_name "ESPRIMO P5925" -- "memdisk initrd=/dos/FSC-E5925.img raw" # DMI system.product_name "ESPRIMO P7935" -- "memdisk initrd=/dos/FSC-P7935-108.img raw" Other things might be possible - e.g., comparing bios.version with strvercmp() (if the format used by the vendor allows it); so maybe the current "starts_with" comparison operation should be made explicit: # DMI system.product_name starts_with "ESPRIMO P5925" -- "memdisk initrd=/dos/FSC-E5925.img raw" # DMI system.product_name starts_with "ESPRIMO P7935" -- "memdisk initrd=/dos/FSC-P7935-108.img raw" (and later add operations like "version_le", "string_le", etc.). -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: <http://www.zytor.com/pipermail/syslinux/attachments/20081207/ebe9a6d8/attachment.sig>
Sergey Vlasov wrote:> > Good idea (unfortunately, not all machines can be flashed with memdisk > due to compatibility issues with protected mode); however, the > interface using a single long command line is not ideal. The > ethersel.c32 module does a similar thing with PCI device IDs, but > reads the PCI ID list from a file. IMHO this is better than using a > long command line (which currently has a 2047 character limit). > > Also it would be nice to have support for matching other DMI strings, > not only system.product_name - so the file format should not have just > two fields per line. E.g., something like this: > > # DMI system.product_name "ESPRIMO P5925" -- "memdisk initrd=/dos/FSC-E5925.img raw" > # DMI system.product_name "ESPRIMO P7935" -- "memdisk initrd=/dos/FSC-P7935-108.img raw" > > Other things might be possible - e.g., comparing bios.version with > strvercmp() (if the format used by the vendor allows it); so maybe the > current "starts_with" comparison operation should be made explicit: > > # DMI system.product_name starts_with "ESPRIMO P5925" -- "memdisk initrd=/dos/FSC-E5925.img raw" > # DMI system.product_name starts_with "ESPRIMO P7935" -- "memdisk initrd=/dos/FSC-P7935-108.img raw" > > (and later add operations like "version_le", "string_le", etc.). >Ultimately, we really do need a scripting language, i.e. hooking this stuff up to the already-implemented Lua interpreter. -hpa