summaryrefslogtreecommitdiffstats
path: root/discover/grub2
Commit message (Collapse)AuthorAgeFilesLines
...
* discover/grub2: Use script_env_set when initialising the environmentJeremy Kerr2014-01-301-6/+2
| | | | | | | | | | No need to duplicate the environment-adding code in init_env, as we can just use script_env_set. Since script_env_set does its own talloc, we don't need to talloc our strings here either. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub: Use --id values for default option detectionBen Stoltz2014-01-171-7/+24
| | | | | | | | Fix Petitboot's grub.cfg parser to handle --id=label argument to menuentry, and use it (in preference to the option name) when looking for a default option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fixes for bison 3.xJeremy Kerr2013-12-032-7/+7
| | | | | | | | | | YYLEX_PARAM is removed in bison 3.0, so we need to pass the scanner param directly through yyparse (rather than referencing parser->scanner). Unfortunately, we don't have the lexer header available at the time we declare yyparse, so we need to pass a void * here. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Populate $prefix from config file locationJeremy Kerr2013-11-274-5/+24
| | | | | | | Rather than always using the default prefix, we should determine it from the location of the grub2 config file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Use parser for a single parseJeremy Kerr2013-11-271-3/+3
| | | | | | | | | | Currently, we re-use a grub2 parser for different filenames, and will create one even if we find no matching files. This change only creates a parser if parser_request_file succeeds, and free() (and exits the parse) immediately after. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fix free in load_env commandJeremy Kerr2013-11-271-3/+3
| | | | | | We only need to free the buf if parser_request_file returned success. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fix indentation errorJeremy Kerr2013-11-271-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add support for -s and -f commandsJeremy Kerr2013-11-271-5/+36
| | | | | | | Implement -s and -f checks for grub, and test with the standard GRUB2 saved_default config. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* automake: Fixups for maintainer-cleanGeoff Levand2013-11-181-1/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib: consolidate util macros in util/util.hJeremy Kerr2013-11-132-2/+2
| | | | | | | This change groups the offsetof, container_of and ARRAY_SIZE macros in a single header file util/util.h. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix potentially-uninitialised variablesJeremy Kerr2013-11-131-1/+1
| | | | | | | We've been compiling with --enable-debug; this change fixes some problems exposed by the optimiser. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to explicitly request configuration filesNeelesh Gupta2013-11-061-6/+18
| | | | | | | | | | | | | | | | | | | Add a new function parser_request_url() to read the data from configuration files present remotely. We deprecate iterate_parser_files() and download_config() functions along with the 'filenames' and 'method' members of the 'parser' structure so that individual parsers would now require to request the configuration files data from the parser code and doesn't necessarily export the list of configuration files. Add the support to handle incoming DHCP event, done by passing all the relevant environment variables of the udhcpc to the discover code. Also, update the pxe parser code to populate the list of configuration file names as per PXELINUX convention of fallback names using mac and ip addresses of the booting machine. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Clean lexer.[ch]Jeremy Kerr2013-10-211-1/+2
| | | | | | `make distcheck` fails with a couple of failes remaining after clean. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow URL resourcesJeremy Kerr2013-10-142-3/+10
| | | | | | Allow URL-format specifiers for GRUB2 resources. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fix uninitialised yylinenoJeremy Kerr2013-10-041-0/+1
| | | | | | | | | Valgrind reports an invalid usage of an uninitialised var in yyerror, causing testcase failures. Initialise lineno before we start parsing. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement save_env commandJeremy Kerr2013-10-042-5/+166
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement load_envJeremy Kerr2013-10-013-0/+116
| | | | | | | Use the new parser_request_file API to access the GRUB environment block. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: strdup strings used in the environmentJeremy Kerr2013-10-011-4/+6
| | | | | | | Use a copy of the name & value pairs that we pass to the environment, as the data loaded from load_env will be talloc_free-ed. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add default prefixJeremy Kerr2013-10-011-1/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Clean up error-handling for grub2 parser & lexerJeremy Kerr2013-09-263-16/+19
| | | | | | | Rather than printf() & exit(), use the pb logging functions and abort the parse. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Reimplement default optionsJeremy Kerr2013-09-252-2/+24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fix uninitialised op variableJeremy Kerr2013-09-241-0/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Support var=value assignmentsJeremy Kerr2013-09-241-0/+12
| | | | | | We want to allow assignments outside of the 'set' builtin. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add true & false builtinsJeremy Kerr2013-09-241-0/+24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2/lexer: Require 1+ spaces for a TOKEN_DELIMJeremy Kerr2013-09-241-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add linux16 commandJeremy Kerr2013-09-241-0/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow both delimiters and EOLs after a "then" reserved wordJeremy Kerr2013-09-241-2/+4
| | | | | | | | | | | Putting an if-statement on one line should be possible: if true; then echo "true"; else echo "false"; fi To do this, we'll need to allow both EOLs and TOKEN_DELIM after then and else. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement test builtinJeremy Kerr2013-09-241-1/+117
| | | | | | A faily simple implementation now, and could do with some testing... Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add nops for unnecessary builtinsJeremy Kerr2013-09-241-0/+15
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement statement_block_executeJeremy Kerr2013-09-243-1/+12
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: unknown commands should failJeremy Kerr2013-09-241-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Populate option idsJeremy Kerr2013-09-241-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow EOF as a statement terminatorJeremy Kerr2013-09-241-1/+4
| | | | | | Files may not have a trailing newline. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add print_tokenJeremy Kerr2013-09-241-0/+10
| | | | | | For better trace output. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: fix comment handlingJeremy Kerr2013-09-241-3/+2
| | | | | | | Remove '#' from the list of word chars. Also, don't need the '$' char in the comment regex Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'elif'Jeremy Kerr2013-09-243-9/+31
| | | | | | | Rather than just having one conditional in an if statement, we use a list of conditionals instead. This allows us to implement elif. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Create 'conditional' statementsJeremy Kerr2013-09-243-31/+65
| | | | | | | | Rather than holding the condition and conditional-statements in struct grub2_statment_if, create a new conditional type that contains these. We can then use this to implement elif statements. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow empty statementsJeremy Kerr2013-09-241-14/+12
| | | | | | | | Re-arrange the script/statements parse rules to allow empty statements. We also move the EOL token out of the 'statement' definition, and use it to separate 'statements'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement submenuJeremy Kerr2013-09-242-0/+8
| | | | | | | Just recurse into the submenu items, as we flatten everything into the one menu. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add function supportJeremy Kerr2013-09-243-0/+57
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Improve error handlingJeremy Kerr2013-09-242-2/+6
| | | | | | | Only run the script if the parse succeeded, and and improve the error reporting by enabling verbose errors and line numbers. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'else' blocksJeremy Kerr2013-09-242-0/+10
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'search' commandJeremy Kerr2013-09-241-0/+30
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'linux' & 'initrd' commandsJeremy Kerr2013-09-243-10/+78
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Function infrastructure improvementsJeremy Kerr2013-09-243-38/+52
| | | | | | | | For user-defined functions, we'll need a data pointer to the function's execution callback. Add this as a void *, and change references from 'command' to 'function'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add option state in menuentry processingJeremy Kerr2013-09-242-0/+17
| | | | | | | This will allow menuentry-specific commands to populate boot option data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add a reference to the context from grub2_scriptJeremy Kerr2013-09-243-10/+15
| | | | | | We'll need the context to add boot options. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Hook up flex/bison parser to discover serverJeremy Kerr2013-09-246-1/+196
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Move parser-api definitions to parser.yJeremy Kerr2013-09-242-111/+109
| | | | | | No need for a separate file here. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement multiple-arv variable splittingJeremy Kerr2013-09-243-17/+101
| | | | | | | If we expand a variable containing word-delimiter chars, we need to create new argv items. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud