Pull request for efi-2020-07-rc5-2

Documentation:
 
 * man-pages for booti and printenv
 
 UEFI
 
 * correct return value for printenv -e command
 * initialize console size late
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmKvNNwACgkQxIHbvCwF
 GsS0jhAAiuEf5ZOok2o3arhinrXtQ5QY7t+w8smTYnN8onnYMJoVw4yOxwoLwhlo
 9EL/332CxwqxbnmnjRKC6Hj1y6+p85XZnV50QvXuUySNC49RdjAdqpZZWW5SWjnp
 RO/c4RbUcpvZOnsK097TMt85RrgYFZL+IH8So+IGkywChD8lKGtf9eNl4v6XO1jB
 73D05DMYaC4Y0AyhiphXQx7yLeNJpNrnK7wff4InMbbTbMiz/eebwCDrgJCXPFjL
 VfHnSi1uTcMCtLk0s1T3B+yro12mchiyZhvHBPjBTpxGdjEvtny//fSNXrdRA9qt
 NSh5rbjR0ZRXa0e26oXjRUunkqhxSxxnR9lzKJ5cn4rV1rAKhljHGxwZEUOOcUtQ
 Q7ct43PW/jxpouaIhYTrgnPV+N6t2Tgo+GQxAKmj2b5FbPjHRMv96QfHKFf5oeMo
 52NSIxqOZ3WJGbOdnZHlV/xgxPuxtO6qUSEDf+QE4d0/Wx8NO4C69QROQacc+MVY
 ztSKvdgIgmzGPzcwNsMgWDyZtFVRMPVZAL5xTVEVLCOVBn/LAbcCr1Z64U12tvj0
 QqeWtRJw/7IGe+qoSd4I29vyVmXJub4YWYpb0K4s0iuwBvCRzf3fXY/SYcyOokV7
 JZEysnYdq4viBlDvQQWnrcCFkRllsE9xwJH+CcEgco890MCoDTo=
 =bGAo
 -----END PGP SIGNATURE-----

Merge tag 'efi-2022-07-rc5-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2020-07-rc5-2

Documentation:

* man-pages for booti and printenv

UEFI

* correct return value for printenv -e command
* initialize console size late
This commit is contained in:
Tom Rini 2022-06-19 11:30:29 -04:00
commit 700cff2328
9 changed files with 183 additions and 8 deletions

View file

@ -182,8 +182,10 @@ static int efi_dump_var_all(int argc, char *const argv[],
}
free(var_name16);
if (!match && argc == 1)
if (!match && argc == 1) {
printf("Error: \"%s\" not defined\n", argv[0]);
return CMD_RET_FAILURE;
}
return CMD_RET_SUCCESS;
}

66
doc/usage/cmd/bootz.rst Normal file
View file

@ -0,0 +1,66 @@
.. SPDX-License-Identifier: GPL-2.0+:
bootz command
=============
Synopsis
--------
::
bootz [<addr> [<initrd>[:<size>]] [<fdt>]]
Description
-----------
The bootz command is used to boot a Linux kernel in 'zImage' format.
addr
address of kernel image, defaults to the value of the environment
variable $loadaddr.
initrd
address of the initial RAM disk. Use '-' to boot a kernel with a device
tree but without an initial RAM disk.
size
size of the initial RAM disk. This parameter must be specified for raw
initial RAM disks.
fdt
address of the device tree.
Example
-------
This is the boot log of an OrangePi PC board:
::
=> load mmc 0:2 $fdt_addr_r dtb
23093 bytes read in 7 ms (3.1 MiB/s)
=> load mmc 0:2 $kernel_addr_r vmlinuz
5079552 bytes read in 215 ms (22.5 MiB/s)
=> load mmc 0:2 $ramdisk_addr_r initrd.img
23854965 bytes read in 995 ms (22.9 MiB/s)
=> bootz $kernel_addr_r $ramdisk_addr_r:$filesize $fdt_addr_r
Kernel image @ 0x42000000 [ 0x000000 - 0x4d8200 ]
## Flattened Device Tree blob at 43000000
Booting using the fdt blob at 0x43000000
EHCI failed to shut down host controller.
Loading Ramdisk to 48940000, end 49ffff75 ... OK
Loading Device Tree to 48937000, end 4893fa34 ... OK
Starting kernel ...
Configuration
-------------
The bootz command is only available if CONFIG_CMD_BOOTZ=y.
Return value
------------
Normally this command does not return. If an error occurs, the return value $?
is set to 1 (false). If the operating system returns to U-Boot, the system is
reset.

View file

@ -0,0 +1,90 @@
.. SPDX-License-Identifier: GPL-2.0+:
printenv command
================
Synopsis
--------
::
printenv [-a] [name ...]
printenv -e [-guid guid][-n] [name]
Description
-----------
The printenv command is used to print environment or UEFI variables.
\-a
Print environment variables starting with a period ('.').
\-e
Print UEFI variables. Without -e environment variables are printed.
\-guid *guid*
Specify vendor GUID *guid*. If none is specified, all UEFI variables with
the specified name are printed irrespective of their vendor GUID.
\-n
don't show hexadecimal dump of value
name
Variable name. If no name is provided, all variables are printed.
Multiple environment variable names may be specified.
Examples
--------
The following examples demonstrates the effect of the *-a* flag when displaying
environment variables:
::
=> setenv .foo bar
=> printenv
arch=sandbox
baudrate=115200
board=sandbox
...
stdout=serial,vidconsole
Environment size: 644/8188 bytes
=> printenv -a
.foo=bar
arch=sandbox
baudrate=115200
board=sandbox
...
stdout=serial,vidconsole
Environment size: 653/8188 bytes
=>
The next example shows the effect of the *-n* flag when displaying an UEFI
variable and how to specify a vendor GUID:
::
=> printenv -e -guid 8be4df61-93ca-11d2-aa0d-00e098032b8c PlatformLangCodes
PlatformLangCodes:
8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
BS|RT|RO, DataSize = 0x6
00000000: 65 6e 2d 55 53 00 en-US.
=> printenv -e -n PlatformLangCodes
PlatformLangCodes:
8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
BS|RT|RO, DataSize = 0x6
=>
Configuration
=============
UEFI variables are only supported if CONFIG_CMD_NVEDIT_EFI=y. The value of UEFI
variables can only be displayed if CONFIG_HEXDUMP=y.
Return value
------------
The return value $? is 1 (false) if a specified variable is not found.
Otherwise $? is set to 0 (true).

View file

@ -30,6 +30,7 @@ Shell commands
cmd/bootmenu
cmd/bootmeth
cmd/button
cmd/bootz
cmd/cbsysinfo
cmd/conitrace
cmd/echo
@ -48,6 +49,7 @@ Shell commands
cmd/md
cmd/mmc
cmd/pinmux
cmd/printenv
cmd/pstore
cmd/qfw
cmd/reset

View file

@ -499,6 +499,8 @@ extern struct list_head efi_register_notify_events;
int efi_init_early(void);
/* Initialize efi execution environment */
efi_status_t efi_init_obj_list(void);
/* Set up console modes */
void efi_setup_console_size(void);
/* Install device tree */
efi_status_t efi_install_fdt(void *fdt);
/* Run loaded UEFI image */

View file

@ -5,6 +5,8 @@
* Copyright (c) 2016 Alexander Graf
*/
#define LOG_CATEGORY LOGC_EFI
#include <common.h>
#include <charset.h>
#include <malloc.h>
@ -12,6 +14,7 @@
#include <dm/device.h>
#include <efi_loader.h>
#include <env.h>
#include <log.h>
#include <stdio_dev.h>
#include <video_console.h>
#include <linux/delay.h>
@ -58,7 +61,12 @@ const efi_guid_t efi_guid_text_output_protocol =
#define cESC '\x1b'
#define ESC "\x1b"
/* Default to mode 0 */
/*
* efi_con_mode - mode information of the Simple Text Output Protocol
*
* Use safe settings before efi_setup_console_size() is called.
* By default enable only the 80x25 mode which must always exist.
*/
static struct simple_text_output_mode efi_con_mode = {
.max_mode = 1,
.mode = 0,
@ -333,13 +341,13 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)
}
/**
* query_console_size() - update the mode table.
* efi_setup_console_size() - update the mode table.
*
* By default the only mode available is 80x25. If the console has at least 50
* lines, enable mode 80x50. If we can query the console size and it is neither
* 80x25 nor 80x50, set it as an additional mode.
*/
static void query_console_size(void)
void efi_setup_console_size(void)
{
int rows = 25, cols = 80;
int ret = -ENODEV;
@ -351,6 +359,8 @@ static void query_console_size(void)
if (ret)
return;
log_debug("Console size %dx%d\n", rows, cols);
/* Test if we can have Mode 1 */
if (cols >= 80 && rows >= 50) {
efi_cout_modes[1].present = 1;
@ -371,7 +381,6 @@ static void query_console_size(void)
}
}
/**
* efi_cout_query_mode() - get terminal size for a text mode
*
@ -1262,9 +1271,6 @@ efi_status_t efi_console_register(void)
efi_status_t r;
struct efi_device_path *dp;
/* Set up mode information */
query_console_size();
/* Install protocols on root node */
r = EFI_CALL(efi_install_multiple_protocol_interfaces
(&efi_root,

View file

@ -243,6 +243,10 @@ efi_status_t efi_init_obj_list(void)
goto out;
}
/* Set up console modes */
efi_setup_console_size();
/* Install EFI_RNG_PROTOCOL */
if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) {
ret = efi_rng_register();
if (ret != EFI_SUCCESS)

View file

@ -117,6 +117,7 @@ class TestEfiCapsuleFirmwareFit(object):
with u_boot_console.log.section('Test Case 2-a, before reboot'):
output = u_boot_console.run_command_list([
'host bind 0 %s' % disk_img,
'printenv -e PlatformLangCodes', # workaround for terminal size determination
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""',
'efidebug boot order 1',
'env set -e -nv -bs -rt OsIndications =0x0000000000000004',

View file

@ -115,6 +115,7 @@ class TestEfiCapsuleFirmwareRaw:
with u_boot_console.log.section('Test Case 2-a, before reboot'):
output = u_boot_console.run_command_list([
'host bind 0 %s' % disk_img,
'printenv -e PlatformLangCodes', # workaround for terminal size determination
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""',
'efidebug boot order 1',
'env set -e OsIndications',
@ -197,6 +198,7 @@ class TestEfiCapsuleFirmwareRaw:
with u_boot_console.log.section('Test Case 3-a, before reboot'):
output = u_boot_console.run_command_list([
'host bind 0 %s' % disk_img,
'printenv -e PlatformLangCodes', # workaround for terminal size determination
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""',
'efidebug boot order 1',
'env set -e -nv -bs -rt OsIndications =0x0000000000000004',