diff options
author | Tom Rini <trini@konsulko.com> | 2023-06-02 12:13:01 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-06-02 12:13:01 -0400 |
commit | 26659d426548d1c395ef878c3b820e53a6e3b346 (patch) | |
tree | a048fa8cae729388804f9076d57a99bff17a643d | |
parent | cb4437e530ec1ff3deae85754010344afab8bcc5 (diff) | |
parent | 75ebeb4d94bd911ee7884b7beae06f3dec2838a8 (diff) | |
download | u-boot-WIP/02Jun2023.zip u-boot-WIP/02Jun2023.tar.gz u-boot-WIP/02Jun2023.tar.bz2 |
Merge tag 'efi-2023-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efiWIP/02Jun2023
Pull request efi-2023-07-rc4
Documentation:
* man pages for loadb, loadx
UEFI:
* check return value of part_get_info()
* improve unit test for RegisterProtocolNotify()
-rw-r--r-- | doc/android/boot-image.rst | 2 | ||||
-rw-r--r-- | doc/usage/cmd/loadb.rst | 70 | ||||
-rw-r--r-- | doc/usage/cmd/loadx.rst | 77 | ||||
-rw-r--r-- | doc/usage/cmd/loady.rst | 8 | ||||
-rw-r--r-- | doc/usage/index.rst | 2 | ||||
-rw-r--r-- | lib/efi_loader/efi_device_path.c | 7 | ||||
-rw-r--r-- | lib/efi_selftest/efi_selftest_register_notify.c | 16 |
7 files changed, 171 insertions, 11 deletions
diff --git a/doc/android/boot-image.rst b/doc/android/boot-image.rst index c719b4d..8f247c7 100644 --- a/doc/android/boot-image.rst +++ b/doc/android/boot-image.rst @@ -11,7 +11,7 @@ Android Boot Image is used to boot Android OS. It usually contains kernel image (like ``zImage`` file) and ramdisk. Sometimes it can contain additional binaries. This image is built as a part of AOSP (called ``boot.img``), and being flashed into ``boot`` partition on eMMC. Bootloader then reads that image from -``boot`` partition to RAM and boots the kernel from it. Kernel than starts +``boot`` partition to RAM and boots the kernel from it. Kernel then starts ``init`` process from the ramdisk. It should be mentioned that recovery image (``recovery.img``) also has Android Boot Image format. diff --git a/doc/usage/cmd/loadb.rst b/doc/usage/cmd/loadb.rst new file mode 100644 index 0000000..b37d1d7 --- /dev/null +++ b/doc/usage/cmd/loadb.rst @@ -0,0 +1,70 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +loadb command +============= + +Synopsis +-------- + +:: + + loadb [addr [baud]] + +Description +----------- + +The loady command is used to transfer a file to the device via the serial line +using the Kermit protocol. + +The number of transferred bytes is saved in environment variable filesize. + +addr + load address, defaults to environment variable loadaddr or if loadaddr is + not set to configuration variable CONFIG_SYS_LOAD_ADDR + +baud + baud rate for the Kermit transmission. After the transmission the baud + rate is reset to the original value. + +Example +------- + +In the example below the terminal emulation program picocom and G-Kermit +serve to transfer a file to a device. + +.. code-block:: bash + + picocom --baud 115200 --send-cmd "gkermit -iXvs" /dev/ttyUSB0 + +After entering the loadb command the key sequence <CTRL-A><CTRL-S> is used to +let picocom prompt for the file name. Picocom invokes G-Kermit for the file +transfer. + +:: + + => loadb 60800000 115200 + ## Ready for binary (kermit) download to 0x60800000 at 115200 bps... + + *** file: helloworld.efi + $ gkermit -iXvs helloworld.efi + G-Kermit 2.01, The Kermit Project, 2021-11-15 + Escape back to your local Kermit and give a RECEIVE command. + + KERMIT READY TO SEND... + | + *** exit status: 0 *** + ## Total Size = 0x00000c00 = 3072 Bytes + ## Start Addr = 0x60800000 + => + +The transfer can be cancelled by pressing <CTRL+C>. + +Configuration +------------- + +The command is only available if CONFIG_CMD_LOADB=y. + +Return value +------------ + +The return value $? is 0 (true) on success, 1 (false) on error. diff --git a/doc/usage/cmd/loadx.rst b/doc/usage/cmd/loadx.rst new file mode 100644 index 0000000..facca9b --- /dev/null +++ b/doc/usage/cmd/loadx.rst @@ -0,0 +1,77 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +loadx command +============= + +Synopsis +-------- + +:: + + loadx [addr [baud]] + +Description +----------- + +The loadx command is used to transfer a file to the device via the serial line +using the XMODEM protocol. + +The number of transferred bytes is saved in environment variable filesize. + +addr + load address, defaults to environment variable loadaddr or if loadaddr is + not set to configuration variable CONFIG_SYS_LOAD_ADDR + +baud + baud rate for the ymodem transmission. After the transmission the baud + rate is reset to the original value. + +Example +------- + +In the example below the terminal emulation program picocom was used to +transfer a file to the device. + +.. code-block:: + + picocom --send-cmd 'sx -b vv' --baud 115200 /dev/ttyUSB0 + +After entering the loadx command the key sequence <CTRL-A><CTRL-S> is used to +let picocom prompt for the file name. Picocom invokes the program sx for the +file transfer. + +:: + + => loadx 60800000 115200 + ## Ready for binary (xmodem) download to 0x60800000 at 115200 bps... + C + *** file: helloworld.efi + $ sx -b vv helloworld.efi + sx: cannot open vv: No such file or directory + Sending helloworld.efi, 24 blocks: Give your local XMODEM receive command now. + Xmodem sectors/kbytes sent: 0/ 0kRetry 0: NAK on sector + Bytes Sent: 3072 BPS:1147 + + Transfer incomplete + + *** exit status: 1 *** + ## Total Size = 0x00000c00 = 3072 Bytes + ## Start Addr = 0x60800000 + => + +The transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds +of inactivity on terminal. + +Configuration +------------- + +The command is only available if CONFIG_CMD_LOADB=y. + +Initial timeout in seconds while waiting for transfer is configured by +config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout. +Setting it to 0 means infinite timeout. + +Return value +------------ + +The return value $? is 0 (true) on success, 1 (false) otherwise. diff --git a/doc/usage/cmd/loady.rst b/doc/usage/cmd/loady.rst index 718af6e..3f8227e 100644 --- a/doc/usage/cmd/loady.rst +++ b/doc/usage/cmd/loady.rst @@ -56,6 +56,9 @@ file transfer. 6165f => +Transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds +of inactivity on terminal. + Configuration ------------- @@ -65,10 +68,7 @@ Initial timeout in seconds while waiting for transfer is configured by config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout. Setting it to 0 means infinite timeout. -Transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds -of inactivity on terminal. - Return value ------------ -The return value $? is always 0 (true). +The return value $? is 0 (true) on success, 1 (false) otherwise. diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 0fde130..84ef8a9 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -63,7 +63,9 @@ Shell commands cmd/gpio cmd/host cmd/load + cmd/loadb cmd/loadm + cmd/loadx cmd/loady cmd/mbr cmd/md diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 71923b1..04ebb44 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -843,12 +843,17 @@ static unsigned dp_part_size(struct blk_desc *desc, int part) * @buf buffer to which the device path is written * @desc block device descriptor * @part partition number, 0 identifies a block device + * + * Return: pointer to position after the node */ static void *dp_part_node(void *buf, struct blk_desc *desc, int part) { struct disk_partition info; + int ret; - part_get_info(desc, part, &info); + ret = part_get_info(desc, part, &info); + if (ret < 0) + return buf; if (desc->part_type == PART_TYPE_ISO) { struct efi_device_path_cdrom_path *cddp = buf; diff --git a/lib/efi_selftest/efi_selftest_register_notify.c b/lib/efi_selftest/efi_selftest_register_notify.c index ad763dd..ad4bcce 100644 --- a/lib/efi_selftest/efi_selftest_register_notify.c +++ b/lib/efi_selftest/efi_selftest_register_notify.c @@ -24,6 +24,7 @@ struct context { efi_uintn_t notify_count; efi_uintn_t handle_count; efi_handle_t *handles; + efi_status_t ret; }; static struct efi_boot_services *boottime; @@ -46,17 +47,18 @@ static struct efi_event *event; static void EFIAPI notify(struct efi_event *event, void *context) { struct context *cp = context; - efi_status_t ret; efi_uintn_t handle_count; efi_handle_t *handles; cp->notify_count++; for (;;) { - ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY, NULL, - cp->registration_key, - &handle_count, &handles); - if (ret != EFI_SUCCESS) + cp->ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY, + NULL, + cp->registration_key, + &handle_count, + &handles); + if (cp->ret != EFI_SUCCESS) break; cp->handle_count += handle_count; cp->handles = handles; @@ -204,6 +206,10 @@ static int execute(void) efi_st_error("LocateHandle failed\n"); return EFI_ST_FAILURE; } + if (context.ret != EFI_NOT_FOUND) { + efi_st_error("LocateHandle did not return EFI_NOT_FOUND\n"); + return EFI_ST_FAILURE; + } ret = boottime->free_pool(context.handles); if (ret != EFI_SUCCESS) { efi_st_error("FreePool failed\n"); |