| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, we don't handle CDROM devices well; we'll try to mount on
boot, and not detect any media changes. Also, the default rules shipping
with udev will put the CDROM tray into a locked state, blocking eject
from working.
This change adds a set of cdrom utility functions, which the udev code
can use to properly initialise cdrom devices and handle eject and media
change requests.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
When we remove a device, some options may still be unresolved, and so
won't be deallocated through freeing the device.
This chagne explicitly removes & frees any currently-unresolved options
for this device.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
We're seeing a use-after-free, as the udev path is freed before the
discover device.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
Rather than always using the default prefix, we should determine it from
the location of the grub2 config file.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
In an upcoming change, we'll populate $prefix (which is used to locate
the environment file) based on the location of the config file, so these
paths will need to be consistent.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
|
|
| |
Currently, we re-use a grub2 parser for different filenames, and will
create one even if we find no matching files.
This change only creates a parser if parser_request_file succeeds, and
free() (and exits the parse) immediately after.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
| |
We only need to free the buf if parser_request_file returned success.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
| |
Implement -s and -f checks for grub, and test with the standard GRUB2
saved_default config.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
| |
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
| |
It should be dns,<server> not dns=<server>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
|
|
| |
We have a few instances where we check for a 'select' action (enter or
space key event), and some are inconsistent. Unify these with a
key_is_select() function.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
|
|
|
|
| |
Use wrefresh(curscr) to clean and repaint the entire screen.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|