Jeremy Kerr [Fri, 13 Sep 2013 02:09:24 +0000 (10:09 +0800)]
discover/grub2: Fix statement reduce rule
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 12 Sep 2013 10:46:57 +0000 (18:46 +0800)]
discover/grub2: Add var expansion code
Still todo: splitting.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 12 Sep 2013 08:08:18 +0000 (16:08 +0800)]
discover/grub2: Add initial script infrastructure
Now that we can parse scripts, we want some infrastructure for
execution.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 12 Sep 2013 07:54:36 +0000 (15:54 +0800)]
discover/grub2: Use subclass-style structs for AST
Use embedded 'struct grub2_statement' data to create a subclass-style
syntax tree of statements.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 12 Sep 2013 07:03:05 +0000 (15:03 +0800)]
discover/grub2: Implement statement blocks
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 11 Sep 2013 05:38:25 +0000 (13:38 +0800)]
discover/grub2: Implement reduce rules
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 11 Sep 2013 02:47:37 +0000 (10:47 +0800)]
discover/grub2: Add structures & API for parser
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 10 Sep 2013 06:04:41 +0000 (14:04 +0800)]
discover/grub2: Implement parser
Add our simple parser to handle a grub2 script. Since we're not building
a parse tree at the moment (we have no reduce rules), we just have a
simple word-based %union for our tokens.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 10 Sep 2013 03:01:55 +0000 (11:01 +0800)]
discover/grub2: Initial grub2 lexer
Add a simple flex lexer to tokenise our grub2 config files.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 13 Sep 2013 08:00:51 +0000 (16:00 +0800)]
lib: Add array-size header
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 23 Sep 2013 09:34:14 +0000 (17:34 +0800)]
discover/boot: Add booting status message
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 23 Sep 2013 09:31:43 +0000 (17:31 +0800)]
discover/boot: Allow printf formatting in update_status
It'd be nice to include arbitrary format strings here, so do a
taloc_vasprintf in update_status.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 23 Sep 2013 09:11:10 +0000 (17:11 +0800)]
discover/boot: Fix log message with no newline
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 23 Sep 2013 09:01:15 +0000 (17:01 +0800)]
discover: clear default_timeout waiter on timeout
We don't want cancel_default to try to remove an already-removed waiter.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 23 Sep 2013 08:27:17 +0000 (16:27 +0800)]
discover: Don't register multiple boot_timeout waiters
Rather than adding another timeout waiter, just override
handler->default_boot_option and extend the timeout a little.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 20 Sep 2013 06:25:30 +0000 (14:25 +0800)]
test/parser: check for multiple default options
Update check_boot_option_count to check if a parser returned more than
one boot option with is_default set.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 20 Sep 2013 06:21:43 +0000 (14:21 +0800)]
discover/pxe: Implement default options
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 14:18:04 +0000 (22:18 +0800)]
discover: Implement device priorities
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 14:04:12 +0000 (22:04 +0800)]
discover: register network devices with the device handler
We'd like to correlate incoming network boot options with a device, so
register the interface with the device hander.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 13:55:06 +0000 (21:55 +0800)]
discover/network: Manage network->interfaces with {add,remove}_interface
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 13:48:32 +0000 (21:48 +0800)]
discover/network: ignore devices with zero MTU
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 09:16:53 +0000 (17:16 +0800)]
discover: Remove unnecessary event passing
Currently, we pass "events" between the udev, user-event and
device-handler layers. These events all get sent through
device_handler_event, then de-multiplexed to an appropriate handler,
depending on their source.
Instead, just export relevant device_handler functions, and have the
(old) event sources call these functions directly.
This also means we can include a lot more of the device hander code in
the parser tests.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 13:07:19 +0000 (21:07 +0800)]
discover/boot: Fix use-after-free in boot()
We need boot_task for kexec_reboot.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 09:19:12 +0000 (17:19 +0800)]
lib/pb-config: Initialise DNS server info
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 19 Sep 2013 04:18:56 +0000 (12:18 +0800)]
lib/log: Cleanup log API
Rather than exposing log internals (through always_flush and
set_stream), do all logging init through pb_log_init(). If pb_log_init()
hasn't been called, pb_log will drop messages.
Also, add a pb_debug() function, specifically for debugging information.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 18 Sep 2013 03:49:14 +0000 (11:49 +0800)]
discover: Consolidate device path, name and ID.
This change cleans up our usage of device path, names and IDs.
Device ID is the kernel name for the device. We also expose this through
lookup_by_name.
Device path is the path to the dev node (ie, always starts with /dev/),
and is only used for mounting.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 18 Sep 2013 03:44:41 +0000 (11:44 +0800)]
discover: populate udev device types
Now that we have device types, populate from the udev info.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 18 Sep 2013 03:03:17 +0000 (11:03 +0800)]
types: Add device_type to struct device
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 18 Sep 2013 01:06:02 +0000 (09:06 +0800)]
lib/pb-config/powerpc-nvram: Add petitboot,timeout nvram property
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 18 Sep 2013 00:54:05 +0000 (08:54 +0800)]
lib/pb-config: Add autoboot timeout to configuration vars
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 6 Sep 2013 06:31:32 +0000 (14:31 +0800)]
pb-udhcpc: Fix string returned from resolve_url
In the 'as-is' case, we were echoing both URLs.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 6 Sep 2013 03:46:56 +0000 (11:46 +0800)]
discover/pxe: check for a valid boot option before adding
If we didn't find any valid boot options in the pxe buffer, we'll call
discover_context_add_boot_option with a NULL boot option.
This change adds a check before we try to add the boot option, and a
test to verify this situation.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 2 Sep 2013 03:01:20 +0000 (13:01 +1000)]
ui/ncurses: Allow both DEL and ^H to map to backspace
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Thu, 29 Aug 2013 13:51:58 +0000 (19:21 +0530)]
test/parser: add 'partition' directive overriding test for yaboot conf file
Check the overriding of 'partition' directive from yaboot conf file for
'petitboot', then verify the device name on which the resource resides
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Thu, 29 Aug 2013 13:51:32 +0000 (19:21 +0530)]
discover/yaboot-parser: Handle 'partition=' directive override
In a yaboot conf file, we may see a device= directive that actually
specifies a partition (eg, sda1) rather than the underlying block device
(sda). If we then encounter a partition= directive, we don't handle the
resolution of the partition correctly, as we simply append the
partition number to the device= string.
This change implements a smarter handling of the partition= directive,
where we strip away any partition information from the device=
parameter first.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Tue, 27 Aug 2013 09:04:51 +0000 (14:34 +0530)]
test: add 'partition=directive' test for yaboot conf file
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 29 Aug 2013 03:52:28 +0000 (13:52 +1000)]
test/lib: Implement process_init change in testcases
We need to provide the dry_run argument.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 20 Aug 2013 02:30:57 +0000 (10:30 +0800)]
lib/process: handle EINTR from waitpid
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 20 Aug 2013 02:14:22 +0000 (10:14 +0800)]
lib/process: Add dry_run argument to process_init
Implement dry-run behaviour on the discover server by passing a bool to
process_init. UIs don't need to support dry runs.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 13 Aug 2013 05:03:53 +0000 (13:03 +0800)]
lib/process: replace pb_run_cmd
This change replaces the pb_run_cmd() function with proper usage of the
process API.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 12 Aug 2013 08:39:36 +0000 (16:39 +0800)]
lib/process: replace pb_run_cmd_pipe
Replace pb_run_cmd_pipe with process_create / process_run_sync.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 14 Aug 2013 07:05:56 +0000 (15:05 +0800)]
test/lib: add process tests
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 19 Aug 2013 03:58:23 +0000 (11:58 +0800)]
lib/waiter: handle -EINTR
Now that we're handing non-fatal signals (i.e., SIGCHLD in the process
lib), we need to gracefully handle -EINTR from poll().
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 12 Aug 2013 07:57:41 +0000 (15:57 +0800)]
lib/process: Add process helpers
We've grown-out of pb_run_cmd a little, as we have a number of different
process types:
boot():
- kexec: short-running process, run synchronously
- boot hooks: short-running, run sync, need exit code & stdout
network init:
- interface configuration: short running, run sync
- udhcp processes are long running, we may want completion, but
doesn't block other actions
downloads:
- potentially long-running, block parse progress
config nvram:
- read: short running, can block, need stdout
- write: short running, can block
We'd like to introduce proper asynchronous processes, to allow config &
boot-option downloads without blocking the discover server.
This change introduces a new type for processes, 'struct process'. These
structures are created with process_create, and run with
process_run_sync or process_run_async. The latter reports completion
through a callback member of struct process.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 19 Aug 2013 03:08:56 +0000 (11:08 +0800)]
test: Add --enable-test-valgrind
Add an --enable-test-valgrind argument to configure, to run all tests
under valgrind, configured to fail on leaked memory
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 19 Aug 2013 03:08:36 +0000 (11:08 +0800)]
test/lib: Use talloc in list test
.. so we can free at exit
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 12 Jul 2013 06:25:07 +0000 (14:25 +0800)]
test/lib: build with -DEBUG
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 13 Aug 2013 03:23:57 +0000 (11:23 +0800)]
discover/boot: talloc struct boot_task
Rather than using the stack for struct boot_task, talloc one instead.
This gives us a short-lived context (active for the boot() process
only), and we don't need to use the externally-provided context
directly.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 12 Jul 2013 06:31:49 +0000 (14:31 +0800)]
discover: remove unused user_event_trigger
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 19 Aug 2013 01:58:58 +0000 (09:58 +0800)]
lib/waiter: remove waitset_destroy
We can rely on the ctx free to destroy the waitset.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 14 Aug 2013 06:55:46 +0000 (14:55 +0800)]
lib/waiter: talloc waiters from waitset context
We can lose a reference to the first waiter allocated, as set->waiters
may be NULL.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 14 Aug 2013 06:17:02 +0000 (14:17 +0800)]
lib/waiter: fix talloc_realloc context
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Sat, 1 Jun 2013 10:07:40 +0000 (20:07 +1000)]
lib/waiter: merge time & io waiter init loops
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Sat, 1 Jun 2013 09:56:15 +0000 (19:56 +1000)]
lib/waiter: move type-specific members to a union
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 15 Aug 2013 07:28:06 +0000 (15:28 +0800)]
discover/file: Add sensible perms when using replace_file
Rather than no access at all, use a default of 0644.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 15 Aug 2013 07:27:39 +0000 (15:27 +0800)]
discover/network: free buffers from resolv.conf update
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 15 Aug 2013 07:25:14 +0000 (15:25 +0800)]
discover/network: fix incorrect nameserver directive in resolv.conf
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 8 Aug 2013 07:41:39 +0000 (15:41 +0800)]
network: handle DNS config
If we have a dns config option, update resolv.conf
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 8 Aug 2013 07:25:24 +0000 (15:25 +0800)]
discover/file: Add replace_file()
Add a function to atomically replace a file.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 8 Aug 2013 06:40:59 +0000 (14:40 +0800)]
discover: separate file-reading code into file.c
We'll need to read files in the network config code, so add a 'file'
object, containing the read_file function.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 8 Aug 2013 06:33:19 +0000 (14:33 +0800)]
discover: remove libparser object
There's no real need for a separate libparser object. Our tests pull-in
the parsers directly, and the discover server is the only thing that
actually links to libparser.ro.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 8 Aug 2013 06:21:00 +0000 (14:21 +0800)]
config: DNS configuration isn't interface-specific
Rather than attaching DNS configuration to an interface, separate it out
into general network config.
The powerpc-nvram storage exepects dns as a "dns,server,..." string.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 8 Aug 2013 05:54:19 +0000 (13:54 +0800)]
config: Split interface configuration from network configuration
This change moves the interface configuration into its own 'struct
interface_config'. We also remove the _config suffix from the network
and interface members.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 7 Aug 2013 06:39:40 +0000 (14:39 +0800)]
discover/yaboot: implement default options
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 7 Aug 2013 06:00:16 +0000 (14:00 +0800)]
discover/yaboot: fix device parsing
A couple of fixes for yaboot's device-handling code. Firstly, we need to
use 'device=' rather than 'root=', as the latter is purely for ybin, to
define where the yaboot binary goes.
Secondly, we need to respect global and option-specific device=
parameters. To do this, we keep all boot_image and initrd strings in the
state, and create the actual resources in yaboot_finish.
Add a test for all override cases, and fix the incorrect boot= parsing
in the rh8 test.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 7 Aug 2013 02:31:05 +0000 (10:31 +0800)]
discover/yaboot: Allow all image options to be overridden by global options
All of the image options should be overridable by global options.
Instead of building the boot_args during yaboot_process_pair, we add
discovered data into the state struct, then create the boot args from
this data during yaboot_finish
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 1 Aug 2013 07:25:53 +0000 (15:25 +0800)]
discover: fix segfault on failed boot image load
If the boot image fails to load, we end up calling talloc_free on an
unitialised are of stack (boot_task.local_initrd).
Move the initialisers a little earlier, so we always NULL pointers
before potentially freeing.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 31 Jul 2013 00:44:11 +0000 (08:44 +0800)]
parser/yaboot: Fix check for image presence
In the cleanup of yaboot option state,
3fb8fb6fb, we change from
checking opt->boot_image to opt, to indicate that we're parsing an image
section.
We missed one check, which is causing a segfault due to the null opt.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Geoff Levand [Tue, 23 Jul 2013 20:30:19 +0000 (13:30 -0700)]
discover: Hookup --no-autoboot to config
Add new routine config_set_autoboot(), and use it to set
the --no-autoboot option.
Signed-off-by: Geoff Levand <geoff@infradead.org>
Geoff Levand [Tue, 23 Jul 2013 19:09:18 +0000 (12:09 -0700)]
discover: Add --no-autoboot option
Add the command line option --no-autoboot to pb-discover
and update the pb-discover manpage.
Signed-off-by: Geoff Levand <geoff@infradead.org>
Geoff Levand [Tue, 23 Jul 2013 17:59:23 +0000 (10:59 -0700)]
discover: Log autoboot timeout
Signed-off-by: Geoff Levand <geoff@infradead.org>
Geoff Levand [Mon, 22 Jul 2013 21:38:52 +0000 (14:38 -0700)]
discover: Rename default_enabled
Rename default_enabled to autoboot_enabled for consistency
with pb-config.
Signed-off-by: Geoff Levand <geoff@infradead.org>
Geoff Levand [Sat, 20 Jul 2013 00:11:09 +0000 (17:11 -0700)]
discover: Add grub.cfg path for openSUSE
Signed-off-by: Geoff Levand <geoff@infradead.org>
Geoff Levand [Sat, 20 Jul 2013 00:07:31 +0000 (17:07 -0700)]
configure: Update to use AX_WITH_CURSES
For a more portable build system convert to using the
autoconf-archive AX_WITH_CURSES macros. Allows building
on openSUSE, which has a different header file layout than
other distros, and fixes menu entries with UTF-8 characters;
this causes fedora installs (codename "Schrödinger´s cat")
to break the UI.
Signed-off-by: Geoff Levand <geoff@infradead.org>
Geoff Levand [Fri, 19 Jul 2013 00:23:41 +0000 (17:23 -0700)]
automake: Add $(EXEEXT) to .ro objects
Signed-off-by: Geoff Levand <geoff@infradead.org>
Jeremy Kerr [Tue, 9 Jul 2013 06:03:35 +0000 (14:03 +0800)]
ui/ncurses: Add setlocale call
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Geoff Levand <geoff@infradead.org>
Jeremy Kerr [Thu, 18 Jul 2013 05:21:37 +0000 (13:21 +0800)]
discover: Don't free URL in load_url
Previously, load_url took a char * argument, from which it parsed a
newly allocated URL, and freed the URL before returning.
Commit
5be946c changed load_url (then load_file) to accept a parsed URL
instead of a char *, but didn't remove the free. Any URLs passed to
load_url are currently being unintionally free()ed.
This change removes the invalid free.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 15 Jul 2013 08:09:09 +0000 (16:09 +0800)]
pb-udhcp: Fix MAC-address-based configuration file location
We're currently requesting a colon-separated MAC address. Instead, we
need it to be hypen-separated, and prefixed with the ethernet type
("01-").
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 15 Jul 2013 05:11:13 +0000 (13:11 +0800)]
pb-udhcp: PXE fixes
Fix a couple of bugs in the udhcp script.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 10 Jul 2013 07:50:43 +0000 (15:50 +0800)]
lib/waiter: Defer free of removed waiters
We may end up calling remove()-d time waiters if the timeout expires as
we're processing an IO waiter. Instead of freeing the waiter in
waiter_remove, mark the waiter as inactive, and defer the free until the
end of waiter_poll().
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 9 Jul 2013 08:16:48 +0000 (16:16 +0800)]
discover/pxe: remove debug statement
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 9 Jul 2013 08:14:41 +0000 (16:14 +0800)]
test/parser: Add pxe tests
Add a couple of tests to verify the pxe parser, particularly the
different styles of initrd handling.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 9 Jul 2013 08:14:00 +0000 (16:14 +0800)]
test/parser: Add check_resolved_url_resource
Add a check for external URL resources.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 9 Jul 2013 08:12:51 +0000 (16:12 +0800)]
discover/pxe: Handle initrds
We may see initrds specified on the kernel argument line, or as their
own configuration directive.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 9 Jul 2013 07:24:38 +0000 (15:24 +0800)]
pb-console: Read /etc/environment and /etc/locale
Since we're starting from no environment on the consoles, allow
specifying an initial environment.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 4 Jul 2013 07:27:01 +0000 (15:27 +0800)]
test/parser: Add test_set_conf_source()
For non-local parsers (ie, PXE), we need to have the conf_url set. This
change adds a function to provide the originating URL.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 4 Jul 2013 07:25:51 +0000 (15:25 +0800)]
discover/pxe-parser: All options are name <space> value pairs
Abort the pair parse if we don't have both a name and a value.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 2 Jul 2013 03:24:10 +0000 (11:24 +0800)]
discover/device-handler: hook up autoboot_enabled config var
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 2 Jul 2013 02:47:35 +0000 (10:47 +0800)]
config/powerpc-nvram: Fix nvram line parsing
We have a couple of issues with the nvram output parser; lines aren't
being broken up correctly.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 2 Jul 2013 02:36:47 +0000 (10:36 +0800)]
config/powerpc-nvram: Don't require petitboot, prefix on all params
Currently, we only store nvram params with a "petitboot," prefix, so
that we don't grow the config list to an unbound size. However,
the "auto-boot?" param has no prefix.
Instead, remove the requirement for the "petitboot," prefix, and use an
array of known parameters instead.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Geoff Levand [Sun, 30 Jun 2013 20:45:58 +0000 (13:45 -0700)]
discover: Fix automake warnings
Change the Makfile.am relocatable output files from automake _LIBRARIES
to automake _PROGRAMS. Also, change the output file name extension
from .o to .ro to better show these are relocatable files.
Fixes automake warnings like these:
discover/Makefile.am: `libparser.o' is not a standard library name
discover/Makefile.am: did you mean `libparser.a'?
Signed-off-by: Geoff Levand <geoff@infradead.org>
Geoff Levand [Sun, 30 Jun 2013 20:31:32 +0000 (13:31 -0700)]
test/parser: Cleanup Makefile.am
General cleanup of Makefile.am. This cleanup should retain the same
makefile behavior.
Signed-off-by: Geoff Levand <geoff@infradead.org>
Jeremy Kerr [Mon, 24 Jun 2013 05:03:14 +0000 (13:03 +0800)]
ui/ncurses: Remove unused 'cod' variable
When configured with --disable-debug, we get an unused variable warning:
ui/ncurses/nc-cui.c: In function 'cui_device_remove':
ui/ncurses/nc-cui.c:439:24: error: unused variable 'cod'
cc1: all warnings being treated as errors
This change just removes the temporary variable.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 21 Jun 2013 02:43:49 +0000 (10:43 +0800)]
utils/hooks: Add sample update-dtb hook.
Provide an example for writing a pre-boot hook to update the dtb.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 20 Jun 2013 06:04:29 +0000 (14:04 +0800)]
discover/boot: Allow boot hooks to alter boot data
By exiting with status == 2, boot hooks can update boot data by
printing name=value to stdout.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 20 Jun 2013 06:19:24 +0000 (14:19 +0800)]
utils/hooks: Add create-dtb hook
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 20 Jun 2013 05:27:16 +0000 (13:27 +0800)]
lib/system: Add pb_run_cmd_pipe
Add a function to run a command and capture the output into a buffer.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 20 Jun 2013 04:00:26 +0000 (12:00 +0800)]
discover/event: Fix incorrect calculation of param data length
We're not accounting for the action in the event header (only the device
string) when we pass the length of param data to event_parse_params.
This means we walk past the end of the event data while parsing params.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 20 Jun 2013 02:56:04 +0000 (10:56 +0800)]
utils: Add busybox reboot script
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 20 Jun 2013 02:33:29 +0000 (10:33 +0800)]
discover/boot: Add boot hooks
Add a method of running pre-boot hooks. Executable files in
/etc/petitboot/boot.d/ are run (in order) before we start the boot
process.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>