summaryrefslogtreecommitdiffstats
path: root/discover
Commit message (Collapse)AuthorAgeFilesLines
* discover: Reject ADD_URL actions without configured networkSamuel Mendoza-Jonas2014-09-041-0/+6
| | | | | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Implement PXE SYSAPPEND syntaxJeremy Kerr2014-08-251-1/+47
| | | | | | | This change implements SYSAPPEND/IPAPPEND 2, to add a BOOTIF argument to the kernel command line. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Fix incorrect device tree directoryJeremy Kerr2014-08-071-3/+8
| | | | | | | It's /proc/device-tree, not /proc/device_tree. Use a variable to hold this prefix. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add debug flag to configJeremy Kerr2014-08-053-0/+36
| | | | | | | | | | This change adds a debug flag to the config, and groups it under not-user-modifiable parts of struct config. This means we no longer need the pb-sysinfo helper, as the last remaining function (--debug-enabled) can be implemented with pb-config. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use platform code to read sysinfo type and identifierJeremy Kerr2014-08-054-35/+31
| | | | | | | | | | | | | | | | This change uses the platform-specific code to read the system type and identifier, rather than the pb-sysinfo utility. We introduce a new callback for struct platform: int (*get_sysinfo)(struct platform *, struct system_info *); - which populates struct system_info with appropriate information. This means that the system-specific code is kept in one place; rather than having powerpc-specific device-tree-reading code in the pb-sysinfo shell script. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: Move generic file-handling code to lib/Jeremy Kerr2014-08-056-155/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Move platform config to a .roJeremy Kerr2014-08-051-3/+10
| | | | | | | We want to allow an external utility to use the platform config code, so build it into a .ro, which is then linked to the discover code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: distinguish parser.h from grub2/parser.hJeremy Kerr2014-08-053-18/+18
| | | | | | | | | | | | | 'make distcheck' will do a 'make all' srcdir == objdir, then later a 'make check' sith srcdir != objdir. Since gcc's cpp always assumes that a source file's directory is first in the include paths, we may see discover/parser.h included when we wanted the generated discover/grub2/parser.h. This change renames the grub2 lexer and parser files, to work-around this behaviour, and fix 'make distcheck'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* automake: silence make outputJeremy Kerr2014-08-051-5/+2
| | | | | | | | | Currently, we get a lot of noise out of the build process; automake supports V={0,1}, which we can use to suppress the output a little. This needs a few cleanups for custom commands. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* autotools: Don't link udev into everythingJeremy Kerr2014-08-051-3/+2
| | | | | | | | By default, AC_CHECK_LIB will append to $LIBS, which is used for all link stages. Intstead, we should popuate $UDEV_LIBS, and just use that for the single pb-discover link stage. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* autotools: Use non-recursive makeJeremy Kerr2014-08-013-88/+90
| | | | | | | | | | | | With the current testing infrastructure, we don't have a strictly hierarchical set of dependencies. This causes problems with a recursive make, and means we have to hack around some of the dependencies. This change generates a single, top-level makefile from all of the Makefile.am fragments. We still need the po/ directory as a separate SUBDIR, but all others can be converted to non-recursive. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: add initialiser for config->safe_modeJeremy Kerr2014-08-011-0/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add missing includeJeremy Kerr2014-08-011-0/+1
| | | | | | We use setlocale() in device-handler.c, so we need locale.h Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add support for 'add-url' actionsSamuel Mendoza-Jonas2014-07-281-0/+7
| | | | | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Enable 'url' pb-eventsSamuel Mendoza-Jonas2014-07-285-0/+156
| | | | | | | | | | Adds a new option to pb-event; ./pb-event url@dev url=scheme://path/to/petitboot.conf Specifies a remote conf file to parse for boot options Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use translated strings for boot status messagesJeremy Kerr2014-07-282-13/+14
| | | | | | | Since we're operating in the correct locale now, we can send translated strings in the boot status messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add setlocale calls in discover serverJeremy Kerr2014-07-283-1/+33
| | | | | | | | We want the discover server to respect the configured language, so we'll need to add appropriate setlocale() calls. We use the config->lang setting to use any previously-saved language. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Add lang member to configJeremy Kerr2014-07-281-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Only update our config if the config_set succeeded.Jeremy Kerr2014-07-281-1/+6
| | | | | | | If config_set fails, we don't want to send the failed config out to clients. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add safe mode indicatorJeremy Kerr2014-07-221-0/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Configure safe mode from IPMI bootdev settingJeremy Kerr2014-07-221-0/+6
| | | | | | | An IPMI bootflags of 0x3 indicates a safe-mode boot. Use this to trigger petitboot's safe mode. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add safe modeJeremy Kerr2014-07-222-0/+13
| | | | | | | | | | | Safe mode configures the discover server to not start any device parsing; this can be used to diagnose any problems with early device handing. In safe mode, we don't initialise any of the device sources - udev, network and user events are disabled. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/powerpc: Parse & save default boot device parameterJeremy Kerr2014-07-211-0/+46
| | | | | | | This change implement load & save support for the default boot device configuration parameter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: check config.boot_device before setting a defaultJeremy Kerr2014-07-212-0/+21
| | | | | | If a default device is set, we only allow booting from that device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: allow separate lifetimes for network interfaces and discover devicesJeremy Kerr2014-07-213-1/+53
| | | | | | | | | | | | | We want the network code's network interfaces to (potentially) persist remove events. For example, discover devices may be removed by a user event (this happens during a udhcpc deconfig). In this case, we want the boot options to be removed, but the struct interface needs to stay present. This change adds network_(un)_register_device functions, to allow the device handler to detach from and attach to interfaces. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Set UUID for network interface devicesJeremy Kerr2014-07-171-0/+21
| | | | | | | We want to lookup network (as well as block) devices by UUID, so set one based on the MAC address. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: place countdown earlier in boot status messagesJeremy Kerr2014-07-161-1/+1
| | | | | | | | | | The boot status messages may be trimmed on the right-hand side; In this case, we'll lose the boot countdown. This change moves the boot countdown time to before the arbitrary-length label string. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe-parser: Remove unnecessary semicolonJeremy Kerr2014-07-161-1/+1
| | | | | | | We have an unnecessary semicolon on an empty for-loop, which causes a clang warning. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: leave udhcpc processes runningJeremy Kerr2014-06-301-2/+1
| | | | | | | | | | Currently, we start udhcpc with the '-n' argument, which means they'll exit if no lease is obtained. We'd prefer to leave the DHCP client running, so that any slow-to-initialise links are not left deconfigured. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Don't rely on NVRAM workingJeremy Kerr2014-06-301-5/+1
| | | | | | | | | Although we need nvram to save settings, we may be running on a nvram-less machine, but still need to detect as powerpc. This change removes the nvram check. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Fix incorrect udhcpc command if we have no platform definitionJeremy Kerr2014-06-301-1/+1
| | | | | | | | | | If we don't have a platform defined, we generate an invalid uchdpc command, as we've NULL-ed out the interface name. This change fixes the no-platform case to terminate *after* the interface name. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* grub2: fix empty file handlingJeremy Kerr2014-06-051-0/+3
| | | | | | | | | | | Currently, we have a bug when parsing zero-length files: we subtract one from the length to exclude the trailing NUL (added by read_file), but a zero-length file will result in a length of -1. This change adds an explicit exit if we're attempting to parse an empty file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/paths: Fix wget command with https and !DEBUGJeremy Kerr2014-06-051-2/+3
| | | | | | | | When DEBUG is undefed, we run out of wget arguments for loading https URLs. We need an extra element in the argv array to handle all possible arguments. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: don't free cancelled load tasksJeremy Kerr2014-05-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, we have a bug when a boot task with more than one load tasks is cancelled: 1) boot_cancel calls cleanup_cancellations, which performs a load_url_async_cancel on all load tasks. This sets the load tasks' states to LOAD_CANCELLED, and signals associated processes. 2) The first load task process completes, we get a load_url_process_exit callback. This then invokes cleanup_cancellations. 3) cleanup_cancellations then (incorrectly) frees the boot task (and hence freeing all pending load tasks) as no load tasks are in LOAD_ASYNC state (we set them all to LOAD_CANCELLED in step 1) 4) The actual completion for the second load task attempts to reference the now-freed task structure. This change fixes the issue by handing the LOAD_CANCELLED state properly - if we find a load task in this state, we consider the boot task still pending, and delay the free until all loads are complete. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover,ui: fix checks for debug optionJeremy Kerr2014-05-011-1/+1
| | | | | | We need to check for equality with opt_yes, not just check for non-zero. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* 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/udev: NULL return from udev_enumerate_get_list_entry isn't an errorJeremy Kerr2014-04-171-5/+0
| | | | | | | | | | A NULL return can mean the list is empty; don't return a failure from this case. udev_list_entry_foreach does a check for a NULL entry, so we'll do the correct thing in the following loop. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: fix double free on udev_init failuresJeremy Kerr2014-04-171-13/+13
| | | | | | | | | | | If the udev monitor or enumerate functions fail, we'll call the udev_unref and udev_monitor_unref functions twice: once in the cleanup path and once in the talloc destructor. This change moves all cleanup to the talloc destructor, so we only do the unrefs once. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix uninitialised var warningsJeremy Kerr2014-04-162-3/+3
| | | | | | | | | | | | | | We get a couple of uninitialised var warning when compiling with certain CFLAGS (-fprofile-arcs -ftest-coverage at this stage). In statement_if_execute: We'll never actually use this uninitialised (as there must be at least one conditional in the parsed statement), but we should address the warning nonetheless. As passed to strtok_r: strtok will initialise this, but it isn't obvious to the compiler. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* log: Allow runtime selection of 'debug' log levelJeremy Kerr2014-04-072-16/+20
| | | | | | | | | | | | | | | | | Currently, we need to compile with -DDEBUG to implement debug-level logging in the UIs and discover server. Since we may not be able to easily replace a system's petitboot binaries, this change introduces a -v|--verbose option to the discver server and ncurses UI, which enables debug at runtime. We also move some of the udev debug code out of an #ifdef DEBUG block. Since petitboot is generally started on boot, we also add a little infrastructure to pass -v to petitboot on certain system contitions: either petitboot.debug on the kernel command line, or a petitboot,debug? NVRAM property containing the value 'true'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: run udhcpc process in foreground modeJeremy Kerr2014-04-031-0/+1
| | | | | | | We don't want udhcpc processes to detach, otherwise we aren't able to stop the spawned background process, which we need to do on reinit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: flush addresses when bringing an interface downJeremy Kerr2014-04-021-0/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: expose discovery reinit over client/server protocolJeremy Kerr2014-04-023-1/+6
| | | | | | | Now that we can re-initialise the device handler, allow this to be triggered from UIs over the petitboot protocol. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: add reinit pathJeremy Kerr2014-04-024-1/+49
| | | | | | | | | | | | | Currently, changes to settings doesn't take effect while the discover server is running. This means we need to reboot for any changes (eg, to network settings) to take effect. This change introduces a reinit path. Triggered by a configuration update, this will cause the device handler to drop all of its devices (and boot options), and restart the discovery process from the device sources. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: move device sources to the device handlerJeremy Kerr2014-04-026-44/+53
| | | | | | | | | | | | | | | | | | | | Currently, the pb-discover main() function initialises the device handler and the device sources. We want to eventually be able to re-init the device sources, which will be initiated by the handler. In this case, the handler will need references to the sources. This change moves the creation of the device sources to be internal to the handler. This way, the device handler gets a reference to everything, without having to pass pointers around in main(). We also remove the _destroy functions, as we handle everything through talloc destructors, as all sources are parented to the handler. We also change user_event_init and udev_init to take the handler as the first ('context') argument, to make them consistent with network_init. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: duplicate devices aren't an errorJeremy Kerr2014-04-011-1/+1
| | | | | | | We don't need to error out of udev_handle_block_add if this is a duplicate UUID. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: don't propagate non-fatal errors from udev_processJeremy Kerr2014-04-011-10/+3
| | | | | | | | | | | | Currently, we have a bug where non-zero return codes from udev_handle_dev_* cause the udev worker from deregistering from the waiter poll loop. This is becasue udev_process is propagating these errors, causing the deregistration. This change stops propagation of non-fatal errors, so we don't deregister. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Increase udev monitor buffer sizeJeremy Kerr2014-03-181-0/+11
| | | | | | | | | Since we may be enumerating devices after enabling the udev monitor, we may miss udev events that occur during this process. This change increases the default udev buffer size. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* udev: use pb_log for device SKIP messagesJeremy Kerr2014-03-141-5/+5
| | | | | | | We often want to find out why a device has been skipped, so include the SKIP messages at pb_log, which doesn't require a -DDEBUG build. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Call mount syscall directlyJeremy Kerr2014-03-141-14/+17
| | | | | | | | | | | We used to use the mount binary to do filesystem autodetection. Since we now know the fstype, we may as well call the mount syscall directly. We add a log messages too, as we'll no longer get the 'running process:' output from the process code, which is helpful is debugging discovery issues. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud