summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* discover/network: Send DHCP client architecture typeJeremy Kerr2014-01-171-0/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Support DHCP "pathprefix" configuration optionJeremy Kerr2014-01-177-37/+177
| | | | | | | | | | | | | | | | | This change implements support for the DHCP "pathprefix" option. We use the following logic: - If pathprefix is present and a full URL, we base the config file location on pathprefix + conffile - If pathprefix is present but not a full URL, we use it as the path component of the URL, and pick up the host from other parameters in the DHCP response - If no pathprefix is present, we determine the configuration prefix from the DHCP bootfile parameter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Check for full URLs in parser testsJeremy Kerr2014-01-178-12/+24
| | | | | | | | | | | | At present, we only match the 'file' portion of a URL in the parser tests, so we "serve" a file if just the filename (but not the scheme, hostname or path) matches the file we set with test_read_conf_embedded. This change introduces test_read_conf_embedded_url, which we can use to specify a full URL. In this case, the fake parser_request_file matches the entire URL before returning the file data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't rely on ctx->conf_url side-effect in user_event_parse_conf_urlJeremy Kerr2014-01-173-5/+11
| | | | | | | | Currently, user_event_parse_conf_url sets dc->conf_url if it detects we have a full URL (rather than a base URL). This is a little too subtle, so replace it with an explicit output parameter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub: Use --id values for default option detectionBen Stoltz2014-01-173-7/+53
| | | | | | | | 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: Bring down configured interfaces on discover server exit.Jeremy Kerr2014-01-172-1/+7
| | | | | | | | We want to down the interfaces that we brought up, so hook up the network_shutdown function to the discover exit path. Also, we only want to down interfaces that we've configured, and exclude lo. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils: Add boot hook to set stdout property on DT machinesJeremy Kerr2014-01-151-0/+23
| | | | | | | | | On machines that use device-tree boot, they'll often set an early console, defined by the linux,stdout property in the /chosen/ device tree node. This hook adds a facility for petitboot to set this, based on an NVRAM setting.
* discover: we need stderr for the BusyBox TFTP type checkJeremy Kerr2014-01-141-0/+1
| | | | | | | Busybox tftp doesn't support -V, so prints an error to stderr. We'll only see the Busybox identifier if we capture stderr too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: Add add_stderr flag to process moduleJeremy Kerr2014-01-145-1/+118
| | | | | | | | | | | | For some process execution functions, we'd like to capture stderr as well as stdout. Currently, we unconditionally redirect subprocess stderr to the petitboot log file. This change adds an add_stderr flag to struct process, which indicates to the process library that we want stderr as well as stdout. If this is specified, the subprocess' stderr is captured to stdout_buf. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add yaboot leftovers testJeremy Kerr2014-01-142-0/+36
| | | | | | | Add a test to ensure that boot option parameters don't leak into later options. 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-143-3/+33
| | | | | | | | | | 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>
* discover/udev: Set device type for optical media correctlyJeremy Kerr2014-01-131-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config/powerpc: Always call update_network_configJeremy Kerr2013-12-231-2/+1
| | | | | | | | | | | | | | Currently, we have a bug when setting the default network configuration (ie, no devices have any specific config), as we won't call update_network_config to clear out the value of the petitboot,network parameter. This change always invokes update_network_config, regardless of the number of interfaces configured. This ensures we clear out the petitboot,network param, which is then synced to nvram if the param has changed. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-config: Add validation for network settingsJeremy Kerr2013-12-181-9/+30
| | | | | | | Use the new widget validators, plus a bit of whole-form logic, to implement some basic validation on the config UI. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-widgets: Add initial textbox validation functionsJeremy Kerr2013-12-182-0/+68
| | | | | | | | | We'd like to do some validation of the system configuration parameters, so add a few validation types to the widget code. We currently need integer, ipv4 address and multiple ipv4 address types. These are implemented as small wrappers around the ncurses form validator code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-config: expand mask fieldJeremy Kerr2013-12-181-1/+1
| | | | | | This makes it obvious if there's more than two characters in the field. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Use AC_GNU_SOURCEJeremy Kerr2013-12-1833-44/+54
| | | | | | | 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>
* ui/ncurses: Add link status to system info & system config screensJeremy Kerr2013-12-182-3/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/util: Avoid sprintf in mac_strJeremy Kerr2013-12-181-3/+6
| | | | | | The conversion is simple, no need for sprintf. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/util: Move mac_buf from nc code to util libraryJeremy Kerr2013-12-184-22/+55
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* sysinfo: Add interface link status to sysinfo dataJeremy Kerr2013-12-185-14/+38
| | | | | | | | This changes adds a 'link' parameter to the interface information sent in sysinfo messages. The discover network code populates this from the incoming netlink messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Add parent stdout testJeremy Kerr2013-12-182-0/+56
| | | | | | Looks like we missed adding a test source file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Fix assertion failure on empty yaboot filesJeremy Kerr2013-12-103-1/+15
| | | | | | | | | | 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/boot: Copy local paths before running boot hooksJeremy Kerr2013-12-051-13/+22
| | | | | | | | | | | We're seeing a crash when boot hooks are specifying new resources, as boot_hook_update_param will write to a NULL struct load_url_result. Instead of writing the updated values to the struct, copy the local parts of the result to a separate string, which the boot hooks are free to update. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Fix condition for updating boot paramsJeremy Kerr2013-12-051-5/+3
| | | | | | | | In commit 823958fb, we change to use struct process, but left in the check for rc == BOOT_HOOK_EXIT_UPDATE. We actually want to check process->exit_status here, not rc. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Use UUIDs for multipath checkJeremy Kerr2013-12-051-9/+14
| | | | | | Partitions will share a serial number. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/boot-editor: Fix (null) when non-device resources are shownJeremy Kerr2013-12-031-1/+1
| | | | | | | | | | | We're seeing the following in the boot editor: image: (null)ftp://... the (null) is due to the sep in conditional_prefix, which should be blank, not NULL. 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: Fix CDROM handlingJeremy Kerr2013-12-024-1/+172
| | | | | | | | | | | | | Currently, we don't handle CDROM devices well; we'll try to mount on boot, and not detect any media changes. Also, the default rules shipping with udev will put the CDROM tray into a locked state, blocking eject from working. This change adds a set of cdrom utility functions, which the udev code can use to properly initialise cdrom devices and handle eject and media change requests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add key debugJeremy Kerr2013-12-021-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/device-handler: Ensure we free unresolved boot options on removeJeremy Kerr2013-12-025-1/+64
| | | | | | | | | | When we remove a device, some options may still be unresolved, and so won't be deallocated through freeing the device. This chagne explicitly removes & frees any currently-unresolved options for this device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: copy dev->device path from udev devnodeJeremy Kerr2013-12-021-1/+2
| | | | | | | We're seeing a use-after-free, as the udev path is freed before the discover device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Populate $prefix from config file locationJeremy Kerr2013-11-276-5/+54
| | | | | | | 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>
* test/parser/grub2: Fix inconsistent conf/env pathsJeremy Kerr2013-11-272-2/+2
| | | | | | | | In an upcoming change, we'll populate $prefix (which is used to locate the environment file) based on the location of the config file, so these paths will need to be consistent. 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-273-5/+84
| | | | | | | Implement -s and -f checks for grub, and test with the standard GRUB2 saved_default config. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: In static config mode, only configure defined interfacesJeremy Kerr2013-11-271-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-config/powerpc-nvram: Fix format of dns configJeremy Kerr2013-11-261-1/+1
| | | | | | It should be dns,<server> not dns=<server> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-widgets: Unify select keyJeremy Kerr2013-11-221-15/+11
| | | | | | | | We have a few instances where we check for a 'select' action (enter or space key event), and some are inconsistent. Unify these with a key_is_select() function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Redraw entire screen with ctrl+LJeremy Kerr2013-11-221-4/+2
| | | | | | Use wrefresh(curscr) to clean and repaint the entire screen. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Ensure boot editor window is properly paintedJeremy Kerr2013-11-221-0/+2
| | | | | | | We're not currently drawing the window title correctly; we need to draw the main_ncw for this to hit the terminal. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Fix use-after-free when exiting boot option editorJeremy Kerr2013-11-221-13/+29
| | | | | | | | After we've called on_exit, we can no longer use the boot editor. This change moves individual button callbacks into process_key, which returns to the main loop. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Allow boot editor sysinfo updatesJeremy Kerr2013-11-222-65/+99
| | | | | | | We may start a boot editor (via 'New') before we have the sysinfo. To allow this, we redraw the device select. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add widgetset_set_windowJeremy Kerr2013-11-222-0/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add widget_select_drop_optionsJeremy Kerr2013-11-222-0/+40
| | | | | | We want to be able to re-set the options in a select widget. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Implement intra-field scrollingJeremy Kerr2013-11-222-12/+10
| | | | | | | Now that we can calculate the focus within a field, ensure that the focussed-element remains scrolled. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/widgets: Add widget focus offset queryJeremy Kerr2013-11-222-0/+24
| | | | | | | | | | When we have widgets that are larger than the screen, we'd like to scroll to the currently-focussed component of that widget. This change introduces a widget_focus_y function, which returns the y offset of the field's focus. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud