Pull request for efi-2021-07-rc1-3

Documentation fixes
 
 UEFI bug fixes:
 
 * error handling for capsule updates
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmCD7v0ACgkQxIHbvCwF
 GsQ9Iw/+Lx9SQvQ8i5uyHvHs5Iq2ZuMIkdsDFgljyVD/FvIYQg2+uTTN2HWKL8K7
 yvCcW1MH5sKEIcHfFHDfiEmgaO0fQyC8IcUysRhyvK+waf3k4XRLOCNq9M9DCrQq
 LcXhOc0B31Fvm/RmBtaup3B3K9sr5sbFSdF7NybKIO0c3Ksr80saWhYHvw0JhnHb
 cQX4EDFj+SiWlkF/apvOpgh2BwEmL1Bqc6E2+RLQLj0axoVB74xKQTA/8B5WtlzP
 ieUTEs+tG9EZdT2YRQtVu1F1RXjpXaDm/Kby1VyTY6di6L52HmOqCzt1ZVLhQRdJ
 /BIf9pFH1tWQVwlYy5iG6eTioZ4vhkVNKXD9dJgy8/YQQMXPaGpHsJOIURIfuf1b
 gOY9PaXWVT/yWNNbNk8EZwehA2UPp5kRHBTCz+/TwEvIACmbNZCLcLbpVLgCLD4q
 JXuzQi0Hq0HtjJQ+dT+cEfjWyl11xwFKUCifRGg6KvyLE1YjWm2NbtTRu6PqZYiv
 vLhS0y02lQUeSmys1hrFKK/UWJwM7W/J3iEq/4nbO0biNUD23uV2Q7G7hkwh2c7o
 XBAoSgculmnF92bSNJdZWJqy0/Pa5jNJIj8DlJgcYmXNBshIn8R6Q/+EeD1ifT3B
 c6bgdtqPl5oZzxfGbMTKxeeYiOoQ2GlRSK+PeWLwNUIEBTJQLjs=
 =4zWJ
 -----END PGP SIGNATURE-----

Merge tag 'efi-2021-07-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-07-rc1-3

Documentation fixes

UEFI bug fixes:

* error handling for capsule updates
This commit is contained in:
Tom Rini 2021-04-24 09:27:49 -04:00
commit c93ac8ff0b
9 changed files with 75 additions and 26 deletions

View File

@ -150,7 +150,7 @@ Examples of writing SIT and two copies of bootloader to SD or eMMC:
=> mmc write ${loadaddr} 0x41 0x1
=> dhcp ${loadaddr} flash.bin
=> setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt
=> setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
=> mmc dev 1
=> mmc write ${loadaddr} 0x42 ${blkcnt}
=> mmc write ${loadaddr} 0x1042 ${blkcnt}

51
doc/usage/fatinfo.rst Normal file
View File

@ -0,0 +1,51 @@
.. SPDX-License-Identifier: GPL-2.0+:
fatinfo command
===============
Synopsis
--------
::
fatinfo <interface> <dev[:part]>
Description
-----------
The fatinfo command displays information about a FAT partition.
interface
interface for accessing the block device (mmc, sata, scsi, usb, ....)
dev
device number
part
partition number, defaults to 1
Example
-------
Here is the output for a partition on a 32 GB SD-Card:
::
=> fatinfo mmc 0:1
Interface: MMC
Device 0: Vendor: Man 00001b Snr 97560602 Rev: 13.8 Prod: EB1QT0
Type: Removable Hard Disk
Capacity: 30528.0 MB = 29.8 GB (62521344 x 512)
Filesystem: FAT32 "MYDISK "
=>
Configuration
-------------
The fatinfo command is only available if CONFIG_CMD_FAT=y.
Return value
------------
The return value $? is set to 0 (true) if the partition is a FAT partition.
Otherwise it is set to 1 (false).

View File

@ -481,7 +481,6 @@ efi_status_t EFIAPI efi_update_capsule(
if (ret != EFI_SUCCESS)
goto out;
}
out:
if (IS_ENABLED(CONFIG_EFI_ESRT)) {
/* Rebuild the ESRT to reflect any updated FW images. */
@ -489,6 +488,7 @@ out:
if (ret != EFI_SUCCESS)
log_warning("EFI Capsule: failed to update ESRT\n");
}
out:
return EFI_EXIT(ret);
}
@ -685,7 +685,6 @@ skip:
efi_free_pool(boot_dev);
boot_dev = NULL;
}
out:
if (boot_dev) {
u16 *path_str;
@ -703,6 +702,7 @@ out:
} else {
ret = EFI_NOT_FOUND;
}
out:
free(boot_order);
return ret;

View File

@ -7,6 +7,7 @@
#include <common.h>
#include <charset.h>
#include <efi_loader.h>
/**
* efi_create_indexed_name - create a string name with an index

View File

@ -535,30 +535,27 @@ static efi_status_t tcg2_create_digest(const u8 *input, u32 length,
sha1_starts(&ctx);
sha1_update(&ctx, input, length);
sha1_finish(&ctx, final);
digest_list->count++;
break;
case TPM2_ALG_SHA256:
sha256_starts(&ctx_256);
sha256_update(&ctx_256, input, length);
sha256_finish(&ctx_256, final);
digest_list->count++;
break;
case TPM2_ALG_SHA384:
sha384_starts(&ctx_512);
sha384_update(&ctx_512, input, length);
sha384_finish(&ctx_512, final);
digest_list->count++;
break;
case TPM2_ALG_SHA512:
sha512_starts(&ctx_512);
sha512_update(&ctx_512, input, length);
sha512_finish(&ctx_512, final);
digest_list->count++;
break;
default:
EFI_PRINT("Unsupported algorithm %x\n", hash_alg);
return EFI_INVALID_PARAMETER;
}
digest_list->count++;
digest_list->digests[i].hash_alg = hash_alg;
memcpy(&digest_list->digests[i].digest, final, (u32)alg_to_len(hash_alg));
}

View File

@ -39,7 +39,7 @@ class TestEfiCapsuleFirmwareFit(object):
with u_boot_console.log.section('Test Case 1-a, before reboot'):
output = u_boot_console.run_command_list([
'host bind 0 %s' % disk_img,
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi ""',
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""',
'efidebug boot order 1',
'env set -e OsIndications',
'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"',
@ -114,7 +114,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,
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi ""',
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""',
'efidebug boot order 1',
'env set -e -nv -bs -rt OsIndications =0x0000000000000004',
'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"',
@ -188,7 +188,7 @@ class TestEfiCapsuleFirmwareFit(object):
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,
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi ""',
'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""',
'efidebug boot order 1',
'env set -e -nv -bs -rt OsIndications =0x0000000000000004',
'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"',

View File

@ -28,7 +28,7 @@ class TestEfiSignedImage(object):
# Test Case 1a, run signed image if no PK
output = u_boot_console.run_command_list([
'host bind 0 %s' % disk_img,
'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed ""',
'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed -s ""',
'efidebug boot next 1',
'bootefi bootmgr'])
assert 'Hello, world!' in ''.join(output)
@ -36,7 +36,7 @@ class TestEfiSignedImage(object):
with u_boot_console.log.section('Test Case 1b'):
# Test Case 1b, run unsigned image if no PK
output = u_boot_console.run_command_list([
'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi ""',
'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi -s ""',
'efidebug boot next 2',
'bootefi bootmgr'])
assert 'Hello, world!' in ''.join(output)
@ -58,13 +58,13 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed ""',
'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed -s ""',
'efidebug boot next 1',
'efidebug test bootmgr'])
assert('\'HELLO1\' failed' in ''.join(output))
assert('efi_start_image() returned: 26' in ''.join(output))
output = u_boot_console.run_command_list([
'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi ""',
'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi -s ""',
'efidebug boot next 2',
'efidebug test bootmgr'])
assert '\'HELLO2\' failed' in ''.join(output)
@ -104,7 +104,7 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""',
'efidebug boot next 1',
'efidebug test bootmgr'])
assert '\'HELLO\' failed' in ''.join(output)
@ -142,7 +142,7 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""',
'efidebug boot next 1',
'efidebug test bootmgr'])
assert '\'HELLO\' failed' in ''.join(output)
@ -169,7 +169,7 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""',
'efidebug boot next 1',
'efidebug test bootmgr'])
assert 'Hello, world!' in ''.join(output)
@ -227,7 +227,7 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""',
'efidebug boot next 1',
'bootefi bootmgr'])
assert 'Hello, world!' in ''.join(output)

View File

@ -39,7 +39,7 @@ class TestEfiSignedImageIntca(object):
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO_a host 0:1 /helloworld.efi.signed_a ""',
'efidebug boot add -b 1 HELLO_a host 0:1 /helloworld.efi.signed_a -s ""',
'efidebug boot next 1',
'efidebug test bootmgr'])
assert '\'HELLO_a\' failed' in ''.join(output)
@ -48,7 +48,7 @@ class TestEfiSignedImageIntca(object):
with u_boot_console.log.section('Test Case 1b'):
# Test Case 1b, signed and authenticated by root CA
output = u_boot_console.run_command_list([
'efidebug boot add -b 2 HELLO_ab host 0:1 /helloworld.efi.signed_ab ""',
'efidebug boot add -b 2 HELLO_ab host 0:1 /helloworld.efi.signed_ab -s ""',
'efidebug boot next 2',
'bootefi bootmgr'])
assert 'Hello, world!' in ''.join(output)
@ -70,7 +70,7 @@ class TestEfiSignedImageIntca(object):
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc ""',
'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc -s ""',
'efidebug boot next 1',
'efidebug test bootmgr'])
assert '\'HELLO_abc\' failed' in ''.join(output)
@ -116,7 +116,7 @@ class TestEfiSignedImageIntca(object):
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc ""',
'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc -s ""',
'efidebug boot next 1',
'efidebug test bootmgr'])
assert 'Hello, world!' in ''.join(output)

View File

@ -35,7 +35,7 @@ class TestEfiUnsignedImage(object):
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""',
'efidebug boot next 1',
'bootefi bootmgr'])
assert '\'HELLO\' failed' in ''.join(output)
@ -64,7 +64,7 @@ class TestEfiUnsignedImage(object):
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""',
'efidebug boot next 1',
'bootefi bootmgr'])
assert 'Hello, world!' in ''.join(output)
@ -88,7 +88,7 @@ class TestEfiUnsignedImage(object):
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""',
'efidebug boot next 1',
'bootefi bootmgr'])
assert '\'HELLO\' failed' in ''.join(output)
@ -106,7 +106,7 @@ class TestEfiUnsignedImage(object):
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi ""',
'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""',
'efidebug boot next 1',
'bootefi bootmgr'])
assert '\'HELLO\' failed' in ''.join(output)