summaryrefslogtreecommitdiffstats
path: root/discover/yaboot-parser.c
Commit message (Collapse)AuthorAgeFilesLines
* Various fixups and checks to make scan-build happySamuel Mendoza-Jonas2019-05-301-0/+4
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Fix pb-discover segfaults caused by list corruption.Brandon Bergren2018-06-121-0/+1
| | | | | | | | | | | | | | I was seeing list corruption and segfaults in pb-discover on my Talos II when using both yaboot and kboot config files on the same device. My assumption is that discover_context_add_boot_option() was being called on the same pointer more than once. So, null the pointer right after the call. The ownership was transferred anyway so the parsers should not keep it around. Signed-off-by: Brandon Bergren <git@bdragon.rtk0.net> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/status: Add parse status for GRUB2, yaboot & kboot parsersJeremy Kerr2016-12-201-0/+4
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Add support for GPG signature enforcement on bootedtpearson@raptorengineering.com2016-08-261-0/+7
| | | | | | | | | | | | | kernels and related blobs This can be used to implement a form of organization-controlled secure boot, whereby kernels may be loaded from a variety of sources but they will only boot if a valid signature file is found for each component, and only if the signature is listed in the /etc/pb-lockdown file. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> (Minor build fixes and gpgme.m4, comment on secure boot in gpg.c)
* discover/yaboot: support lilo & silo for x86 and Sparc.Jeff Bailey2014-04-231-0/+4
| | | | | | | | | The yaboot.conf format is essentially the same format as silo.conf and lilo.conf, especially if the author isn't using OF paths. This is a cheap way of getting support for silo and lilo. Signed-off-by: Jeff Bailey <jeffbailey@google.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Remove known_names listJeremy Kerr2014-01-141-26/+2
| | | | | | | | | | | The known_names list only duplicates the arg matching we do in the body of the parser, and so introduces a problem when the array becomes out of sync. We drop the priority of the "unknown name" messages to pb_debug, as this isn't really imporant unless we're debugging. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Clear globals_done when we see an image definitionJeremy Kerr2014-01-141-3/+2
| | | | | | | | | | Currently, we have a bug where a 'known_name' that appears before an image section will cause globals_done to be set, and we don't see any further global variables. This change sets globals_done only once we see an image section. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Use AC_GNU_SOURCEJeremy Kerr2013-12-181-1/+3
| | | | | | | Rather than #defining _GNU_SOURCE in our .c files, we can define this from config.h instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Fix assertion failure on empty yaboot filesJeremy Kerr2013-12-101-1/+2
| | | | | | | | | | yaboot configuration files with no option will cause an assertion failure (or segfault), as we unconditionally call yaboot_finish(). Check for the presence of an option in yaboot_finish() instead of asserting. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to explicitly request configuration filesNeelesh Gupta2013-11-061-7/+19
| | | | | | | | | | | | | | | | | | | 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/yaboot-parser: Handle 'partition=' directive overrideNeelesh Gupta2013-08-301-4/+16
| | | | | | | | | | | | | | | In a yaboot conf file, we may see a device= directive that actually specifies a partition (eg, sda1) rather than the underlying block device (sda). If we then encounter a partition= directive, we don't handle the resolution of the partition correctly, as we simply append the partition number to the device= string. This change implements a smarter handling of the partition= directive, where we strip away any partition information from the device= parameter first. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: implement default optionsJeremy Kerr2013-08-071-0/+7
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: fix device parsingJeremy Kerr2013-08-071-67/+72
| | | | | | | | | | | | | | | A couple of fixes for yaboot's device-handling code. Firstly, we need to use 'device=' rather than 'root=', as the latter is purely for ybin, to define where the yaboot binary goes. Secondly, we need to respect global and option-specific device= parameters. To do this, we keep all boot_image and initrd strings in the state, and create the actual resources in yaboot_finish. Add a test for all override cases, and fix the incorrect boot= parsing in the rh8 test. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Allow all image options to be overridden by global optionsJeremy Kerr2013-08-071-29/+73
| | | | | | | | | | All of the image options should be overridable by global options. Instead of building the boot_args during yaboot_process_pair, we add discovered data into the state struct, then create the boot args from this data during yaboot_finish Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser/yaboot: Fix check for image presenceJeremy Kerr2013-07-311-1/+2
| | | | | | | | | | In the cleanup of yaboot option state, 3fb8fb6fb, we change from checking opt->boot_image to opt, to indicate that we're parsing an image section. We missed one check, which is causing a segfault due to the null opt. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Always associate resources with a boot optionJeremy Kerr2013-05-151-7/+8
| | | | | | | | | | | We should always be tallocing resources to a boot option context; anything else (for example, the discover context) may have a different lifetime. In order to enforce this, we change the void *ctx argument to the context_create functions to a struct discover_boot_option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Fix boot option stateJeremy Kerr2013-05-151-12/+13
| | | | | | We're only picking up every second boot option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: populate resolve_resource membersJeremy Kerr2013-05-061-4/+5
| | | | | | We're only dealing with devpath resources at the moment. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add configuration methodsJeremy Kerr2013-04-291-0/+1
| | | | | | | | | | | | We'd like to be able to download petitboot configurations from other sources (not just local files), but we'll need some way to indicate to the parsers that a chunk of config data is from a specific source. This change adds "configuration methods". At present, we have only one: CONF_METHOD_LOCAL_FILE. For any incoming configuration data, we only run parsers that have registered themselves with that configuration method. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: dynamically register parsersJeremy Kerr2013-04-291-1/+3
| | | | | | | | | | | | | | | Currently, we require all parsers to be defined in an array in parsers.c. This change removes this requirement, by introducting a register_parser() macro, which adds a constructor to register the parser with the core parser infrastructure. Because each parser no longer resolves an undefined symbol, we need to use a `ld -r` object for libparser, instead of using libtool, which creates a .a (and hence has no parsers included). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to emit resources rather than filenamesJeremy Kerr2013-04-291-82/+72
| | | | | | | | | | | | | | | | | | | | | | | | This change switches the parsers over to populate the resources in discover_boot_option, rather than the string parameters in boot_option. To do this, we need a few things: * Add struct resources to discover_boot_option for the boot_image, initrd and icon data. * Have the parsers populate the resources, rather than the strings. Currently, parsers can all use the devpath resource type. * Add a resolve_resource callback to parsers; this is how the device handler will attempt to resolve resources. * Change load_file to load_url, as we should be only accessing (resolved) resources by URLs. This then allows us to remove the mount map, and associated lookup code, as well as the UUID and label links to devices. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Introduce a container type for boot optionsJeremy Kerr2013-04-291-46/+51
| | | | | | | | | This change introduces a new type, struct discover_boot_option. Like struct discover_device adds discover-specific data to struct device, struct discover_boot_option allows the discover server to store more than just the boot option strings for a boot option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: change parser.parse to accept a bufferJeremy Kerr2013-04-291-5/+3
| | | | | | | Rather than having each of the parsers do their own open(), read(), etc, use the registered filenames array to find & open parser conf files. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: Add filenames to struct parserJeremy Kerr2013-04-291-1/+5
| | | | | | | In preparation of moving file handling to the discover core (rather than the parsers), include the conf file names in struct parser. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Separate temporary and permanent device dataJeremy Kerr2013-04-161-10/+11
| | | | | | | | | | | At present, we keep both permanent (eg links/n_links) and temporary (event) data in struct discover_context. This change makes discover_context a temporary structure, just used during actual device discovery. Once discovery is complete, the permanent data (discover_device) is "committed" to the device handler. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/types: Create common file for type definitionsJeremy Kerr2013-04-101-1/+1
| | | | | | | | | | | | The device and boot_option types are defined in pb-protocol.h, but aren't really specific to the procotol. This means a lot of non-messaging-related files are #including the protocol definitions unnecessarily. This change separates the types out into lib/types/types.h. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add new member get_pair to conf parser contextGeoff Levand2012-03-181-0/+1
| | | | | | | | To allow parsers more control over finding paramerter pairs add a new member get_pair to the parser struct conf_context. Initialize get_pair=conf_get_pair_equal for existing parsers. Signed-off-by: Geoff Levand <geoff@infradead.org>
* Use static array for parsersGeoff Levand2012-03-161-1/+1
| | | | | | | | | Change the parser structure array implementation from using an array in a seperate parsers section to a static array of pointers in parser.c. Parser priority is now set by the position in the new parsers array. Signed-off-by: Geoff Levand <geoff@infradead.org>
* Iterate over all conf file parsersGeoff Levand2009-07-091-1/+1
| | | | Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Use yaboot global boot optionGeoff Levand2009-07-091-7/+44
| | | | | | | Use any yaboot global boot option in preference to the yaboot.conf device path. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Fix parsing for OpenSUSEGeoff Levand2009-07-091-22/+44
| | | | | | | Fix the special yaboot.conf parsing needed for the OpenSUSE install CD. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Zero parser globals before useGeoff Levand2009-07-091-0/+1
| | | | Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Check if yaboot.conf files are emptyGeoff Levand2009-06-301-1/+6
| | | | | | | Add a yaboot parser check to ignore empty yaboot.conf files. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Hookup yaboot parserGeoff Levand2009-03-301-200/+221
| | | | | | | | | Hookup the yaboot parser to the new parser-conf routines. This update eliminates the dependency on yaboot-cnf.h and yaboot-cnf.c. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Initial support for multiple UIsJeremy Kerr2008-12-151-0/+235
Move the device discovery code from separate udev helpers to a single process to listen on two sockets: one SOCK_DGRAM for incoming udev events, and one SOCK_STREAM for UIs to connect. Initial support for client/server infrastructure, still need to wire-up the udev messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud