summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* i18n: Mark translatable strings for ncurses UIJeremy Kerr2014-07-2811-81/+140
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add gettext infrastructureJeremy Kerr2014-07-287-5/+61
| | | | 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 device hierarchySamuel Mendoza-Jonas2014-07-223-9/+197
| | | | | | | | Boot options are now listed under their matching boot device in the ncurses UI to help differentitate similar boot option names Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add safe mode indicatorJeremy Kerr2014-07-222-0/+6
| | | | 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-225-1/+24
| | | | | | | | | | | 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>
* version.sh: Ensure we're using petitboot's git directoryJeremy Kerr2014-07-221-0/+2
| | | | | | | We don't want the version to be extracted from a higher-level git directory. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: allow tab/backtab to skip through a widget's fieldsJeremy Kerr2014-07-221-2/+19
| | | | | | | | Since we may have a long list of devices on the configuration screen, we'd like a way to jump between widgets. This change repeats the PREV_FIELD/NEXT_FIELD driver request on these events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Make Network: heading consistent with other labelsJeremy Kerr2014-07-221-1/+1
| | | | | | | The 'Network' label was originally intended as a header, but we should keep it consistent with other field labels. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Expose boot_device configuration through UIJeremy Kerr2014-07-222-22/+170
| | | | | | | | | | | | | | | | Add a configuration setting for the default boot device. We change the autoboot option to a select, as we have three possible behaviours for autoboot: ( ) Don't autoboot ( ) Autoboot from any disk/network device ( ) Only autoboot from a specific disk/network device The latter option will show a list of possible devices to seelct for autoboot behaviour. 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-213-0/+23
| | | | | | If a default device is set, we only allow booting from that device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Add boot_device member to configJeremy Kerr2014-07-213-3/+16
| | | | | | | We'd like to specify a way to only boot from a specific block device; this adds a field to the configuration to hold the value. 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>
* ui/ncurses: Remove net_conf parameter from sconfig_screen_layout_widgetsJeremy Kerr2014-07-171-8/+7
| | | | | | | We always pass screen->net_conf_type as this parameter, so we may as weel grab it from screen directly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: specify a fixed length for status messagesJeremy Kerr2014-07-161-2/+2
| | | | | | | | | | Incoming status messages can be an arbitrary length; if so, the status line may be corrupt. This change uses the 'n' variant of mvwaddnstr(), so we only write one line of characters. 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>
* m4: Add ncurses autoconf macrosJeremy Kerr2014-07-162-0/+749
| | | | | | | Currently, we depend on host autoconf-archive for the AX_WITH_CURSES macros. Insead, include this in the source tree under m4/ Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* version.sh: Use git tags in versionsJeremy Kerr2014-07-161-7/+11
| | | | | | | | If the current HEAD is tagged, we'd like to use that tag as the version. We remove a 'v' prefix, so that v1.0 -> 1.0 Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* version.sh: Unify version generationJeremy Kerr2014-07-161-17/+10
| | | | | | | | | | | | | This change includes a few fixes to the version.sh script, in order to unify the versions generated from git vs. dev- versions. We unify on a simple YYYYMMDD format, and drop the time specifier (if you're relying on time info, you probably have the git SHAs to lookup from instead). We also clean up the date-generation code, by using printf's %T formatter, on git's %ct time specification, rather than trying to transform a %ci date. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* autotools: Make petitboot autoreconfableJeff Bailey2014-07-164-45/+40
| | | | | | | | | | | | | | | | The standard way to regenerate the autotools bits is with 'autoreconf', but that doesn't work with our custom bootstrap script. We only need the bootstrap script to generate the version in configure.ac, which we can easily do with m4_esyscmd_s instead. This change allows autoreconfiguration with `autoreconf -f -i`. Includes changes proposed by Yann E. Morin <yann.morin.1998@free.fr>, and modifications from the original patch from Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Jeff Bailey <jeffbailey@google.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* autotools: Don't require custom automake optionsJeff Bailey2014-07-164-2/+6
| | | | | | | | | | | | | We need a couple of automake options to prevent errors when regenerating Makefile.ins during source preparation. Some makefiles assume GNU make, so add 'foreign' where necessary. Also, we are building objects in subdirectories, so we need 'subdir-objects'. Modified to suit recent petitboot by Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Jeff Bailey <jeffbailey@google.com> 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-053-0/+14
| | | | | | | | | | | 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>
* utils/pb-console: use a linux termcap entry for local consolesJeremy Kerr2014-05-191-0/+7
| | | | | | For local consoles, we always want a TERM=linux. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover,ui: fix checks for debug optionJeremy Kerr2014-05-012-2/+2
| | | | | | 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>
* ui/ncurses: only cancel default boot on valid key eventsJeremy Kerr2014-04-221-4/+7
| | | | | | | | | | We're seeing occasionaly failures to autoboot due to supirious key events (getch() returing -1) on an IPMI console. This change modifies the process_key logic to only abort the default if we see a valid key event. 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>
* ui/ncurses: Always provide a key definition for backtabJeremy Kerr2014-04-161-0/+5
| | | | | | | | | | | | | Petitboot environments will probably want a basic terminfo defintion (eg, vt220) rather than a full linux or xterm, but vt220 and friends don't define a backtab key. Backtab can be useful for proper form navigation, and without a key definition, we just get an escape, which exits the current screen. This change provides a static definition for KEY_BTAB, so we should always have one available. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use a fixed-sized for small, known-length fieldsJeremy Kerr2014-04-163-1/+11
| | | | | | | | | | | | | Fields without O_STATIC can "scroll" horizontally, and we may miss a left-hand section of text from the current display. This can mean that the user can't leave a validated field with no indication why, if the off-to-the-left data is not a valid entry. This change adds a widgetset function to mark a field as fixed-size, so we don't have this scrolling behaviour. This means that the entire field contents will always be visible, and any validation errors can be seen. 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>
* ui/ncurses: Ensure boot option labels are displayable as menu itemsJeremy Kerr2014-04-101-1/+43
| | | | | | | | | | | | | | | ncurses' new_item() expects the name parameter to be a "printable string", by converting it to a wchar *, and checking that each character is printable with iswprint(). If it fails, we won't see a boot option at all. This change introduces a function to convert the label into something we know is printable, and valid UTF-8. If mbstowcs fails, we replace it with a generic 'Invalid option' label. If we encounter a valid multibyte string with unprintable characters, we replace those with U+fffd REPLACEMENT CHARACTER. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Fix discover_client leakJeremy Kerr2014-04-101-0/+1
| | | | | | | We're not freeing the discover_client on exit, as it's not attached to any existing talloc context. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: unpost ncurses menu in pmenu cleanup pathJeremy Kerr2014-04-101-0/+1
| | | | | | We need to unpost the menu so that free_item can actually free the item. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use pmenu_item destrutor to free ncurses ITEMsJeremy Kerr2014-04-101-6/+9
| | | | | | | | | | Currently, pemnu_destroy is used to free items. This means that the menu code needs to iterate over items, and we have no way to free the ITEM * of items that aren't in a menu. Instead, free the ITEM in the pmenu_item destructor. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Separate menu item creation & initialisation from insertionJeremy Kerr2014-04-104-70/+67
| | | | | | | | | | | | | | | | | | | | | | | Currently, the menu item creation is has two main functions: pmenu_item_alloc and pmenu_item_setup. The latter does initialisation (it sets item->name), and inserts the item into the menu. We have pmenu_item_init to combine this into one, but that means we need to do further initialisation (eg, to set on_execute) after the item has been added to the menu. Instead, this change use a more direct _create and _insert interface. Create does the allocation and initialisation, while _insert does the actual insertion. This means new_item failures will be detected at creation time, rather than during pmenu_insert. Also, we're now insert a completely-populated item into the menu, rather than populating on_edit, on_execute and data after insertion. Because we can detect errors from creation (ie, from new_item failing), we add handling code to cui_boot_option_add and cui_boot_editor_on_exit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Don't use menu offsets for user item numbersJeremy Kerr2014-04-101-1/+2
| | | | | | | The menu offsets are arbitrary, use a separate numbering scheme for user items. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Remove pmenu_item_replaceJeremy Kerr2014-04-082-49/+0
| | | | | | ... as nothing uses it. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Don't free item in pmenu_item_setupJeremy Kerr2014-04-083-7/+16
| | | | | | | | | | | | | Currently pmenu_item_setup may free its item parameter on error. This makes it non-obvious whether the item is still allocated on exit to the caller. Instead, this change removes the talloc_free, and requires that the caller do this on error. This makes the potential use-after-free in cui_boot_editor_on_exit obvious, so we fix that too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-protocol: fix deserialise of boot option prioritiesJeremy Kerr2014-04-071-0/+3
| | | | | | | | | | | | Commit aa530148 introduced a priority member to struct boot_priority, but didn't update the protocol deserialise function to properly decode config messages. This meant we were leaving half of the struct uninitialised, and getting invalid values in the initialised part. This change updates the config deserialise function to do proper handling for boot priority data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: clear DNS server setting before appending new serversJeremy Kerr2014-04-071-0/+4
| | | | | | | | | | Currently, we have a bug where newly-configured DNS servers are appended to the existing set of servers, rather than replacing them. This change clears the existing servers out before adding the newly-configured ones. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud