petitboot
2 years agodiscover/platform-powerpc: Increase IPMI timeout v1.6.2
Samuel Mendoza-Jonas [Thu, 26 Oct 2017 03:10:57 +0000 (14:10 +1100)]
discover/platform-powerpc: Increase IPMI timeout

On OpenBMC platforms IPMI requests can take over five seconds to
complete. OpenBMC does inform OPAL in BT init that it may take up to
ten seconds to respond to any requests, so update our timeout value to
accommodate this extra delay.

On other platforms this will won't change anything (AMI- and SMC- based
BMCs for example respond in under a second), but on OpenBMC platforms
such as Witherspoon this will delay Petitboot significantly while we
wait for the response. This is not ideal but we need to wait in order to
receive important information such as a safe mode request.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Remove help shortcut from nc-subset
Samuel Mendoza-Jonas [Thu, 12 Oct 2017 03:46:15 +0000 (14:46 +1100)]
ui/ncurses: Remove help shortcut from nc-subset

Subset screens do not include a help screen, so remove the misleading
"h=help" shortcut from the lower frame title.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Fallback to device if snapshot fails to mount v1.6.1
Samuel Mendoza-Jonas [Tue, 10 Oct 2017 02:24:48 +0000 (13:24 +1100)]
discover/device-handler: Fallback to device if snapshot fails to mount

In the event that a snapshot fails to mount, destroy it and fall back to
the actual source device. While this loses the protection afforded by a
snapshot it avoids users being greeted with an empty boot menu and
unable to continue booting.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Display multibyte strings correctly in textscreens
Samuel Mendoza-Jonas [Tue, 10 Oct 2017 04:36:27 +0000 (15:36 +1100)]
ui/ncurses: Display multibyte strings correctly in textscreens

In nc-textscreen each line of text is capped at a certain length to
avoid running off the side of the viewable screen. However it appears
the ncurses function mvwaddnstr() counts by byte instead of actual
character, causing strings which contain multibyte characters to be cut
short.

To avoid this check the displayed length of each string against the
screen width, and if under instruct mvwaddnstr() to print the whole
string.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Spawn shell in exit handler
Samuel Mendoza-Jonas [Tue, 29 Aug 2017 03:52:31 +0000 (13:52 +1000)]
ui/ncurses: Spawn shell in exit handler

In cui_on_exit()_ instead of exiting the program spawn a sh instance.
This allows the user to drop to the shell and return without losing any
custom boot options, for example.
SIGINT still calls cui_abort() to properly exit Petitboot.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Fixup some missing gettext calls
Samuel Mendoza-Jonas [Fri, 15 Sep 2017 01:24:17 +0000 (11:24 +1000)]
ui/ncurses: Fixup some missing gettext calls

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agopo: Translation Updates
Samuel Mendoza-Jonas [Wed, 13 Sep 2017 04:15:45 +0000 (14:15 +1000)]
po: Translation Updates

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agopo: Update translations v1.6.0
Samuel Mendoza-Jonas [Fri, 30 Jun 2017 01:51:45 +0000 (11:51 +1000)]
po: Update translations

General translation update, adds several new translation source files
including parsers and the plugin and statuslog screens.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Don't modify config when clearing IPMI override
Samuel Mendoza-Jonas [Thu, 24 Aug 2017 01:43:45 +0000 (11:43 +1000)]
ui/ncurses: Don't modify config when clearing IPMI override

When safe mode is active the config displayed in nc-config is only a
subset of the actual config since device init has not yet occurred.
However when the "clear override" checkbox is ticked and the config
saved, the form will set the config as it is displayed, resulting in
device-specific config (eg. boot order and network settings) being
cleared. If the user only ticked the "clear override" checkbox this most
likely isn't what they intended.

Instead change the checkbox to a button which when pressed clears the
override and exits safe mode if active, without modifying the rest of
the configuration.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Disable safe mode warning on reinit
Samuel Mendoza-Jonas [Wed, 23 Aug 2017 01:05:58 +0000 (11:05 +1000)]
discover/device-handler: Disable safe mode warning on reinit

If a user pressed "Rescan Devices" in safe mode the reinit would
complete successfully, but the big warning that safe mode is active
would remain. On reinit clear the safe_mode flag properly.

This has no functional change aside from clearing the UI warning - the
IPMI override remains active until cleared or a successful boot occurs.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agolib/flash: Update type of size field
Samuel Mendoza-Jonas [Tue, 22 Aug 2017 06:51:07 +0000 (16:51 +1000)]
lib/flash: Update type of size field

Skiboot commit c043065 "flash: Make size 64 bit safe" updated the
prototype of blocklevel_get_info() to use a uint64_t for the size
parameter. Update our usage to reflect this.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Update env vars at init and suppress LVM warnings
Samuel Mendoza-Jonas [Tue, 22 Aug 2017 01:41:09 +0000 (11:41 +1000)]
discover: Update env vars at init and suppress LVM warnings

Environment variables are not platform-specific so move
set_proxy_variables to device-handler and call it at handler init.

At the same time set LVM_SUPPRESS_FD_WARNINGS to ignore the "file
descriptor leaked" warnings when calling LVM-utilities, since we must
keep some file descriptors open in lib/process.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/ipmi: Open devnode with O_CLOEXEC
Samuel Mendoza-Jonas [Tue, 22 Aug 2017 01:36:06 +0000 (11:36 +1000)]
discover/ipmi: Open devnode with O_CLOEXEC

The IPMI device node is kept open for the life of the platform - include
the O_CLOEXEC flag so it is not kept open for child processes.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Be ready for user events earlier
Samuel Mendoza-Jonas [Tue, 15 Aug 2017 01:08:58 +0000 (11:08 +1000)]
discover/device-handler: Be ready for user events earlier

Actions performed in network and udev init may result in pb-event
callbacks (such as from udhcpc or pb-plugin), so make sure the user
event interface is set up beforehand.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Add plugin menu and nc-plugin screen
Samuel Mendoza-Jonas [Mon, 24 Jul 2017 05:58:50 +0000 (15:58 +1000)]
ui/ncurses: Add plugin menu and nc-plugin screen

Add a second pmenu accessible via the main menu which displays
uninstalled and installed pb-plugins. Uninstalled options can be
selected to trigger pb-plugin to install them, after which they are
updated and marked as installed in the menu.
Installed plugins can be investigated by entering the new plugin screen,
where plugin metadata and executables are displayed. Executables can be
run from this screen via cui_run_cmd().

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Update cui_run_cmd() to pass display to command
Samuel Mendoza-Jonas [Wed, 15 Feb 2017 03:47:45 +0000 (14:47 +1100)]
ui/ncurses: Update cui_run_cmd() to pass display to command

Update cui_run_cmd() to setup a process that uses 'raw_stdout' so that
output is displayed on the screen instead of being caught in the log.
Also update cui_run_cmd() to take a more generic list of arguments, and
add a cui_run_cmd_from_item() wrapper for the existing user.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Handle plugin install request
Samuel Mendoza-Jonas [Fri, 16 Jun 2017 05:09:55 +0000 (15:09 +1000)]
discover: Handle plugin install request

Handle "_PLUGIN_INSTALL" requests from clients. Calling the pb-plugin
script from pb-discover ensures different clients don't trip over each
other. Successfully installed plugins are automatically communicated
back to clients once pb-plugin sends a 'plugin' user event.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Scan devices for plugins
Samuel Mendoza-Jonas [Mon, 24 Jul 2017 05:14:49 +0000 (15:14 +1000)]
discover/device-handler: Scan devices for plugins

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoAdd pb-plugin and pb-exec to pb_system_apps
Samuel Mendoza-Jonas [Tue, 25 Jul 2017 06:07:53 +0000 (16:07 +1000)]
Add pb-plugin and pb-exec to pb_system_apps

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoutils/pb-plugin: Advertise pb-plugins to discover server
Samuel Mendoza-Jonas [Tue, 25 Jul 2017 06:07:40 +0000 (16:07 +1000)]
utils/pb-plugin: Advertise pb-plugins to discover server

Update the pb-plugin utility to create a 'plugin' pb-event when it
successfully scans or installs a pb-plugin.
To aid invoking pb-plugin from pb-discover there following two commands
are updated:
 - `pb-plugin scan` can now be called for a single directory.
 - `pb-plugin install` now has an optional "auto" argument that will
 skip asking for confirmation before installation.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoutils: Add pb-exec wrapper
Samuel Mendoza-Jonas [Tue, 25 Jul 2017 06:08:11 +0000 (16:08 +1000)]
utils: Add pb-exec wrapper

Add a small wrapper script for the Petitboot UI to call interactable
programs with. The wrapper calls the program and waits for user input
before returning to the Petitboot UI.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agolib/process: Add raw stdout mode
Samuel Mendoza-Jonas [Tue, 14 Feb 2017 04:52:35 +0000 (15:52 +1100)]
lib/process: Add raw stdout mode

Allow process users to set 'raw_stdout', which if set skips redirecting
and saving output from processes.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Add 'plugin' user-event
Samuel Mendoza-Jonas [Tue, 25 Jul 2017 05:55:19 +0000 (15:55 +1000)]
discover: Add 'plugin' user-event

Add a new user event to advertise pb-plugins and add them to the
device_handler. Plugins described by this event can either be
uninstalled pb-plugin files or successfully installed pb-plugins
depending on the associated parameters.
The is primarily intended for use by the pb-plugin utility itself to
notify Petitboot as it operates on pb-plugin files.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Handle and track plugin_options
Samuel Mendoza-Jonas [Wed, 1 Feb 2017 05:11:43 +0000 (16:11 +1100)]
discover: Handle and track plugin_options

Track plugin_options in the device_handler. Plugins can be added with
device_handler_add_plugin_option() and accessed via
device_handler_get_plugin().
Extend discover_server to support the new 'add' and 'remove' pb-protocol
actions and advertise new plugins to connecting clients.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/pxe-parser: Recognise plugin sources
Samuel Mendoza-Jonas [Tue, 14 Feb 2017 04:56:14 +0000 (15:56 +1100)]
discover/pxe-parser: Recognise plugin sources

Extend the pxe-parser to recognise 'PLUGIN' as well as the usual 'LABEL'
when parsing a config file. 'PLUGIN' will be used to specify an option
that provides the location of an installable pb-plugin file, named by
the 'TARBALL' label.

Since plugin options are discovered via the same mechanism as boot
options treat them the same as boot options and at the 'type' field to
the boot_option struct to differentiate between them.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agolib: Add plugin_option type and protocol
Samuel Mendoza-Jonas [Tue, 14 Feb 2017 04:56:55 +0000 (15:56 +1100)]
lib: Add plugin_option type and protocol

Add a new struct 'plugin_option' to represent pb-plugins that are
installed on the system. This consists of plugin metadata and an array
of installed executables.
This also adds two new pb-protocol actions to advertise the addition of
a new plugin_option, and to remove known plugin_options.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Create pad for nc-add-url screen
Samuel Mendoza-Jonas [Thu, 10 Aug 2017 01:04:58 +0000 (11:04 +1000)]
ui/ncurses: Create pad for nc-add-url screen

Bring setup for the add-url screen into line with other screens. This
fixes an issue with a proper redraw not occurring on help screen init or
screen exit, and facilitates other work on simplifying screen init.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Increase height of boot-editor pad v1.5.1
Samuel Mendoza-Jonas [Wed, 26 Jul 2017 04:08:26 +0000 (14:08 +1000)]
ui/ncurses: Increase height of boot-editor pad

Similarly to nc-subset, extend the maximum height of the boot-editor pad
to account for the fields of the device select potentially wrapping due
to long device names.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Mention booting device in timeout status
Samuel Mendoza-Jonas [Thu, 13 Jul 2017 00:19:18 +0000 (10:19 +1000)]
discover/device-handler: Mention booting device in timeout status

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agopb-sos: effectively compress the pb-sos file with gzip v1.5.0
Guilherme G. Piccoli [Tue, 11 Jul 2017 18:04:05 +0000 (15:04 -0300)]
pb-sos: effectively compress the pb-sos file with gzip

Currently the pb-sos tool creates a TAR file with logs, but without
compressing it using gzip, for example. Even the output of command
says "Compressing...", but in fact no compression is done.

This patch uses gzip to effectively compress the logs. It achieves
83% of compression, observed after a simple experiment.
Also, makes use of $tarflags variable instead of pass the flags
directly in the command call.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agopb-sos: capture Skiboot log
Guilherme G. Piccoli [Tue, 11 Jul 2017 18:04:04 +0000 (15:04 -0300)]
pb-sos: capture Skiboot log

Makes sense to capture Skiboot log in pb-sos, specially since
it might help clarify about HW problems, like PCI initialization
failures.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Wait for net interfaces to be marked ready
Samuel Mendoza-Jonas [Thu, 15 Jun 2017 05:23:06 +0000 (15:23 +1000)]
discover: Wait for net interfaces to be marked ready

If pb-discover is started before udev has settled there is a race
between Petitboot configuring interfaces and udev renaming them. If an
interface is set "up" the name change will fail and interfaces can be
inconsistently named, eg:

  Device:        (*) eth0 [0c:c4:7a:f4:1c:50, link up]
                 ( ) enP1p9s0f1 [0c:c4:7a:f4:1c:51, link down]
                 ( ) enP1p9s0f2 [0c:c4:7a:f4:1c:52, link down]
                 ( ) enP1p9s0f3 [0c:c4:7a:f4:1c:53, link down]

Add "net" devices to the udev filter and wait for them to be announced
by udev before configuring them.
udev_enumerate_add_match_is_initialized() ensures that by the time an
interface appears via udev its name will be consistent.

This also swaps the network and udev init order, but since interfaces
now will not be configured until after udev is ready this should not
have a user-visible effect.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/udev: Handle LVM logical volumes
Samuel Mendoza-Jonas [Wed, 14 Jun 2017 05:17:21 +0000 (15:17 +1000)]
discover/udev: Handle LVM logical volumes

If logical volumes are active and recognised by udev, no longer ignore
them. We also do some extra handling to use user-friendly device names
and mount the /dev/mapper/foo device rather than the /dev/dm-xx device.

Additionally if we see "LMV2_member" devices start a rescan in case
LVM-formatted disks came up after the LVM initscript.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agolib/system: Add vgscan, vgchange utilities
Samuel Mendoza-Jonas [Wed, 14 Jun 2017 08:53:01 +0000 (18:53 +1000)]
lib/system: Add vgscan, vgchange utilities

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/devmapper: Add prefix to devmapper device names
Samuel Mendoza-Jonas [Wed, 14 Jun 2017 05:17:28 +0000 (15:17 +1000)]
discover/devmapper: Add prefix to devmapper device names

Add a 'pb-' prefix to all device mapper devices created by Petitboot.
Beyond helping to identify Petitboot-related devices, this avoids naming
collisions if we create snapshots of LVM logical volumes which also
exist in /dev/mapper.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Extend nc-subset pad height
Samuel Mendoza-Jonas [Wed, 14 Jun 2017 05:17:35 +0000 (15:17 +1000)]
ui/ncurses: Extend nc-subset pad height

The nc-subset screen can exceed its maximum height if some options are
long enough to wrap around to two lines. Increaes the maximum size of
the pad to account for every line potentially wrapping once.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Allow process_url request to be pending
Samuel Mendoza-Jonas [Thu, 23 Mar 2017 06:43:29 +0000 (17:43 +1100)]
discover/device-handler: Allow process_url request to be pending

device_handler_process_url() fails immediately if no network is
available. For individual files queue the load task for later instead.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/paths: Add network jobs to queue
Samuel Mendoza-Jonas [Thu, 23 Mar 2017 06:42:37 +0000 (17:42 +1100)]
discover/paths: Add network jobs to queue

Load tasks that start before the network is available will fail. Rather
than just fail these tasks, add them to a queue that is processed once
the network is ready. This helps users who try to request files early in
setup, as well as very early running load tasks.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/sysinfo: Add network availability helper
Samuel Mendoza-Jonas [Thu, 23 Mar 2017 06:42:03 +0000 (17:42 +1100)]
discover/sysinfo: Add network availability helper

Add a helper function that describes interfaces as available if they
have an assigned address.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/sysinfo: Add system_info_reinit()
Samuel Mendoza-Jonas [Thu, 23 Mar 2017 06:41:28 +0000 (17:41 +1100)]
discover/sysinfo: Add system_info_reinit()

Currently over reinit events the system info is not affected. However
network and block device information can change over reinit, so clear
this information.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoconfigure.ac: correct name of device-mapper-devel for RHEL v1.4.3
Daniel Black [Tue, 6 Jun 2017 00:20:50 +0000 (10:20 +1000)]
configure.ac: correct name of device-mapper-devel for RHEL

The RHEL and Fedora package name for development device mapper library is device-mapper-devel

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/platform-powerpc: Handle optional Get Device ID section
Samuel Mendoza-Jonas [Wed, 14 Jun 2017 02:01:35 +0000 (12:01 +1000)]
discover/platform-powerpc: Handle optional Get Device ID section

The 'auxiliary' section of the 'Get Device ID' response is optional,
and some platforms exclude it from the response entirely. However
Petitboot only recognises the response as valid if it includes the full
16 bytes.
Update get_ipmi_bmc_versions() to also handle responses of only 12 bytes.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/platform-powerpc: Correct aux revision format
Samuel Mendoza-Jonas [Thu, 27 Apr 2017 06:33:32 +0000 (16:33 +1000)]
discover/platform-powerpc: Correct aux revision format

The Auxiliary Firmware Revision Information should be displayed as four
hexadecimal bytes if a manufacturer-specific format is not known. Update
the "Firmware version" format to reflect this.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Include makedev() from sysmacros.h
Samuel Mendoza-Jonas [Thu, 27 Apr 2017 05:35:45 +0000 (15:35 +1000)]
discover/device-handler: Include makedev() from sysmacros.h

Include sys/sysmacros.h explicitly in response to the following error
message:

../discover/device-handler.c:1001:13: warning: In the GNU C Library, "makedev" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "makedev", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including <sys/types.h>.
  id = makedev(1, handler->n_ramdisks);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/platform-powerpc: Don't fail early if nvram fails
Samuel Mendoza-Jonas [Thu, 27 Apr 2017 05:28:49 +0000 (15:28 +1000)]
discover/platform-powerpc: Don't fail early if nvram fails

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoutil/hooks: Don't update DT when ttyS* console active v1.4.2
Samuel Mendoza-Jonas [Fri, 10 Mar 2017 05:44:33 +0000 (16:44 +1100)]
util/hooks: Don't update DT when ttyS* console active

Update 30-dtb-updates to not accidentally treat ttyS* consoles as tty*
and update linux,stdout-path with the VGA console details.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoutils/hooks: Don't fail early if fb0 missing
Samuel Mendoza-Jonas [Wed, 8 Mar 2017 23:59:15 +0000 (10:59 +1100)]
utils/hooks: Don't fail early if fb0 missing

30-dtb-updates would exit early if the 'fb0' file was missing, however
the set_stdout() step does not depend on this.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Track both configured and current autoboot settings
Samuel Mendoza-Jonas [Wed, 25 Jan 2017 03:45:37 +0000 (14:45 +1100)]
discover: Track both configured and current autoboot settings

If autoboot is enabled but later disabled or cancelled by, for example,
an IPMI override then the nc-config screen will set the autoboot widget
as disabled. If the user then makes and saves a change in nc-config,
autoboot will also be saved as disabled. This accidental change is
particularly awkward if the user is attempting to remove an IPMI
override.

Instead only ever change the autoboot setting if the user explicitly
changes it. Use a new helper function 'config_autoboot_active()' to
determine the current autoboot status where needed.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Fix adding unnecessary leading slashes to paths
Samuel Mendoza-Jonas [Mon, 20 Feb 2017 05:24:47 +0000 (16:24 +1100)]
ui/ncurses: Fix adding unnecessary leading slashes to paths

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/sysinfo: Fix useless error message
Samuel Mendoza-Jonas [Mon, 16 Jan 2017 03:28:57 +0000 (14:28 +1100)]
discover/sysinfo: Fix useless error message

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoprocess: Cancel all asynchronous jobs on reinit v1.4.1
Samuel Mendoza-Jonas [Mon, 23 Jan 2017 03:53:32 +0000 (14:53 +1100)]
process: Cancel all asynchronous jobs on reinit

If an asynchronous job is running over a reinit, the process can return
and run its callback function after the reinit. This becomes a problem
if the callback function accesses pointers that were only valid before
the reinit (eg. device structs).
If a reinit is requested explicitly stop all active asynchronous jobs
and clear their callback functions before the reinit.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Cancel pending boot on reinit
Samuel Mendoza-Jonas [Mon, 23 Jan 2017 03:53:08 +0000 (14:53 +1100)]
discover/device-handler: Cancel pending boot on reinit

When a reinit is requested device_handler_cancel_default() is
called, however as the name suggests this only cancels the boot task if
it is the result of a default boot option. We also want to cancel a boot
task if it was executed manually because it may have outstanding
asynchronous transfers running, so explicitly cancel it during reinit.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Process queue after device added
Samuel Mendoza-Jonas [Tue, 24 Jan 2017 03:52:20 +0000 (14:52 +1100)]
discover/device-handler: Process queue after device added

In device_handler_discover() we process the unresolved boot options
queue first. However the discover_device in question has not yet been
added to handler->devices so when a parser tries to search for a
matching device it will fail.
The discover_device will be added to the handler if it has not already
in device_handler_discover_context_commit() so move the call to
process_boot_option_queue() after it.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/network: Ignore interfaces with pre-existing MAC address
Samuel Mendoza-Jonas [Thu, 12 Jan 2017 00:12:42 +0000 (11:12 +1100)]
discover/network: Ignore interfaces with pre-existing MAC address

Petitboot uses the MAC address of network interfaces as a unique
identifier. This can cause a crash in pb-discover on a machine that has
multiple interfaces with the same MAC address.
While duplicate MAC addresses are rare and imply an issue with the
larger system configuration Petitboot should handle this gracefully, so
log a warning and ignore any interfaces other than the first to appear
that share a MAC address.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/network: Ensure interfaces have device before configuring
Samuel Mendoza-Jonas [Wed, 21 Dec 2016 04:46:09 +0000 (15:46 +1100)]
discover/network: Ensure interfaces have device before configuring

Reorganise network_handle_nlmsg() slightly to create interface->dev just
before calling configure_interface() rather than only for brand new
interfaces. This ensures existing interfaces which have had ->dev
removed but receive a new configure event do not access a NULL pointer
during the configuration process.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/network: Search by UUID only if available
Samuel Mendoza-Jonas [Fri, 23 Dec 2016 01:01:26 +0000 (12:01 +1100)]
discover/network: Search by UUID only if available

When registering a new discover device it is possible the device does
not have an associated UUID, for example when created via
device_handler_process_url(). Fall back to find_interface_by_name() in
this case.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Display IP address in nc-sysinfo v1.4.0
Samuel Mendoza-Jonas [Mon, 19 Dec 2016 04:59:04 +0000 (15:59 +1100)]
ui/ncurses: Display IP address in nc-sysinfo

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Record IP address of network interfaces
Samuel Mendoza-Jonas [Mon, 19 Dec 2016 04:56:49 +0000 (15:56 +1100)]
discover: Record IP address of network interfaces

If an interface has a valid IP address (either via DHCP or static
config) store it in the interface_info struct so it can be referenced
later.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Don't announce pb-discover connection
Samuel Mendoza-Jonas [Wed, 14 Dec 2016 03:52:11 +0000 (14:52 +1100)]
ui/ncurses: Don't announce pb-discover connection

The "Connected to pb-discover!" message is more useful for development
than actual use; for users the more important messages are related to
device and configuration parsing. Drop the message to slightly reduce
the level of noise on start up.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Maintain a backlog of status updates
Samuel Mendoza-Jonas [Wed, 14 Dec 2016 03:44:23 +0000 (14:44 +1100)]
discover: Maintain a backlog of status updates

Add status updates to a persistent list in the discover_server struct,
and send each client the backlog on connect. This avoids clients missing
useful messages from early init. Clients will only show this in the
backlog screen to avoid flooding the client's status line.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/paths: Announce download completion
Samuel Mendoza-Jonas [Tue, 13 Dec 2016 02:36:28 +0000 (13:36 +1100)]
discover/paths: Announce download completion

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/paths: Parse Busybox progress information
Samuel Mendoza-Jonas [Fri, 16 Dec 2016 05:04:46 +0000 (16:04 +1100)]
discover/paths: Parse Busybox progress information

Several busybox utilities (tftp and wget in particular) use a common
format for progress bar output. Add a stdout callback that recognises
this format and passes progress information to
device_handler_status_download().
If Petitboot has been explicitly built with busybox support set
busybox_progress_cb() as the default stdout callback for
load_url_async().

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/device-handler: Add aggregated download progress updates
Samuel Mendoza-Jonas [Fri, 16 Dec 2016 05:03:48 +0000 (16:03 +1100)]
discover/device-handler: Add aggregated download progress updates

Several processes run by Petitboot output progress information while
running. Add device_handler_status_download() which process callers can
call to register and update progress information (percentage and current
size).
A list of 'progress_info' structs holds this progress information, and
on each call to device_handler_status_download() the information is
combined and displayed as a single status update for readability.
On completion device_handler_status_download_remove() is called to
remove old progress information from the list.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/paths: Add stdout callback parameter for load_url_async()
Samuel Mendoza-Jonas [Mon, 19 Dec 2016 00:41:23 +0000 (11:41 +1100)]
discover/paths: Add stdout callback parameter for load_url_async()

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agolib/process: Allow process output to be retrieved on each event
Samuel Mendoza-Jonas [Fri, 21 Oct 2016 04:54:52 +0000 (15:54 +1100)]
lib/process: Allow process output to be retrieved on each event

Allow a custom callback function to be set when registering the IO
waiter for asynchronous processes.

To allow output from processes to be parsed as it is received, add
process_stdout_custom() which passes a new "line" parameter to
process_read_stdout_once() in order to consume output as it appears.

Users of a custom IO callback will only have access to the process_info
struct which is internal to lib/process; the function
procinfo_get_process() is added to allow these callers to access process
information.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/boot: Improve kexec error reporting
Samuel Mendoza-Jonas [Fri, 2 Dec 2016 04:18:36 +0000 (15:18 +1100)]
discover/boot: Improve kexec error reporting

Update kexec_load() to preserve output from the call to `kexec -l`. On
error retrieve the resulting error message and update the status line
with it to provide a more informative error message.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses/text-screen: trim long lines
Jeremy Kerr [Wed, 14 Dec 2016 04:20:53 +0000 (12:20 +0800)]
ui/ncurses/text-screen: trim long lines

When a text_screen is given a long line, it'll wrap to the next,
overstepping the left margin.

We already have folded text for flowed text screens, so just trim long
lines at the correct column.

This exposes an off-by-one with the automatic wrapping in
text_screen_set_text(), where we may overrun the last char, so fix that
too.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: Add status messages for payload download results
Jeremy Kerr [Tue, 13 Dec 2016 04:00:08 +0000 (12:00 +0800)]
discover/status: Add status messages for payload download results

... using the URL which is now present in the load_result.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: Use full URL in parse status message
Jeremy Kerr [Tue, 13 Dec 2016 01:15:04 +0000 (09:15 +0800)]
discover/status: Use full URL in parse status message

->conf_url is the base address, we want the actual loaded URL.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: Add parse status for GRUB2, yaboot & kboot parsers
Jeremy Kerr [Mon, 12 Dec 2016 13:20:22 +0000 (21:20 +0800)]
discover/status: Add parse status for GRUB2, yaboot & kboot parsers

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: make boot status calls more consistent
Jeremy Kerr [Mon, 12 Dec 2016 13:07:10 +0000 (21:07 +0800)]
discover/status: make boot status calls more consistent

Capitals where suitable, remove underscore from kexec_load, use
translated strings for payload names.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: report on PXE download failures
Jeremy Kerr [Tue, 13 Dec 2016 02:13:24 +0000 (10:13 +0800)]
discover/status: report on PXE download failures

Add dev_err messages on both autoconfiguration and
specified-configuration download failures.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: report attempts at PXE configuration download
Jeremy Kerr [Mon, 12 Dec 2016 12:10:43 +0000 (20:10 +0800)]
discover/status: report attempts at PXE configuration download

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: Be more specific about DHCP event status message
Jeremy Kerr [Mon, 12 Dec 2016 10:16:33 +0000 (18:16 +0800)]
discover/status: Be more specific about DHCP event status message

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: report status on link configuration
Jeremy Kerr [Mon, 12 Dec 2016 09:58:17 +0000 (17:58 +0800)]
discover/status: report status on link configuration

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover/status: remove completion messages
Jeremy Kerr [Mon, 12 Dec 2016 09:34:42 +0000 (17:34 +0800)]
discover/status: remove completion messages

The completion messages are unconditional, so don't really indicate
anything. In fact, the dhcp completion status is misleading, as we may
still be processing the context through pxe callbacks.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Add reference to url in load_url_result
Jeremy Kerr [Tue, 13 Dec 2016 01:13:50 +0000 (09:13 +0800)]
discover: Add reference to url in load_url_result

We may want to access the loaded URL in a async handler.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: add handler reference to struct discover_context
Jeremy Kerr [Mon, 12 Dec 2016 11:58:32 +0000 (19:58 +0800)]
discover: add handler reference to struct discover_context

Since the device handler provides the status message functions, we need
a pointer to it for device discovery (which we use a struct
discover_context for).

This change adds a 'handler' member to struct discover_context, to allow
status reporting. Since we now have a handler, there's no need for the
network pointer, so provide an accessor function instead.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Use device_handler_status_dev_* for device-specific status
Jeremy Kerr [Mon, 12 Dec 2016 07:58:57 +0000 (15:58 +0800)]
discover: Use device_handler_status_dev_* for device-specific status

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Add device-specific status reporting functions
Jeremy Kerr [Mon, 12 Dec 2016 07:43:21 +0000 (15:43 +0800)]
discover: Add device-specific status reporting functions

Most of our status reporting is against a specific device, so add
status reporting functions that take a struct discover_device and use a
stnadard prefix.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: use helpers for status reporting
Jeremy Kerr [Mon, 12 Dec 2016 07:26:32 +0000 (15:26 +0800)]
discover: use helpers for status reporting

Now that we have helpers for simpler status reporting, use those instead
of constructing a struct status everywhere.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: Add helpers for status reporting
Jeremy Kerr [Thu, 8 Dec 2016 02:08:15 +0000 (13:08 +1100)]
discover: Add helpers for status reporting

This change adds a couple of helpers for the status reporting API,
allowing callers to provide just a set of printf-style arguments, rather
than having to build up a struct status.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agodiscover: separate status-reporting function from boot() callback
Jeremy Kerr [Wed, 7 Dec 2016 00:43:08 +0000 (11:43 +1100)]
discover: separate status-reporting function from boot() callback

Currently, the device_discover_boot_status function is both used for
internal status updates, as well as the callback passed to boot().

This change splits this into two functions; one for the latter and one
for the former. The latter just has a void * for its first argument, to
match the boot_status_fn type.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: remove "Info:" / "Error:" prefix from status area
Jeremy Kerr [Tue, 13 Dec 2016 02:00:22 +0000 (10:00 +0800)]
ui/ncurses: remove "Info:" / "Error:" prefix from status area

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agoui/ncurses: Add status log UI
Jeremy Kerr [Tue, 6 Dec 2016 06:23:28 +0000 (17:23 +1100)]
ui/ncurses: Add status log UI

Currently, status messages from the server are displayed in a single
line at the bottom of the main menu UI, and are lost once a new status
is reported.

This change adds a facility for the UI to collect and display the status
messages from the server, in a dedicated UI screen. This allows a user
to look back through the discovery & boot process.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agotypes: Remove detail and progress from struct status
Jeremy Kerr [Wed, 7 Dec 2016 00:30:27 +0000 (11:30 +1100)]
types: Remove detail and progress from struct status

Nothing used these, and the serialisation was buggy anyway.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
2 years agotypes: shorten boot_status definitions
Jeremy Kerr [Wed, 7 Dec 2016 00:13:36 +0000 (11:13 +1100)]
types: shorten boot_status definitions

struct boot_status is a bit misnamed; we report status on things that
aren't just the boot status (eg, discovery).

This change refactors struct boot_status into just struct status. We
give the type enum a name, and shorten the enum values to suit.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoui/ncurses: Make server connect message more clear v1.3.2
Samuel Mendoza-Jonas [Thu, 3 Nov 2016 05:46:20 +0000 (16:46 +1100)]
ui/ncurses: Make server connect message more clear

The current message mentions a "server" which can give the misleading
impression that the UI is waiting for a remote network server. The delay
is actually in waiting for the pb-discover process to be ready, so
update the message to reflect that.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agodiscover/platform-powerpc: Reject bootdevs with empty UUIDs
Samuel Mendoza-Jonas [Tue, 22 Nov 2016 00:00:42 +0000 (11:00 +1100)]
discover/platform-powerpc: Reject bootdevs with empty UUIDs

If a "uuid:" label is set in the petitboot,bootdevs parameter without a
matching UUID, the UUID is unintentionally accepted and set to NULL.
This can cause a segfault in nc-config when device UUIDs are compared
against the autoboot option. Instead treat options like this as
malformed.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agodiscover/platform-powerpc: Deprecate petitboot,bootdev parameter
Samuel Mendoza-Jonas [Tue, 22 Nov 2016 00:00:01 +0000 (11:00 +1100)]
discover/platform-powerpc: Deprecate petitboot,bootdev parameter

The "petitboot,bootdevs" parameter has been around long enough now that
there shouldn't be anyone still transitioning over from the old
"petitboot,bootdev" parameter. Drop this parameter to simplify the
populate_bootdev_config() logic.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agodiscover/platform-powerpc: Remove unused max_partition_size
Samuel Mendoza-Jonas [Thu, 27 Oct 2016 05:24:56 +0000 (16:24 +1100)]
discover/platform-powerpc: Remove unused max_partition_size

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoSupport HTTP(S) proxies when downloading resources
Samuel Mendoza-Jonas [Thu, 27 Oct 2016 03:56:05 +0000 (14:56 +1100)]
Support HTTP(S) proxies when downloading resources

Allow the user to specify a HTTP and HTTPS proxy server. The discover
server will set the http_proxy and https_proxy environment variables,
enabling the proxy servers for any further HTTP(S) requests.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoui/ncurses: Spin child to ensure autoboot cancelled on exit
Samuel Mendoza-Jonas [Wed, 23 Nov 2016 00:48:07 +0000 (11:48 +1100)]
ui/ncurses: Spin child to ensure autoboot cancelled on exit

If the client is not connected to the server instance when exiting, fork
and have the child process spin until the server is available and can be
told to cancel autoboot. This prevents the scenario of a user exiting
the UI and having the server continue to autoboot while they are using
the command line.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoutils: Rename 30-dtb_updates to 30-dtb-updates
Arthur Heymans [Tue, 18 Oct 2016 11:21:06 +0000 (13:21 +0200)]
utils: Rename 30-dtb_updates to 30-dtb-updates

This is more consistent with other files in utils/hooks.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agodiscover/pxe-parser: Parse only the first config v1.3.1
Samuel Mendoza-Jonas [Fri, 23 Sep 2016 03:06:48 +0000 (13:06 +1000)]
discover/pxe-parser: Parse only the first config

Commit 2163af5 "discover/pxe-parser: Retrieve configs asynchronously"
added asynchronous loading of remote pxe filenames, but made an
unintended change in behaviour to the PXE parser. Previously the parser
would try a list of possible filenames, and parse the first one it
found. However the above commit spawns an asynchronous job for every
filename, and parses any that can be retrieved. It is a common
configuration to have a machine-specific config and a 'fallback' default
config, and the change means we could erroneously retrieve and parse
both configs.

Update the PXE parser so that asynchronous jobs are spawned
sequentially. That is, spawn a job for the first filename and if not
successful spawn another job for the next filename, and so on. Once a
remote config is successfully retrieved, parse it and stop.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agolib/file: Fix errors found by Coverity scan
Samuel Mendoza-Jonas [Wed, 7 Sep 2016 05:36:40 +0000 (15:36 +1000)]
lib/file: Fix errors found by Coverity scan

Fix several errors in copy_file_secure_dest() found by Coverity and some
minor formatting issues:

143603: Correctly handle mkstemp() return value
143605: Avoid accessing dest_filename[-1] on readlink() error
143606, 143610: Avoid accessing dest_filename[sizeof(dest_filename)]
143607: Fix incorrectly passing sizeof(pointer) to fread()
143608, 143611: Cleanup resources on early exit
143609: Explicitly set umask before calling mkstemp()

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoutils/hooks: Rename 30-add-offb to 30-dtb-updates v1.3.0
Samuel Mendoza-Jonas [Thu, 8 Sep 2016 01:45:21 +0000 (11:45 +1000)]
utils/hooks: Rename 30-add-offb to 30-dtb-updates

30-add-offb now performs functions other than just setting offb
information, so rename it to a more accurate '30-dtb-updates'.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoConsolidate petitboot,tty and petitboot,console
Samuel Mendoza-Jonas [Tue, 9 Aug 2016 06:16:48 +0000 (16:16 +1000)]
Consolidate petitboot,tty and petitboot,console

Commit ce54f86 "Add petitboot,tty and track available consoles" added
the petitboot,tty parameter, but the petitboot,console parameter is also
recognised by Petitboot. These are ultimately handled by the 30-add-offb
and 80-set-stdout hooks respectively, but exist for mostly the same
purpose.

We consolidate these down to just the original petitboot,console
parameter. If the contents of petitboot,console have been configured by
Petitboot (ie. it is of the form /dev/dev# [ Description ]) we behave as
normal, otherwise we assume that petitboot,console contains a full
OF path to the intended console device and do not allow it to be
modified. This follows petitboot,console's original intent to be a debug
aid, and takes precedence over any other use.
The 80-set-stdout hook is removed as 30-add-offb now accounts for both
use cases.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoUse 'consoles' instead of 'tty' to refer to interfaces
Samuel Mendoza-Jonas [Tue, 9 Aug 2016 06:01:49 +0000 (16:01 +1000)]
Use 'consoles' instead of 'tty' to refer to interfaces

'Console' is more readily understandable and technically more correct
than 'tty' for referring to the interfaces that Petitboot starts a UI on.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
3 years agoui/ncurses: Display warning when net override active
Samuel Mendoza-Jonas [Tue, 6 Sep 2016 03:30:39 +0000 (13:30 +1000)]
ui/ncurses: Display warning when net override active

If the current interface config has been set by an IPMI network
override, display a warning in nc-config that saving the current config
will overwrite any saved interface config.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>