This function is used by the EFI loader but we want to avoid it for the
app, since it records global state.
We don't intend to support running arbitrary EFI apps outside of a
bootstd context, so drop this call for the EFI app.
Signed-off-by: Simon Glass <sjg@chromium.org>
The EFI loader uses a rather unpleasant global for starting images. For
now the only way we intended to support booting EFI apps from the U-Boot
EFI app is via a bootmeth.
Update the condition so that the 'bootefi' command only works from the
EFI loader.
Future work may enable the 'bootefi' command for the app.
Signed-off-by: Simon Glass <sjg@chromium.org>
The EFI app will eventually execute binaries, but it does not enable
the CONFIG_EFI_LOADER option. So move the option to a common directory.
Signed-off-by: Simon Glass <sjg@chromium.org>
Once the EFI app supports booting an OS, this bootmeth will work without
CONFIG_EFI_LOADER being enabled. Rename it so this is clear.
Signed-off-by: Simon Glass <sjg@chromium.org>
efi_binary_run_dp() calls efi_init_obj_list() which is specific to the
EFI loader. Move this into a new file within lib/efi_loader
Similarly, move efi_run_image() since the app will need a different
implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Move this function and some dependencies into the lib/efi directory so
that it can be used by the app, which does not enable CONFIG_EFI_LOADER
Since the networking has an #ifdef add CONFIG_EFI_LOADER to it, since
the definitions are in efi_loader.h for now.
Signed-off-by: Simon Glass <sjg@chromium.org>
Most of these utility functions are useful for the app, so move them
into the common directory.
Move the GUIDs used by this file from their various other location, so
they are available to the app, even if it doesn't enabled EFI_LOADER
Fix the rather large number of checkpath warnings in this file, except
for the lwip one, best left to the maintainer to sort out.
One noteable change is adding a return value to dp_fill() for the case
where an option is not enabled but its uclass is referenced. This
presuambly never happens during execution, since if the uclass is not
supported there can be no device in that uclass and therefore nothing
will ever request its path. So just handle this like an invalid device.
Signed-off-by: Simon Glass <sjg@chromium.org>
This function calculates the parent size in many places and does the
same addition in most cases. Create a variable for the parent_size and
another for the size, so we can do the addition once at the end.
The uclass array is too sparse to consider an array.
Signed-off-by: Simon Glass <sjg@chromium.org>
This option is used on most other boards. Leaving it disabled creates
situations where the linker fails to build, due to symbols which are
referenced only it code that would have been garbage-collected.
To keep this disabled we would need to introduce #ifdefs not needed by
other platforms, which would be annoying.
The only current reason why this cannot be enabled is that the
linker lists are lost. Add a KEEP() around these, and enable the option.
Signed-off-by: Simon Glass <sjg@chromium.org>
The device-path code requires memory allocation. Provide an
implementation of these for use by the client.
Note that this will not work for the stub, since in that case it needs
to use U-Boot's memory allocation. This was a subject of a long argument
on the mailing list about U-Boot using its own malloc() where possible,
so it seems best to just leave this broken.
Signed-off-by: Simon Glass <sjg@chromium.org>
Using this macro, even bracketed with 'if (IS_ENABLED(CONFIG_IDE))'
causes a compile error if CONFIG_IDE is not enabled. Update the macros
to resolve this, so we can avoid #ifdefs in the C code.
Signed-off-by: Simon Glass <sjg@chromium.org>
The helper deals with whether we are actually running or not. We want it
to show the arguments even if not. So always call it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Put this in the helper so that we can (later) have it show the correct
error when the virtiofs daemon fails.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present the OS disk conflicts with the boot disk used to hold the
app (or payload). Number the OS disk after that.
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>
This method is useful for locating an OS using the VBE approach. Enable
it for the app and payload, for both x86 and ARM.
Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: Support video output on ARM
So far the EFI app supports video on x86 but not ARM. This series adds
this feature, using EFI GOP's 'blt' feature.
Support for bootstd is enabled at the same time, so that the app can
boot an OS automatically.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
This function is only defined if CONFIG_OF_LIVE is enabled. Provide a
static inline to handle it being disabled.
Signed-off-by: Simon Glass <sjg@chromium.org>
We need CONFIG_BOARD_EARLY_INIT_R to enable block devices. Enable
bootstd as well, so that booting is supported. Provide the 'lsblk'
command to allow listing block devices.
Use white-on-black as this is a little easier on the eyes.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present the root disk conflicts with the boot disk used to hold the
app (or payload). Use virtio for this disk and number the others after
that.
Signed-off-by: Simon Glass <sjg@chromium.org>
With arm64 we generally use the virtio-gpu driver, which does not
support direct access to a framebuffer. Add support for this, so that
the display works as expected.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present the EFI GOP is read in the probe() method but is not stored,
so it is not possible to use it later.
With the EFI app we need to be able to access it after probing, when
blitting is used. Create a struct to hold it. Store the framebuffer
pointer in there as well, to simplify the code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add some information about this new bootmeth, including how to enable it
and how it works.
Series-to: concept
Cover-letter:
boot: Enhance VBE to support a separate devicetree FIT
It is sometimes desirable to have the devicetrees packaged with firware,
or in a different FIT from the OS. This series adds support for this,
including a test.
The new bootmeth can automatically locate a state file and use that to
decide what images to use when booting. The OS must update the file
before rebooting, if a different selection is required.
For now there is no logic to deal with boot failures.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.
Most of the test is in C, with just the image-setup done in Python.
Enable the test for non-SPL sandbox builds.
Signed-off-by: Simon Glass <sjg@chromium.org>
When booting an OS it is useful to be able to read devicetrees provided
by the OEM, from a separate FIT to the OS.
Add a new method which supports this, along with the usual A/B/recovery
flows, using a state file on the boot device.
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>
Rather than using bflow->fname, which assumes that it is the same as the
passed-in filename, use the passed in filename. This can be different in
some cases.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is not obvious that PXE supports FIT, but it does, by detecting
whether an image is a FIT or not.
In many cases a FIT is more convenient than using separate files for
the kernel, initrd and devicetree.
Really we should promote FIT as an important format, rather than
silentily dealing with it if detected.
Add a new 'fit' token which indicates that a FIT is being used.
When the 'fit' token is used, the expectation is that the devicetree
is within the FIT, but this is not required, for now.
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>
We already have a cleanup function which removes the filesystem, so drop
the unnecessary try...except for this. It results in an error on the
error path, as we try to remove the filesystem twice.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present a temporary directory is used to hold the files before
placing them in the filesystem. Use a suitably named directory inside
the persistent-data directory, so that it is easy to take a look at what
was produced.
Signed-off-by: Simon Glass <sjg@chromium.org>
Support creation of a load-only FIT (where there is no OS), with a new
--load-only option. Allow FITs to be created without an OS image.
Update the auto-generated FIT description to make this clear.
Signed-off-by: Simon Glass <sjg@chromium.org>
When using '-f auto', mkimage automatically creates a FIT given the
images. For devicetree files, FIT expects that the compatible string
from each is copied to its corresponding configuration node.
Implement this in mkimage, so far only for uncompressed devicetrees.
This requires a few more fields in struct content_info, so take this
opportunity to comment it properly.
Signed-off-by: Simon Glass <sjg@chromium.org>