Commit graph

289 commits

Author SHA1 Message Date
Simon Glass
d42243fe21 bootstd: Use the bootargs env var for changing the cmdline
The "bootargs" environment variable is used to set the command-line
arguments to pass to the OS. Use this same mechanism with bootstd as well.
When the variable is updated, it is written to the current bootflow. When
the current bootflow is updated, the environment variable is updated too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-16 23:13:17 +08:00
Simon Glass
2270c3639a bootstd: Correct baudrate typo
This is a copy error. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-16 23:13:17 +08:00
Simon Glass
4de979f664 bootstd: Use bootdev instead of bootdevice
It seems better to call this a 'bootdev' since this is name used in the
documentation. The older 'Bootdevice' name is no-longer used and may cause
confusion with the 'bootdevice' environment variable.

Update throughout to use bootdev.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-16 23:13:17 +08:00
Simon Glass
3c2e531cb8 bootstd: Correct the name of the QEMU bootmeth
This does not relate to sandbox. Correct the name.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-16 23:13:17 +08:00
Simon Glass
a0874dc4ac expo: Add a configuration editor
Add a new 'cedit' command which allows editing configuration using an
expo. The configuration items appear as menus on the display.

This is extremely basic, only supporting menus and not providing any way
to load or save the configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
82cafee133 expo: Support building an expo from a description file
The only way to create an expo at present is by calling the functions to
create each object. It is useful to have more data-driven approach, where
the objects can be specified in a suitable file format and created from
that. This makes testing easier as well.

Add support for describing an expo in a devicetree node. This allows more
complex tests to be set up, as well as providing an easier format for
users. It also provides a better basis for the upcoming configuration
editor.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
7230fdb383 expo: Add spacing around menus and items
It looks better if menus have a bit of an inset, rather than be drawn hard
up against the background. Also, menu items look better if they have a bit
of spacing between them.

Add theme options for these and implement the required changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
4e64beeba7 expo: Implement the keypress logic for popup menus
In 'popup' mode, the expo allows moving around the objects in a scene.
When 'enter' is pressed on a menu, it opens and the user can move around
the items in the menu.

Implement this using keypress handles and actions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
4c87e073a4 expo: Draw the current opened menu on top
When a menu is opened, it must be displayed over all other objects in
the scene, so that all its items are visible.

Handle this by drawing the menu object a second time, after all other
objects have been drawn. Draw all of the objects which are dependent
on the menu object.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
756c9559e6 expo: Draw popup menus in both opened and closed states
When a popup menu is closed it shows only the selected item. When it is
open it shows a background and all items, with a highlight that can be
moved between the items.

Add the drawing logic for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
3f33b9c722 expo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEM
At present we only support a single menu, so all that can be pointed to
is the current menu item. Rename this action so that we can also add
an action for pointing to an object. This will allow cycling through
the objects in a scene.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
d3db0216dc expo: Support drawing of popup menus
At present only a single menu is supported. All items are shown and a
pointer object points to the current item.

Add support for multiple menus, one of which is highlighted, indicated
by the highlight_id property in the scene.

The highlighted menu item has a SCENEOF_POINT flag, indicating that it
is currently pointed to.

The popup menu is normally closed, in which case it shows only the
current menu item. When it is opened, it shows all items, allowing the
user to select one.

Rather than requiring the menu item to have a description, require it to
have a label. Use the label (only) for the popup menu.

With this, most of the drawing and layout logic is complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
8872bc7f9d expo: Move menu-item selection into a function
The current implementation supports a 'pointer' object which points to
the currently highlighted menu item. We want to support highlighting the
label of the menu item instead, e.g. with inverse video. In this case we
will need to 'unhighlight' the old item and highlight the new one.

As a first step, move the pointer logic into a function. This fixes a
bug where the item is hidden when it should not be.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
2e59389704 expo: Support simple themes
It is a pain to manually set the fonts of all objects to be consistent.
Some spacing settings are also better set globally than by manually
positioning each object.

Add a 'theme' to the expo, to hold this information. For now it includes
only the font size.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
699b0acb52 expo: Set up the width and height of objects
Provide a way to set the full dimensions of objects, i.e. including the
width and height.

For menus, calculate the bounding box of all objects in the menu. Set all
labels to be the same size, so that highlighting works correct, once
implemented.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
50f0203759 expo: Calculate text bounding-box correctly
Rather than estimating, measure the text accurately, using the new
vidconsole feature. This allows accurate placement of objects.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
ce72c9ec26 expo: Use flags for objects
We currently have just a 'hide' property for each object. In preparation
for adding more properties, convert the struct to use a flags value,
instead of individual booleans. This is more extensible.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
ae45d6cf5a expo: Add width and height to objects
At present objects only have a position so it is not possible to determine
the amount of space they take up on the display.

Add width and height properties, using a struct to keep all the dimensions
together.

For now this is not used. Future work will set up these new properties.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
9af341502c expo: Allow setting the start of the dynamic-ID range
Provide a way to set this value so that it is easy to separate the
statically allocated IDs (generated by the caller) from those
generated dynamically by expo itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
c98cb51252 bootstd: Add a separate log category for expo
This feature is different enough from bootstd that it probably deserves
its own log category. It cannot use a uclass since it is not a device.

Add a new category.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
de7b5a8a1a fs: Create functions to load and allocate a file
This functionality current sits in bootstd, but it is more generally
useful. Add a function to load a file into memory, allocating it as
needed. Adjust bootstd to use this version.

Note: Tests are added in the subsequent patch which converts the 'cat'
command to use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
5904d953a1 expo: Rename exp_set_text_mode()
Rename this function to match its peers, using the full "expo' prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
14a86a5107 expo: Avoid automatically arranging the scene
This should ideally be done once after all scene changes have been made.
Require an explicit call when everything is ready.

Always arrange after a key it sent, just for convenience.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
42b18494bd expo: Store the console in the expo
Rather than finding this each time, keep a pointer to it. This simplifies
the code a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
def898c458 expo: Convert to using a string ID for the scene title
This is easier to deal with if it uses the existing string handling,
since we will be able to use translations, etc. in the future.

Update it to use an ID instead of a string.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:50 -04:00
Simon Glass
d2043b5682 expo: Correct some header-file comments
The use of Returns instead of @return still confuses me. Fix some problems
that have crept in.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:50 -04:00
Tom Rini
e80f4079b3 Prepare v2023.07-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmSjExsACgkQFHw5/5Y0
 tywJ3gwAsTbr9mCmCzaKs2F/Jh6H47WEUMEz96wE8eXwuS57pfNJhml4v2rEhYpQ
 MlBjz6vTOyHDrtinRlvempJWVZEuoflMb6M2OTqVFqZPuPT3cLLuSdM4pgb5SdKS
 jNDWcxr12LqiDS0Mz+QOHdps3H8mzsCnOXeOTT+VaSeYHPOLQ+M9OV2o/aY2BsNi
 JLAGX+8i7FuZnVYZzSv6PQYYGZZV+Kvl5oLlPPJttsA7bGu4m2k8zRQQdzd+PIbu
 owAh3CHSKCy1g+y7ASn1Nd2VE06huvqGG7Qo2sj+Ypf/wbNy16qbMc2C7HDwDcul
 nrnf6BZ+MTelwxyPHBOR52ERgY6H8rgpvsCNL0arxaCHJOVddXtrUY1591vE71aB
 nGxhnyLnHwOXXdDGsPsR7p4SF16e6RzaINKmDorQ37nidRnTFLlFCxidnR8ztscR
 aUpLraqYUquGJf7lejYX2OZg2f36lvpYKy1lwuJfd9fUSgK8iyUKrE9wOJhWnTK8
 cIOnS/A+
 =DNor
 -----END PGP SIGNATURE-----

Merge tag 'v2023.07-rc6' into next

Prepare v2023.07-rc6
2023-07-05 11:28:55 -04:00
Heinrich Schuchardt
4533b3d0a3 bootm: don't call booti_setup for EFI images
On the arm64 architecture booti_setup() is called for EFI FIT images.
This function call fails because EFI images typically do not have a
kernel signature.

Check that the operating system property "os" of the image is "linux"
before invoking booti_setup().

Fixes: 487b5fa6de ("bootm: Handle kernel_noload on arm64")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-16 06:45:20 +02:00
Jonas Karlman
a7e4dffcd8 bootstd: Fix relative path use in extlinux bootmeth
Using relative path in a /boot/extlinux/extlinux.conf file fails to load
linux kernel.

Using a /boot/extlinux/extlinux.conf file:

  LABEL test
    LINUX ../linux/Image

Result in following error:

  Retrieving file: ../linux/Image
  Skipping test for failure retrieving kernel
  Boot failed (err=-14)

However, using sysboot cmd successfully load kernel using same file:

  sysboot mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf

  Retrieving file: /boot/extlinux/../linux/Image

Fix relative path using bootmeth extlinux by supplying bootfile path
instead of subdir path in the call to pxe_setup_ctx, same as done in the
sysboot command.

Fixes: 31aefaf89a ("bootstd: Add an implementation of distro boot")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-14 12:56:10 -04:00
Simon Glass
bcb1d269a4 bootstd: Make BOOTSTD_FULL depend on BOOTSTD
Move BOOTSTD_FULL down in the file so that it can be enabled only when
BOOTSTD is enabled. This prevents a build error if BOOTSTD is disabled
but BOOTSTD_FULL is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-06-14 12:56:10 -04:00
Michal Simek
1be82afa80 global: Use proper project name U-Boot
Use proper project name in comments, Kconfig, readmes.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/0dbdf0432405c1c38ffca55703b6737a48219e79.1684307818.git.michal.simek@amd.com
2023-06-12 13:24:31 +02:00
Tom Rini
17f6e6cc49 Merge branch 'master_rzn1/rzn1' of https://source.denx.de/u-boot/custodians/u-boot-sh
- R-Car RZN1 support
2023-05-14 11:29:45 -04:00
Simon Glass
fba0e73802 bootstd: Create a new BOOTMETH_DISTRO
We cannot be sure what bootmeth a distro will need to use. Add a new
BOOTMETH_DISTRO option which collects these together. Select this from
BOOTSTD_DEFAULTS so that it is clear what is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Make BOOTMETH_EFILOADER depend on EFI_LOADER, select if EFI_LOADER]
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-05-13 12:50:58 -04:00
Simon Glass
79f663515a bootstd: Rename distro and syslinux to extlinux
We use the terms 'distro' to mean extlinux but they are not really the
same. 'Distro' could refer to any method of booting a distribution,
whereas extlinux is a particular method.

Also we sometimes use syslinux, but it is better to use the same term in
all cases.

Rename distro to syslinux and also update bootstd uses of syslinux to use
extlinux instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-13 09:52:32 -04:00
Simon Glass
c889434845 bootstd: Tidy up reporting of errors
In a few cases the error handling is not quite right. Make sure we
return the actual error in distro_efi_read_bootflow_file() rather than
-EINVAL. Return -IO when a file cannot be read. Also show the error name
if available.

This does not change operation, but does make it easier to diagnose
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-13 09:52:32 -04:00
Simon Glass
d8d40bc392 bootstd: Correct default boot command
The patch to relax flag requirements was not accepted[1], so we still have
to have separate bootcommands depending on CMD_BOOTFLOW_FULL.

The previous attempt at this did not work, since it used the wrong name
for the options.

Fix this and change the message to mention BOOTSTD_FULL since this affects
not just the flags, but all functionality, so is more likely what the user
wants.

Drop the useless condition on CMD_BOOTFLOW_FULL while we are here.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230329071655.1959513-2-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a91492b6e9 ("bootstd: Provide a default command")
2023-05-13 09:52:32 -04:00
Simon Glass
ab16a3d904 bootstd: Require HUSH_PARSER for script booting
Armbian uses a script which needs the HUSH parser. It is likely that
other distros will do the same. Enable it by default, just in case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Jonas Karlman <jonas@kwiboo.se>
2023-05-13 09:52:32 -04:00
Simon Glass
76afc8457e bootstd: Work around missing partition 1
If there is no partition numbered 1, we decide that there are no
partitions at all. That may not be correct, since at least one Debian
installed has just a single partition numbered 2.

Continue searching up to partition 3, just in case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-13 09:52:32 -04:00
Ralph Siemsen
afdfcb11f9 tools: spkgimage: add Renesas SPKG format
Renesas RZ/N1 devices contain BootROM code that loads a custom SPKG
image from QSPI, NAND or USB DFU. Support this format in mkimage tool.

SPKGs can optionally be signed, however creation of signed SPKG is not
currently supported.

Example of how to use it:

tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
	-T spkgimage -a 0x20040000 -e 0x20040000 \
	-d u-boot.bin u-boot.bin.spkg

The config file (spkgimage.cfg in this example) contains additional
parameters such as NAND ECC settings.

Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-05-13 04:01:30 +02:00
Sean Edmond
7d0188927b net: dhcp6: pxe: Add DHCP/PXE commands for IPv6
Adds commands to support DHCP and PXE with IPv6.

New configs added:
- CMD_DHCP6
- DHCP6_PXE_CLIENTARCH
- DHCP6_PXE_DHCP_OPTION
- DHCP6_ENTERPRISE_ID

New commands added (when IPv6 is enabled):
- dhcp6
- pxe get -ipv6
- pxe boot -ipv6

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-05 17:48:44 -04:00
Hugo Villeneuve
b42303723a boot/Kconfig: fix comments syntax error
Fix comments syntax error in SPL_LOAD_FIT_APPLY_OVERLAY description.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-03 18:30:46 -04:00
Bin Meng
327883c3c9 boot: vbe_simple: Fix vbe_simple_read_bootflow() dependency
vbe_simple_read_bootflow() calls vbe_simple_read_bootflow_fw()
which is only available when BOOTMETH_VBE_SIMPLE_FW is on.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28 11:30:17 -06:00
Mathew McBride
484e701d74 bootstd: Use blk uclass device numbers to set efi bootdev
When loading a file from a block device, efiload_read_file
was using the seq_num of the device (e.g "35" of virtio_blk#35)
instead of the block device id (e.g what you get from running
the corresponding device scan command, like "virtio 0")

This cause EFI booting from these devices to fail as an
invalid device number is passed to blk_get_device_part_str:

  Scanning bootdev 'virtio-blk#35.bootdev':
  distro_efi_read_bootflow_file start (efi,fname=<NULL>)
  distro_efi_read_bootflow_file start (efi,fname=<NULL>)
  setting bootdev virtio, 35, efi/boot/bootaa64.efi, 00000000beef9a40, 170800
  efi_dp_from_name calling blk_get_device_part_str
  dev=virtio devnr=35 path=efi/boot/bootaa64.efi
  blk_get_device_part_str (virtio,35)
  blk_get_device_by_str (virtio, 35)
  ** Bad device specification virtio 35 **
  Using default device tree: dtb/qemu-arm.dtb
  No device tree available
  0  efi          ready   virtio       1  virtio-blk#35.bootdev.par efi/boot/bootaa64.efi
  ** Booting bootflow 'virtio-blk#35.bootdev.part_1' with efi
  blk_get_device_part_str (virtio,0:1)
  blk_get_device_by_str (virtio, 0)
  No UEFI binary known at beef9a40 (image buf=00000000beef9a40,addr=0000000000000000)
  Boot failed (err=-22)

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-26 08:43:05 -04:00
Simon Glass
1aabe4ef2b bootstd: Adjust code ordering to work around compiler quirk
At present when debugging is off, bootdev_find_in_blk() sometimes fails
to find a valid bootflow, e.g. with virtio. Accessing the 'blk' variable
later in the function seems to correct it.

Move the 'ret' check before the debug statement and set the block device
again aftewards, to work around this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-26 08:43:05 -04:00
Simon Glass
1736b4af0e bootstd: Report missing labels only when asked
Use the -l flag to indicate whether to report missing uclasses.

Also try to be more helpful when no devices are found. For example, when
we see something 'scsi0' requested and nothing was found, this indicates
that there are no SCSI devices, so show a suitable message.

Move messages out of the low-level functions so that silent operation
is possible.

This means they are never reported unless BOOTSTD_FULL is enabled, since
the -l flag cannot otherwise be set.

Suggested-by: Tom Rini <trini@konsulko.com>

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-26 08:43:04 -04:00
Simon Glass
d80bb4f958 bootstd: Support booting EFI where multiple options exist
The current EFI implementation has a strange quirk where it watches
loaded files and uses the last-loaded file to determine the device that
is being booted from.

This is confusing with bootstd, where multiple options may exist. Even
loading a device tree will cause it to go wrong. There is no API for
passing this information, since the only entry into booting an EFI image
is the 'bootefi' command.

To work around this, call efi_set_bootdev() for EFI images, if possible,
just before booting.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-26 08:43:04 -04:00
Simon Glass
9f8351659a bootstd: Tweak bootflow logic for device tree
We should only store the FDT filename if we were able to determine one.
Adjust the logic for this.

This corrects the case where no FDT is needed to boot, such as with EFI
using ACPI.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-26 08:43:04 -04:00
Tom Rini
51a765b376 boot/image-board.c: Silence warning in select_ramdisk
When building with clang we get a warning that rdaddr could be
uninitialized in one case. While this cannot functionally happen, we can
easily silence the warning.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-25 15:31:27 -04:00
Tobias Waldekranz
e45bba562f image: Fix script execution from FIT images with external data
Update the script loading code to recognize when script data is stored
externally from the FIT metadata (i.e., built with `mkimage -E`).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-05 10:54:47 -04:00
Safae Ouajih
57e405e1f4 android: boot: support bootconfig
Support Bootconfig feature.
- The bootconfig feature replaces the androidboot.*
  kernel cmdline options.

This was adapted from downstream [1] commit : 7af0a0506d4d ("cuttlefish:
support bootconfig parameters").

Link:[1] https://android.googlesource.com/platform/external/u-boot/

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04 14:50:47 -04:00