| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
Currently, If we want disable all but a specific device type from
default boot, we need to add a negative priority for all other devices.
This change adds a DEVICE_TYPE_ANY definition, to allow a simpler way to
express "only boot a specific type" by default behaviour.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than rely on the ordering of the boot_priorities array to define
which device types have a higher "default boot" priority, this change
introduces a slightly more flexible way of priority lookups, by adding a
separate priority field to struct boot_priority.
This means we can have an unordered array, change priorities without
re-writing the array, and implementing a disable mechanism.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
Allow a platform to specify a DHCP architecture ID, as this is
platform-specific.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
Currently, we're always assuming a powerpc platform, as the powerpc
probe() function always returns true.
This change adds a check for some bits we need to work on a powerpc
platform.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's no need to include the config storage code in lib/ as only the
discover server should be using it.
This change moves the config-storage code to discover/, with the
platform-specific parts moved to a 'struct platform'. Each platform has
a probe function, which is called during init. The first probe function
to return a platform is used.
At present we only have the one platform, but it's now non-intrusive to
add others.
We keep an array of platform pointers in a separate ("platforms")
section, to allow the test module to drop-in its own test "platform".
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At the moment, UIs have the config_set_defaults function to estabilish
an initial configuration when performing an update.
Rather than using the defaults, this change provides a config_copy()
function, so that the updated configuration can be initialised from the
current config.
With this in place, the UI/server-common pb-config module can be reduced
to just the one function.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
| |
GRUB2 syntax allows for for-loops; this change adds supoprt in the
parser grammar and script execution code to implement them. In the
execution code, we simply update the for-loop variable and re-execute
the body statements.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to implement for-loops, we may need to evaluate the same chunk
of script more than once, and perform that evaluation in a different
context (particularly, with different environment variables).
Currently, the process_expansion code destroys the result of the
parse-tree (ie, the token list) when performing expansions. This means
that we can only perform the expansions once.
This change preserves the token list while creating the argv array. This
means that we can expand the list multiple times.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds a function to the parser API:
int parser_check_dir(struct discover_context *ctx,
struct discover_device *dev, const char *dirname)
- which allows parsers to check for the presence of a directory (path of
'dirname') on the device ('dev'). We use this in the GRUB2 parser to
implement the `test -d` check.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
menuentries may perform arbitrary commands; we only want ones that
define a boot option.
This change doesn't add a boot option if we haven't seen at least a boot
image defined in the menuentry.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
Since we support --id arguments on menuentries, add the corresponding
feature variable.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
No need to duplicate the environment-adding code in init_env, as we can
just use script_env_set.
Since script_env_set does its own talloc, we don't need to talloc our
strings here either.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, we don't update nvram if an NVRAM parameter is set to the
default. This means we can never revert a configuration to its default
value.
This change fixes the default setting behaviour; instead of checking for
a default, we want to check if it's a default and the option is absent.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
The de-facto PXELINUX standard specifies lowercase characters for the
MAC addresses, so change our reuqests to suit.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
We have a few incorrect checks for the exit status of a process; this
change adds a helper with the correct WIFEXITED && WEXITSTATUS==0 logic.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
Currently, we may report incorrect success when loading a URL, as we
only check the return value of process_run_sync() (and not the process
exit status itself) in load_process_to_local_file.
This fix adds a check to the synchronous load.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
The boot hooks may have altered the DTB in various ways, so add a final
(90-) boot hook to re-sort the dtb with `dtc -s`.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
udhcpc may pass the bootfile parameter as either $bootfile or
$boot_file, depending on whether the option is present in the BOOTP
header, or as a DHCP vendor option. We have code in pb-udhcpc to unify
this to $bootfile, but we only use the unified value in one of the user
events.
This change uses the correct value of bootfile, and fixes the check to
conditionally generate the explicit add event. We also need to update
the user-event code to use the right event parameter name.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
We have a typo in the udhcpc hook, where we're not referncing the
interface variable correctly. This means we'll get the same device
identifier for all netboot options.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
The $(< FILE) syntax we use to read an interface's MAC address doesn't
work in dash or busybox sh. Instead, use cat.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change implements support for the DHCP "pathprefix" option. We use
the following logic:
- If pathprefix is present and a full URL, we base the config file
location on pathprefix + conffile
- If pathprefix is present but not a full URL, we use it as the path
component of the URL, and pick up the host from other parameters in
the DHCP response
- If no pathprefix is present, we determine the configuration prefix
from the DHCP bootfile parameter.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
At present, we only match the 'file' portion of a URL in the parser
tests, so we "serve" a file if just the filename (but not the scheme,
hostname or path) matches the file we set with test_read_conf_embedded.
This change introduces test_read_conf_embedded_url, which we can use to
specify a full URL. In this case, the fake parser_request_file matches
the entire URL before returning the file data.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
Currently, user_event_parse_conf_url sets dc->conf_url if it detects we
have a full URL (rather than a base URL). This is a little too subtle,
so replace it with an explicit output parameter.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
Fix Petitboot's grub.cfg parser to handle --id=label argument to
menuentry, and use it (in preference to the option name) when looking
for a default option.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
We want to down the interfaces that we brought up, so hook up the
network_shutdown function to the discover exit path. Also, we only want
to down interfaces that we've configured, and exclude lo.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
| |
On machines that use device-tree boot, they'll often set an early
console, defined by the linux,stdout property in the /chosen/ device
tree node.
This hook adds a facility for petitboot to set this, based on an NVRAM
setting.
|
|
|
|
|
|
|
| |
Busybox tftp doesn't support -V, so prints an error to stderr. We'll
only see the Busybox identifier if we capture stderr too.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
For some process execution functions, we'd like to capture stderr as
well as stdout. Currently, we unconditionally redirect subprocess stderr
to the petitboot log file.
This change adds an add_stderr flag to struct process, which indicates
to the process library that we want stderr as well as stdout. If this is
specified, the subprocess' stderr is captured to stdout_buf.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
Add a test to ensure that boot option parameters don't leak into later
options.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The known_names list only duplicates the arg matching we do in the body
of the parser, and so introduces a problem when the array becomes out of
sync.
We drop the priority of the "unknown name" messages to pb_debug, as this
isn't really imporant unless we're debugging.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
Currently, we have a bug where a 'known_name' that appears before an
image section will cause globals_done to be set, and we don't see any
further global variables.
This change sets globals_done only once we see an image section.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, we have a bug when setting the default network configuration
(ie, no devices have any specific config), as we won't call
update_network_config to clear out the value of the petitboot,network
parameter.
This change always invokes update_network_config, regardless of the
number of interfaces configured. This ensures we clear out the
petitboot,network param, which is then synced to nvram if the param has
changed.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
Use the new widget validators, plus a bit of whole-form logic, to
implement some basic validation on the config UI.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
| |
We'd like to do some validation of the system configuration parameters,
so add a few validation types to the widget code. We currently need
integer, ipv4 address and multiple ipv4 address types. These are
implemented as small wrappers around the ncurses form validator code.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
| |
This makes it obvious if there's more than two characters in the field.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
Rather than #defining _GNU_SOURCE in our .c files, we can define this
from config.h instead.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
| |
The conversion is simple, no need for sprintf.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
This changes adds a 'link' parameter to the interface information sent
in sysinfo messages. The discover network code populates this from the
incoming netlink messages.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
| |
Looks like we missed adding a test source file.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
yaboot configuration files with no option will cause an assertion
failure (or segfault), as we unconditionally call yaboot_finish().
Check for the presence of an option in yaboot_finish() instead of
asserting.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
| |
We're seeing a crash when boot hooks are specifying new resources, as
boot_hook_update_param will write to a NULL struct load_url_result.
Instead of writing the updated values to the struct, copy the local
parts of the result to a separate string, which the boot hooks are free
to update.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
In commit 823958fb, we change to use struct process, but left in the
check for rc == BOOT_HOOK_EXIT_UPDATE. We actually want to check
process->exit_status here, not rc.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
| |
Partitions will share a serial number.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
|
| |
We're seeing the following in the boot editor:
image: (null)ftp://...
the (null) is due to the sep in conditional_prefix, which should be
blank, not NULL.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
YYLEX_PARAM is removed in bison 3.0, so we need to pass the scanner
param directly through yyparse (rather than referencing
parser->scanner). Unfortunately, we don't have the lexer header
available at the time we declare yyparse, so we need to pass a void *
here.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|