summaryrefslogtreecommitdiffstats
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* configure: Add libelf as a requirementMaxiwell S. Garcia2020-01-231-1/+2
| | | | | | | | | | With this library, petitboot is able to open the ELF binary to check information, like annotation in ELF notes section. Minor libelf-dw dependency additions by Jeremy Kerr <jk@ozlabs.org>. Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-console: don't modify PATH unless it's emptyJeremy Kerr2019-10-081-3/+1
| | | | | | | | | | | We're now running pb-console through a proper login shell, so we shouldn't need to modify PATH, as we expect it to be properly set up by the shell profile. This change removes the unconditional PATH modification, so we only set a basic PATH if it's currently empty. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-console: start shell as a login shellJeremy Kerr2019-10-081-1/+1
| | | | | | | | | | | | | The environment that pb-console starts is minimal, as we have likely been run by udev. Because we're starting a shell, we want the proper profile set up, so run as a login shell. This assumes the shell accepts -l, but we already have an assumption for supporting -m (as /bin/ash does). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils: Optionally run utilities as rootSamuel Mendoza-Jonas2019-06-071-1/+12
| | | | | | | In particular this fixes running pb-plugin executables from the UI since the wrapper requires root to set up the environment. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils: Quote plugin name and vendor variablesSamuel Mendoza-Jonas2019-05-301-2/+2
| | | | | | Otherwise we only get the first word displayed in the UI. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Various fixups and checks to make scan-build happySamuel Mendoza-Jonas2019-05-301-1/+1
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-console: Use -m to run shell in own process groupv1.10.3Samuel Mendoza-Jonas2019-04-011-1/+1
| | | | | | | | Use -m to have the shell spawned by pb-console run it its own process group, allowing commands such as Ctrl-C (SIGINT) to behave as expected rather than killing the shell. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-console: Trap SIGTERM on bootv1.10.2Samuel Mendoza-Jonas2019-03-061-2/+1
| | | | | | | | | | | | | | | | On kexec all processes will be sent a SIGTERM and SIGKILL. By default there are messages on the console alerting the user to this, however in some implementations these messages are disabled. This can have the effect of the UI seemingly exiting to the shell on boot and hanging for a short while before the kexec actually jumps into the next kernel. Trap the SIGTERM sent to the pb-console parent process and print a short message to the screen instead of momentarily dropping to the shell and printing the usual help messages. While here also cleanup the shell help messages below which are now handled in the shell's .shrc file. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils: Add helper to send mailbox requestSamuel Mendoza-Jonas2018-12-131-0/+166
| | | | | | A simple script to set, display, and clear a BMC's boot initiator mailbox. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-console: Ignore SIGINTSamuel Mendoza-Jonas2018-12-031-0/+2
| | | | | | | Trap and ignore SIGINT to avoid a SIGINT intended for petitboot-nc also exiting the parent pb-console script. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-console: Set up controlling terminalSamuel Mendoza-Jonas2018-12-031-1/+1
| | | | | | Enabling job control in the shell. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-sos: Don't create files in root by defaultSamuel Mendoza-Jonas2018-12-031-7/+6
| | | | | | | If running in a non-root shell the user will not be able to create or access files in / so operate in the current directory instead. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-console: Support agetty's autologin optionSamuel Mendoza-Jonas2018-12-031-2/+14
| | | | | | | | If the getty arguments include '-a' do not set the '-l' option. This implies the environment has been configured with users and will launch the subsequent pb-console instance itself. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-udhcpc: Recognise DHCPv6 parametersSamuel Mendoza-Jonas2018-07-101-1/+1
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: implement a periodic requery for network devicesJeremy Kerr2018-07-091-2/+2
| | | | | | | | | | | | | | | | | | If we boot a machine before external (network) dependencies are properly configured, it will have tried once to download configuration, and possibly failed due to that configuration not being present. This change introduces a periodic requery of network resources. After a timeout, petitboot will either re-acquire its DHCP lease (causing any downloads to be re-processed, possibly with different parameters from the new lease), or re-download a statically defined URL. This timeout defaults to five minutes (similar to pxelinux), and is configurable by DHCP option 211, "reboot time". Signed-off-by: Jeremy Kerr <jk@ozlabs.org> [added test stub] Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Rescan SCSI devices on reinitSamuel Mendoza-Jonas2018-06-122-1/+7
| | | | | | | Explicitly rescan SCSI devices on reinit rather than just remounting them in case a device did not init properly on boot. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/hooks: Set stdout-path propertySamuel Mendoza-Jonas2018-03-071-8/+7
| | | | | | | | The linux,stdout-path property was deprecated in favour of stdout-path in the v3.14 kernel. 'stdout-path' takes priority in newer kernels but older kernels won't be aware of it, so set both at boot time. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* printf: Fix format type warningsGeoff Levand2018-01-101-3/+3
| | | | | | | | | Fixes build warnings like these when building 32 bit programs: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument has type ‘uint64_t’ Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Fix bootstrap warning: noinst_PROGRAMS was already definedCyril Bur2017-11-201-1/+1
| | | | | | | | | | | utils/Makefile.am:27: warning: noinst_PROGRAMS was already defined in condition TRUE, which includes condition HAVE_LIBFDT ... utils/Makefile.am should probably be adding to noinst_PROGRAMS rather than reclaring it. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Add pb-plugin and pb-exec to pb_system_appsSamuel Mendoza-Jonas2017-08-151-1/+1
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/pb-plugin: Advertise pb-plugins to discover serverSamuel Mendoza-Jonas2017-08-151-14/+40
| | | | | | | | | | | | 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>
* utils: Add pb-exec wrapperSamuel Mendoza-Jonas2017-08-151-0/+16
| | | | | | | | 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>
* pb-sos: effectively compress the pb-sos file with gzipv1.5.0Guilherme G. Piccoli2017-07-121-3/+7
| | | | | | | | | | | | | | 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>
* pb-sos: capture Skiboot logGuilherme G. Piccoli2017-07-121-0/+4
| | | | | | | | | 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>
* util/hooks: Don't update DT when ttyS* console activev1.4.2Samuel Mendoza-Jonas2017-03-171-1/+4
| | | | | | | 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>
* utils/hooks: Don't fail early if fb0 missingSamuel Mendoza-Jonas2017-03-161-16/+31
| | | | | | | 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>
* utils: Rename 30-dtb_updates to 30-dtb-updatesArthur Heymans2016-10-191-1/+1
| | | | | | | 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>
* utils/hooks: Rename 30-add-offb to 30-dtb-updatesv1.3.0Samuel Mendoza-Jonas2016-09-082-3/+3
| | | | | | | 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>
* Consolidate petitboot,tty and petitboot,consoleSamuel Mendoza-Jonas2016-09-083-26/+5
| | | | | | | | | | | | | | | | | | | | 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>
* Use 'consoles' instead of 'tty' to refer to interfacesSamuel Mendoza-Jonas2016-09-081-11/+14
| | | | | | | '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>
* utils: Always pass MAC address in pb-udhcpcSamuel Mendoza-Jonas2016-09-081-2/+3
| | | | | | | | pb-udhcpc currently only passes the interface's MAC address for an 'add' event, however it is useful to know it for any user event concerning a network interface. Pass it to pb-event in all cases. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* hooks/set-stdout: move hook to after automatic stdout settingsv1.2.2Jeremy Kerr2016-08-082-2/+2
| | | | | | | | | | If a console is defined in NVRAM, we want it to take precedence over anything that 30-add-offb calculates automatically. This change shifts the 20-set-stdout script to later in the hook processing, so that it will override any automatic settings. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* hooks/add-offb: Add leading slash to HVC node pathsJeremy Kerr2016-08-081-1/+1
| | | | | | | | | | We need an absolute path to the serial@N device. It looks like some kernels aren't reading the current path correctly, leading to no console output. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Acked-by: Stewart Smith <stewart@linux.vnet.ibm.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Add 'sync' user eventSamuel Mendoza-Jonas2016-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | Add a user event named 'sync' that causes the discover server to merge the devicemapper snapshots of mounted devices. This is particularly useful as a debug aid (for example, when copying logs to a USB device), as the server will otherwise only sync changes to mounted devices in response to parser actions. The command can be called as pb-event sync@device to sync a particular device, or as pb-event sync@all to sync all devices with snapshots. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/hooks: Set linux,stdout-path for primary consolev1.2.0Samuel Mendoza-Jonas2016-06-291-0/+120
| | | | | | | | If the boot_tty environment variable is set, determine which device path to set in the linux,stdout-path property, which will instruct the next kernel to use it as the primary console. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils: Add diagnostic scriptv1.1.0Samuel Mendoza-Jonas2016-05-243-1/+78
| | | | | | | | | | | | | | | | Add a simple script to gather up useful information in the unlikely event a user runs into trouble. Usage: pb-sos [-v] [-f file] [-d user@host:/path] Options -v verbose output -f file Supply filename for tar archive (default pb-sos.tar) -d host Supply user, hostname, and path to transfer archive to a remote host Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* pb-event: Add 'boot' user eventSamuel Mendoza-Jonas2016-05-061-1/+1
| | | | | | | | | | | Add a user event to send a boot command to the discover server. The format of the boot command is similar to the add command, eg: pb-event boot@eth0 image="http://host/image" initrd="http://host/initrd" and also recognises "id", "dtb", and "args" arguments. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* pb-console: Reduce kernel log output before starting UISamuel Mendoza-Jonas2016-05-061-0/+4
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* utils/hooks: Write offb device address to device treeSam Mendoza-Jonas2016-02-252-0/+501
| | | | | | | | | | | On OpenPOWER machines, kernels missing the AST video driver can use the existing 'Open Firmware' framebuffer device code to inherit an existing framebuffer from Petitboot. This requires us to translate the 64-bit address of the framebuffer 'back' into a PCI address and write it into an assigned-addresses property in the device tree. Bootstrapped-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* Merge branch 'pb-plugin' into masterSamuel Mendoza-Jonas2015-09-112-123/+453
|\ | | | | | | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
| * pb-plugin: Don't execute metadata filesJeremy Kerr2015-09-111-7/+25
| | | | | | | | | | | | | | Rather than sourcing a plugin's metadata file, explicitly parse variables. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-plugin: Fix invalid command referenceJeremy Kerr2015-09-021-2/+2
| | | | | | | | | | | | | | We had the old code for using 'run'. Also, fix the error we see when issuing an invalid command. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-console: Always add plugins directory to PATHJeremy Kerr2015-09-021-1/+2
| | | | | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-plugin: Add lint commandJeremy Kerr2015-09-021-41/+140
| | | | | | | | | | | | | | This change adds a `lint` command, to do some basic checks on the plugin structure and metadata. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-plugin: Implement plugin ABI versioningJeremy Kerr2015-09-021-1/+84
| | | | | | | | | | | | | | | | | | | | | | If a future update to plugins is not compatbile with the installed plugin infrastructure, we want to abort the scan / install process. This change adds an ABI version to the script, as well as version (and minimum-supported version) to the plugin metadata. This means we can check before plugin execution. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-plugin: Only require a fixed plugin extension, instead of full nameJeremy Kerr2015-09-021-51/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the `pb-plugin scan` code requires a fixed archive name at the root of distributed media. This means that vendors need to have a fixed name, and can only ship one plugin per device. This change shifts the requirement to just a filename extension (.pb-plugin) instead. To handle this, we now look for any plugin with a .pb-plugin extension, and so may find multiple plugins on a device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-plugin: Move plugin wrappers to a separate dirJeremy Kerr2015-08-272-2/+4
| | | | | | | | | | | | Use /var/lib/pb-plugins/bin, to prevent overwriting system binaries. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-plugin: Keep chroot persistent, and create wrapper scriptsJeremy Kerr2015-08-211-40/+54
| | | | | | | | | | | | | | | | | | | | | | Rather than having to 'pb-plugin run' multiple times, we want users to be able to execute multiple plugin binaries with more accessible command-line statements. This change reverts to the previous 'install' (rather than 'run') behaviour, and creates wrapper scripts to call into the chroot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| * pb-plugin: Update to chroot-style pluginsJeremy Kerr2015-08-071-93/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change uses a chroot for all plugins, so that plugins have complete flexibility with their libraries, dependencies and configuration. We remove the 'install' action, as we simply run the plugin once. Running involves extracting the archive, setting up a root filesystem, and running a chroot. To simplify plugin discovery behaviour, we standardise the plugin file to be at pb-plugin.conf of attached devices, and read the metadatafile straight out of the archive. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* | discover: Add disable param for dm-snapshotsSamuel Mendoza-Jonas2015-08-181-0/+2
|/ | | | | | | Add a debug-style nvram parameter to disallow the use of device-mapper snapshots. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
OpenPOWER on IntegriCloud