Provide a way to pass the 'fake go' flag from the bootflow flag through
to the PXE implementation, so that a request for a fake go
(via 'bootflow boot -f') is handled correctly in the bootmeth and when
booting.
Add a little more debugging of this in PXE.
Signed-off-by: Simon Glass <sjg@chromium.org>
Converting back and forth between a string and a ulong does not make
much sense. Simplify the code by adding a separate value for the kernel
address.
Signed-off-by: Simon Glass <sjg@chromium.org>
This function is needlessly convoluted, reading the kernel address as a
string, possibly adding the FIT configuration, then parsing that to
obtain the kernel address again.
Create a kern_addr variable to hold the kernel address, so we can
simplify the code.
Signed-off-by: Simon Glass <sjg@chromium.org>
We normally require environment variables when loading files using PXE/
syslinux. This is not really necessary, since we can use lmb to find a
suitable space.
Add support for reserving space in get_relfile_envaddr(), which is the
commonly used function for reading a file. Use env_get() so no error is
shown if the environment variable does not exist.
Signed-off-by: Simon Glass <sjg@chromium.org>
It doesn't seem worth allocating space for a label when it is normally
going to be under 20 characters. Use a fixed-sized string (with plenty
of space) instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
This is a string, so add a string suffix to make that clear.
Switch the assignment order in label_run_boot(), since the FDT is loaded
after the kernel.
Signed-off-by: Simon Glass <sjg@chromium.org>
Several of the strings in this struct would be better off as addresses,
now that they are passed around a fair bit.
Start by converting initrd_addr_str to ulong
Signed-off-by: Simon Glass <sjg@chromium.org>
Update this function to return the address obtained from the environment
variable. That will allow the caller to know where the image ended up.
For now this is not used.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases we don't have a particular address to read into so would
like one reserved. Adjust this function to support that.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases we don't have a particular address to read into so would
like one reserved. Adjust this function to support that.
For now, sysbot_read_file() fails if the address is not provided. This
will be resolved in a later patch.
Signed-off-by: Simon Glass <sjg@chromium.org>
When 'bootflow read' is used to read images, initrd_str is not inited
before strdup() is called. Note that this is only used by developers.
Set the variable to an empty string to start.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present we require this environment variable in order to do any
booting. The check for this actually later (the '"malloc fail' message)
but there is a possible NULL access before getting to that point.
Check it immediately after reading.
Signed-off-by: Simon Glass <sjg@chromium.org>
If a load-only FIT has already provided a devicetree, PXE boot may need
to restart the bootm sequence, rather than starting an entirely new one,
so that the devicetree is preserved and used for booting.
Add support for this by adding a new field in the context and updating
extlinux_boot() to receive the value as a new parameter.
Signed-off-by: Simon Glass <sjg@chromium.org>
The pxe_utils.c file is quite large and has a mix of parsing and booting
code. Split out the parsing into a new 'pxe_parse.c' file.
Add function prototypes for parse_pxefile_top() and label_destroy(), the
two functions used by pxe_utils.c
Signed-off-by: Simon Glass <sjg@chromium.org>
If a load-only FIT has already provided a devicetree, PXE boot may need
to restart the bootm sequence, rather than starting an entirely new one,
so that the devicetree is preserved and used for booting.
Add support for this by adding a new field in the context and updating
extlinux_boot() to receive the value as a new parameter.
Signed-off-by: Simon Glass <sjg@chromium.org>
The pxe_utils.c file is quite large and has a mix of parsing and booting
code. Split out the parsing into a new 'pxe_parse.c' file.
Add function prototypes for parse_pxefile_top() and label_destroy(), the
two functions used by pxe_utils.c
Signed-off-by: Simon Glass <sjg@chromium.org>
This shows a message for the user. Implement it to keep the user
informed.
Series-to: u-boot
pxe: Support an automatic localboot
It seems that extlinux expects that boards know how to boot a local OS
from attached media. U-Boot currently assumes that boards define a
"localcmd" environment variable to support this. None does.
Provide an automatic means to find a kernel and ramdisk, using common
filenames. This addresses booting on MAAS, at least.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
The current localboot implementation assumes that a 'localcmd'
environment variable is provided, with the instructions to follow. This
may not be included, so provide a fallback in that case.
Add a test image and test as well.
Signed-off-by: Simon Glass <sjg@chromium.org>
The devicetree file may not be provided, so avoid a failure in that
case.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Use CONFIG_ZBOOT instead of CONFIG_CMD_ZBOOT as the condition for
supporting booting from a zImage, so that this works when CONFIG_CMDLINE
is disabled.
Series-to: heinrich
Cover-letter:
boot: Enable bootstd features without CMDLINE
This series refactors various Kconfig options to allow programmatic boot
to operate on x86.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
We must use the ramdisk address for the initrd_addr field, not the kernel
address. Fix this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: e05cda3004 ("boot: pxe: Refactor label_run_boot() to avoid")
Reviewed-by: Tom Rini <trini@konsulko.com>
It is useful to be able to select a bootflow and read its images,
without actually doing the boot. This allows adjusting the bootargs, for
example.
Provide support for this in the pxe_utils module, by adding a 'probe'
method which selects a label and saves its settings, so it can be booted
later, if desired.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than assuming that a file can be booted with bootm, check that
the format is correct first. Do the same for booti.
Signed-off-by: Simon Glass <sjg@chromium.org>
Move processing of a missing FDT so that it happens before booting, so
we can see the result in the bootflow.
Signed-off-by: Simon Glass <sjg@chromium.org>
Move processing of the FDT so that it happens before booting. Add a test
to check that the FDT is now visible.
Signed-off-by: Simon Glass <sjg@chromium.org>
Provide a way to skip booting the OS and just return. This will allow
bootstd to read out useful information.
Add debugging to help figure out the flow.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present the only option with PXE is to boot it and see what happens.
Provide a bootflow, when available, so that PXE will eventually be able
to add some useful information to it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Adjust the remaining call in this function to use the bootm API. This
will allow PXE to work without the command line.
Signed-off-by: Simon Glass <sjg@chromium.org>
Tidy up this code a little to avoid two calls to env_get() for both
fdt_addr and fdtcontroladdr
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Quentin Schulz <quentin.schulz@cherry.de>
Rather than building a command line for each operation, use the
functions provided by the bootm API.
Make sure that the bootm functions are available if pxe_utils is used.
Since SYS_BOOTM_LEN is not present for the tools-only build, adjust the
code to handle that.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Since this function only adjusts one element of the bootm command, pass
just that. This will make it easier to refactor things to remove the
bootm command.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
This function is quite long. Split out the FDT processing into its own
function.
Add a function comment for the new label_process_fdt() function.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
This function is far too long. Split out the part which builds and runs
the bootm/i/z commands into its own function.
Add a function comment for the new label_run_boot() function.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Add a file-type parameter to this function and update all users. Add a
proper comment to the function which we are here.
This will allow tracking of the file types loaded by the extlinux
bootmeth.
Signed-off-by: Simon Glass <sjg@chromium.org>
This patch adds a new callback named need_reprint for menu.
The need_reprint will be called before printing the menu. If the
callback exists and returns FALSE, menu printing will be canceled.
This is very useful if the menu was not changed. It can save time
for serial-based menu to handle more input data.
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
The "fallback" extlinux config option allows us to set an alternative
default boot option for when it has been detected that the default is
failing. Implement the logic required to boot from this option when
desired.
Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
When configured correctly, we can detect when boot fails after the boot
process has been handed over to the kernel through the use of U-Boot's
bootcount support. In some instances, such as when we are performing
atomic updates via a system such as OSTree, it is desirable to provide a
fallback option so that we can return to a previous (hopefully working)
state.
Add a "fallback" option to the supported extlinux configuration options
that points to a label like "default" so that we can utilise this in
later commits.
Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tim Harvey <tharvey@gateworks.com> says:
This series will automatically add /chosen/kaslr-seed to the dt if
DM_RNG is enabled
during the boot process.
If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to
randomize the virtual address at which the kernel image is loaded, it
expects entropy to be provided by the bootloader by populating
/chosen/kaslr-seed with a 64-bit value from source of entropy at boot.
If we have DM_RNG enabled populate this value automatically when
fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT
is enabled as its implementation uses a different source of entropy
that is not yet implemented as DM_RNG. We also skip this if
MEASURED_BOOT is enabled as in that case any modifications to the
dt will cause measured boot to fail (although there are many other
places the dt is altered).
As this fdt node is added elsewhere create a library function and
use it to deduplicate code. We will provide a parameter to overwrite
the node if present.
For our automatic injection, we will use the first rng device and
not overwrite if already present with a non-zero value (which may
have been populated by an earlier boot stage). This way if a board
specific ft_board_setup() function wants to customize this behavior
it can call fdt_kaslrseed with a rng device index of its choosing and
set overwrite true.
Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now
but left in place in case boot scripts exist that rely on this command
existing and returning success. An informational message is printed to
alert users of this command that it is likely no longer needed.
Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
randomization and completely ignores the kaslr-seed for its own
randomness needs (i.e the randomization of the physical placement of
the kernel). It gets weeded out from the DTB that gets handed over via
efi_install_fdt() as it would also mess up the measured boot DTB TPM
measurements as well.