summaryrefslogtreecommitdiffstats
path: root/discover
Commit message (Collapse)AuthorAgeFilesLines
* discover: Don't free URL in load_urlJeremy Kerr2013-07-231-1/+0
| | | | | | | | | | | | | Previously, load_url took a char * argument, from which it parsed a newly allocated URL, and freed the URL before returning. Commit 5be946c changed load_url (then load_file) to accept a parsed URL instead of a char *, but didn't remove the free. Any URLs passed to load_url are currently being unintionally free()ed. This change removes the invalid free. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: remove debug statementJeremy Kerr2013-07-231-1/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: Handle initrdsJeremy Kerr2013-07-231-1/+25
| | | | | | | We may see initrds specified on the kernel argument line, or as their own configuration directive. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe-parser: All options are name <space> value pairsJeremy Kerr2013-07-041-0/+3
| | | | | | Abort the pair parse if we don't have both a name and a value. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/device-handler: hook up autoboot_enabled config varJeremy Kerr2013-07-021-1/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix automake warningsGeoff Levand2013-06-301-4/+4
| | | | | | | | | | | | | Change the Makfile.am relocatable output files from automake _LIBRARIES to automake _PROGRAMS. Also, change the output file name extension from .o to .ro to better show these are relocatable files. Fixes automake warnings like these: discover/Makefile.am: `libparser.o' is not a standard library name discover/Makefile.am: did you mean `libparser.a'? Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover/boot: Allow boot hooks to alter boot dataJeremy Kerr2013-06-241-11/+86
| | | | | | | By exiting with status == 2, boot hooks can update boot data by printing name=value to stdout. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event: Fix incorrect calculation of param data lengthJeremy Kerr2013-06-241-12/+16
| | | | | | | | We're not accounting for the action in the event header (only the device string) when we pass the length of param data to event_parse_params. This means we walk past the end of the event data while parsing params. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Add boot hooksJeremy Kerr2013-06-241-0/+63
| | | | | | | | Add a method of running pre-boot hooks. Executable files in /etc/petitboot/boot.d/ are run (in order) before we start the boot process. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Put all boot params into a struct boot_taskJeremy Kerr2013-06-241-38/+43
| | | | | | This keeps all the boot-specific details in one place. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add pkgsysconfdirJeremy Kerr2013-06-241-0/+3
| | | | | | We'll need a sysconf dir to store the boot hooks. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add initial dtb supportGeoff Levand2013-06-244-13/+67
| | | | | | | Updates & fixes by Jeremy Kerr <jk@ozlabs.org>. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: bring network interfaces down in network_shutdownJeremy Kerr2013-06-241-3/+24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add network handlingJeremy Kerr2013-06-244-0/+445
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: Add pb-config moduleJeremy Kerr2013-06-241-0/+4
| | | | | | | | | Add a library for (name, value) configuration. Different storage backends are allowed (although currently hardcoded to powerpc nvram), and config is read-only at present. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add logging for default boot option behaviourJeremy Kerr2013-06-241-0/+6
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event: Allow empty param valuesJeremy Kerr2013-06-241-9/+11
| | | | | | | | | | Useful for specifying defaults: pb-event add@defaults name='Netboot' \ image=http://192.168.0.1/vmlinuz \ default Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add "cancel default boot" messagesJeremy Kerr2013-06-243-9/+49
| | | | | | | Allow the default boot process to be cancelled, via a message with action PB_PROTOCOL_ACTION_CANCEL_DEFAULT. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event: Allow user events to be defaultsJeremy Kerr2013-06-241-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add countdown before default bootJeremy Kerr2013-06-241-3/+31
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: implement default bootingJeremy Kerr2013-06-243-13/+51
| | | | | | | When we see a boot option with is_default set, store it in the handler and register a timeout waiter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Allow null boot commandJeremy Kerr2013-06-241-3/+3
| | | | | | If we're booting from a default option, we don't have a boot command. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: Add timeout waitersJeremy Kerr2013-06-243-5/+7
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add default option parsingJeremy Kerr2013-06-241-1/+39
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Send options to client in orderGeoff Levand2013-05-211-2/+2
| | | | | | | | Send the boot options to the client in the order discovered. This change is in follow up to inverting the order that the server saves the options internally. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover/grub2: remove uuid log messageJeremy Kerr2013-05-211-1/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: fix error handling from failed client writesJeremy Kerr2013-05-211-4/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix accept() return value checkJeremy Kerr2013-05-211-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: destroy client if message read failedJeremy Kerr2013-05-211-4/+11
| | | | | | | When a client disconnects, the read from the client's fd will return EOF. We should destroy the client in this situation. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Use list to hold parsersGeoff Levand2013-05-171-15/+21
| | | | | | | Now that we dynamically add parsers, we can use a list to hold them. Also simplifies the test_run_parser() routine. Signed-off-by: Geoff Levand <geoff@infradead.org>
* parser/grub2: Add parse for linux16Geoff Levand2013-05-171-1/+2
| | | | | | Ubuntu uses the linux16 symbol in thier conf files for memory test entries. Signed-off-by: Geoff Levand <geoff@infradead.org>
* parser/grub2: Better menuentry parsingGeoff Levand2013-05-171-6/+1
| | | | | | Grub2 menuentry entry text can use double or single quotes. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover/grub2: handle search commands to specify root filesystemsJeremy Kerr2013-05-161-5/+90
| | | | | | Add a resource type for grub, allowing us to parse search parameters. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/resource: Provide resolve_resource_against_deviceJeremy Kerr2013-05-162-6/+8
| | | | | | | | Any other implementation of resources will need to resolve againsst particular devices, so make resolve_devpath_against_device publically-accessible, and rename to not be devpath-specific. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: log cleanupJeremy Kerr2013-05-165-19/+26
| | | | | | | Remove some of the more noisy log messages, and add some information pertinent to device resolution events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Make device handler a little more testableJeremy Kerr2013-05-151-280/+307
| | | | | | | | | | | This change moves some of the device-handler code into an #ifdef-ed section, so we can easily drop the stuff that's not required for testing. Although the change is quite large, most of it is moving entire functions around. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Allow devices with no device_pathJeremy Kerr2013-05-151-1/+4
| | | | | | | | Devices that have been added via the user path may not have a device path. In this case, don't segfault in device_match_path, and break out of mount_device early. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Always associate resources with a boot optionJeremy Kerr2013-05-154-15/+19
| | | | | | | | | | | 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: Don't access bytes before the start of empty stringsJeremy Kerr2013-05-151-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Always add a NUL byte to config dataJeremy Kerr2013-05-151-1/+3
| | | | | | | conf_get_pair will read one-byte past the end of the conf buffer, so always NUL-terminate. 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>
* discover/udev: use devname (not devpath) for device IDsJeremy Kerr2013-05-151-1/+1
| | | | | | devnames are unique, and much shorter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add grub2/grub.cfg config fileJeremy Kerr2013-05-151-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: handle boot_option->device_id entirely within handlerJeremy Kerr2013-05-093-3/+4
| | | | | | | No need for parsers to populate (or forget to populate, in the case of most parsers) opt->device_id, as we should do it on finalise. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Setup event params from udev propertiesJeremy Kerr2013-05-091-16/+17
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event: Add event_set_paramJeremy Kerr2013-05-092-2/+27
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Don't print properties of skipped devicesJeremy Kerr2013-05-091-2/+2
| | | | | | This cleans up the log output a little. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Rework config stateJeremy Kerr2013-05-081-13/+10
| | | | | | | Rather than creating boot options pre-emptively, in two paths, just do it once when we see the menuentry option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't invert option discovery orderJeremy Kerr2013-05-081-1/+1
| | | | | | | | Keep options in the order that we discovered them in; this makes testing a little easier, as the options appear in the list in the same order as the config file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't resend all options to all clientsJeremy Kerr2013-05-071-2/+1
| | | | | | | | | | Currently, when a new UI client connects, we send all boot options to all clients. This results in existing clients getting duplicate add events. Instead, we only want to send existing boot options to the new client. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud