mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-27 18:18:18 +00:00
Pull request for efi-2023-07-rc1-2
Documentation: * Describe Python coding style UEFI: * Enable tests for authenticated capsules on the sandbox * Fix pylint warnings * Correct struct efi_hii_keyboard_layout definition -----BEGIN PGP SIGNATURE----- iQJWBAABCABAFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmRCfmEiHGhlaW5yaWNo LnNjaHVjaGFyZHRAY2Fub25pY2FsLmNvbQAKCRCE7i+CcTdTS0OfD/9UtsWvbQTV iAITWI5guuqNrOJbaah3Pp+qyBcrMOytWKpt0rcQFmyEqkJGpWMIYusjIAYtTv2r azVPcFR8hxhymdoUURdNsCjgTLQ6lemuUfINUmFyBJvyupwj3N7378XGh4C6dRjr YVdb5dQE+6PQRt5d3YPbzGaPJoEPjhI+IJPWgiOTBKuHtgCFW505ah33UAQulxh/ tmd3gZhkK/6+svf1NxHKQS+eW1BZ/NUvju5G5wrsLQdkCYB7CLwELpxV+oQtp46Y FAmjJ268EH6iLnpJfFjdz9Gf1XTlVC81yNp+tpsJp8qbSUiyThKn2YTygN/6KcN1 rnslgxsK1uh8jctmfX5D9asu2czGFJ7XBE/JIMHQIlctxEdbzAjF/2LYbcqbiAe8 HTg2UXCnpEycIHB3FFh1HYcX0Ka/yVJOTB3x25eols+NiytqanjYHZ0BwQiQnyCp y8zEWKZZi1rqWrZK6RuakYNRpSdT8QJG1MrCJY1+CL4FZAe9tiO1+nXhkBhfhRpE GiD0a07PAh3F8bglrAbSPIVbpuYs28hCF96spA5WixyCsnr2dvl6uoVL0/PflcN9 NGFd9mVO4gwg7d9VgJ+QW+kVwaY+HDLKKkC+mESuKHgc6PInwUpYT2DPBMlJ+65c B398snFzs4gfv8udepY9sPkzRyv6+vjgEg== =/TcM -----END PGP SIGNATURE----- Merge tag 'efi-2023-07-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2023-07-rc1-2 Documentation: * Describe Python coding style UEFI: * Enable tests for authenticated capsules on the sandbox * Fix pylint warnings * Correct struct efi_hii_keyboard_layout definition
This commit is contained in:
commit
39bc4e12ab
@ -336,6 +336,7 @@ CONFIG_ERRNO_STR=y
|
|||||||
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
|
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
|
||||||
CONFIG_EFI_CAPSULE_ON_DISK=y
|
CONFIG_EFI_CAPSULE_ON_DISK=y
|
||||||
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
|
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
|
||||||
|
CONFIG_EFI_CAPSULE_AUTHENTICATE=y
|
||||||
CONFIG_EFI_SECURE_BOOT=y
|
CONFIG_EFI_SECURE_BOOT=y
|
||||||
CONFIG_TEST_FDTDEC=y
|
CONFIG_TEST_FDTDEC=y
|
||||||
CONFIG_UNIT_TEST=y
|
CONFIG_UNIT_TEST=y
|
||||||
|
|||||||
@ -226,6 +226,7 @@ CONFIG_ERRNO_STR=y
|
|||||||
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
|
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
|
||||||
CONFIG_EFI_CAPSULE_ON_DISK=y
|
CONFIG_EFI_CAPSULE_ON_DISK=y
|
||||||
CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
|
CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
|
||||||
|
CONFIG_EFI_CAPSULE_AUTHENTICATE=y
|
||||||
CONFIG_UNIT_TEST=y
|
CONFIG_UNIT_TEST=y
|
||||||
CONFIG_UT_TIME=y
|
CONFIG_UT_TIME=y
|
||||||
CONFIG_UT_DM=y
|
CONFIG_UT_DM=y
|
||||||
|
|||||||
@ -19,6 +19,10 @@ The following rules apply:
|
|||||||
applies only to Linux, not to U-Boot. Only large hunks which are copied
|
applies only to Linux, not to U-Boot. Only large hunks which are copied
|
||||||
unchanged from Linux may retain that comment format.
|
unchanged from Linux may retain that comment format.
|
||||||
|
|
||||||
|
* Python code shall conform to `PEP8 (Style Guide for Python Code)
|
||||||
|
<https://peps.python.org/pep-0008/>`_. Use `pylint
|
||||||
|
<https://github.com/pylint-dev/pylint>`_ for checking the code.
|
||||||
|
|
||||||
* Use patman to send your patches (``tools/patman/patman -H`` for full
|
* Use patman to send your patches (``tools/patman/patman -H`` for full
|
||||||
instructions). With a few tags in your commits this will check your patches
|
instructions). With a few tags in your commits this will check your patches
|
||||||
and take care of emailing them.
|
and take care of emailing them.
|
||||||
@ -67,6 +71,9 @@ documentation is strongly advised. The Linux kernel `kernel-doc
|
|||||||
<https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html>`_
|
<https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html>`_
|
||||||
documentation applies with no changes.
|
documentation applies with no changes.
|
||||||
|
|
||||||
|
Our Python code documentation follows `PEP257 (Docstring Conventions)
|
||||||
|
<https://peps.python.org/pep-0257/>`_.
|
||||||
|
|
||||||
Use structures for I/O access
|
Use structures for I/O access
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|||||||
@ -1173,7 +1173,7 @@ struct efi_hii_keyboard_layout {
|
|||||||
efi_guid_t guid;
|
efi_guid_t guid;
|
||||||
u32 layout_descriptor_string_offset;
|
u32 layout_descriptor_string_offset;
|
||||||
u8 descriptor_count;
|
u8 descriptor_count;
|
||||||
struct efi_key_descriptor descriptors[];
|
/* struct efi_key_descriptor descriptors[]; follows here */
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct efi_hii_keyboard_package {
|
struct efi_hii_keyboard_package {
|
||||||
|
|||||||
@ -404,12 +404,6 @@ out:
|
|||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
efi_status_t efi_capsule_authenticate(const void *capsule, efi_uintn_t capsule_size,
|
|
||||||
void **image, efi_uintn_t *image_size)
|
|
||||||
{
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_EFI_CAPSULE_AUTHENTICATE */
|
#endif /* CONFIG_EFI_CAPSULE_AUTHENTICATE */
|
||||||
|
|
||||||
static __maybe_unused bool fwu_empty_capsule(struct efi_capsule_header *capsule)
|
static __maybe_unused bool fwu_empty_capsule(struct efi_capsule_header *capsule)
|
||||||
|
|||||||
@ -2,30 +2,21 @@
|
|||||||
# Copyright (c) 2020, Linaro Limited
|
# Copyright (c) 2020, Linaro Limited
|
||||||
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
|
||||||
import os
|
"""Fixture for UEFI capsule test
|
||||||
import os.path
|
"""
|
||||||
import re
|
|
||||||
from subprocess import call, check_call, check_output, CalledProcessError
|
|
||||||
import pytest
|
|
||||||
from capsule_defs import *
|
|
||||||
|
|
||||||
#
|
from subprocess import call, check_call, CalledProcessError
|
||||||
# Fixture for UEFI capsule test
|
import pytest
|
||||||
#
|
from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR, EFITOOLS_PATH
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def efi_capsule_data(request, u_boot_config):
|
def efi_capsule_data(request, u_boot_config):
|
||||||
"""Set up a file system to be used in UEFI capsule and
|
"""Set up a file system to be used in UEFI capsule and authentication test
|
||||||
authentication test.
|
and return a ath to disk image to be used for testing
|
||||||
|
|
||||||
Args:
|
request -- Pytest request object.
|
||||||
request: Pytest request object.
|
u_boot_config -- U-boot configuration.
|
||||||
u_boot_config: U-boot configuration.
|
|
||||||
|
|
||||||
Return:
|
|
||||||
A path to disk image to be used for testing
|
|
||||||
"""
|
"""
|
||||||
global CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR
|
|
||||||
|
|
||||||
mnt_point = u_boot_config.persistent_data_dir + '/test_efi_capsule'
|
mnt_point = u_boot_config.persistent_data_dir + '/test_efi_capsule'
|
||||||
data_dir = mnt_point + CAPSULE_DATA_DIR
|
data_dir = mnt_point + CAPSULE_DATA_DIR
|
||||||
|
|||||||
@ -1,16 +1,13 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0+
|
# SPDX-License-Identifier: GPL-2.0+
|
||||||
# Copyright (c) 2020, Linaro Limited
|
# Copyright (c) 2020, Linaro Limited
|
||||||
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
#
|
|
||||||
# U-Boot UEFI: Firmware Update Test
|
|
||||||
|
|
||||||
"""
|
"""U-Boot UEFI: Firmware Update Test
|
||||||
This test verifies capsule-on-disk firmware update for FIT images
|
This test verifies capsule-on-disk firmware update for FIT images
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from subprocess import check_call, check_output, CalledProcessError
|
|
||||||
import pytest
|
import pytest
|
||||||
from capsule_defs import *
|
from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.boardspec('sandbox_flattree')
|
@pytest.mark.boardspec('sandbox_flattree')
|
||||||
@ -24,11 +21,14 @@ from capsule_defs import *
|
|||||||
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
|
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
|
||||||
@pytest.mark.buildconfigspec('cmd_sf')
|
@pytest.mark.buildconfigspec('cmd_sf')
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
class TestEfiCapsuleFirmwareFit(object):
|
class TestEfiCapsuleFirmwareFit():
|
||||||
|
"""Test capsule-on-disk firmware update for FIT images
|
||||||
|
"""
|
||||||
|
|
||||||
def test_efi_capsule_fw1(
|
def test_efi_capsule_fw1(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 1
|
||||||
Test Case 1 - Update U-Boot and U-Boot environment on SPI Flash
|
Update U-Boot and U-Boot environment on SPI Flash
|
||||||
but with an incorrect GUID value in the capsule
|
but with an incorrect GUID value in the capsule
|
||||||
No update should happen
|
No update should happen
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
0x100000-0x150000: U-Boot binary (but dummy)
|
||||||
@ -74,8 +74,6 @@ class TestEfiCapsuleFirmwareFit(object):
|
|||||||
|
|
||||||
capsule_early = u_boot_config.buildconfig.get(
|
capsule_early = u_boot_config.buildconfig.get(
|
||||||
'config_efi_capsule_on_disk_early')
|
'config_efi_capsule_on_disk_early')
|
||||||
capsule_auth = u_boot_config.buildconfig.get(
|
|
||||||
'config_efi_capsule_authenticate')
|
|
||||||
|
|
||||||
# reboot
|
# reboot
|
||||||
u_boot_console.restart_uboot(expect_reset = capsule_early)
|
u_boot_console.restart_uboot(expect_reset = capsule_early)
|
||||||
@ -107,11 +105,12 @@ class TestEfiCapsuleFirmwareFit(object):
|
|||||||
|
|
||||||
def test_efi_capsule_fw2(
|
def test_efi_capsule_fw2(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 2
|
||||||
Test Case 2 - Update U-Boot and U-Boot environment on SPI Flash
|
Update U-Boot and U-Boot environment on SPI Flash
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
0x100000-0x150000: U-Boot binary (but dummy)
|
||||||
0x150000-0x200000: U-Boot environment (but dummy)
|
0x150000-0x200000: U-Boot environment (but dummy)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
disk_img = efi_capsule_data
|
disk_img = efi_capsule_data
|
||||||
with u_boot_console.log.section('Test Case 2-a, before reboot'):
|
with u_boot_console.log.section('Test Case 2-a, before reboot'):
|
||||||
output = u_boot_console.run_command_list([
|
output = u_boot_console.run_command_list([
|
||||||
|
|||||||
@ -3,10 +3,8 @@
|
|||||||
# Copyright (c) 2022, Arm Limited
|
# Copyright (c) 2022, Arm Limited
|
||||||
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>,
|
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>,
|
||||||
# adapted to FIT images by Vincent Stehlé <vincent.stehle@arm.com>
|
# adapted to FIT images by Vincent Stehlé <vincent.stehle@arm.com>
|
||||||
#
|
|
||||||
# U-Boot UEFI: Firmware Update (Signed capsule with FIT images) Test
|
|
||||||
|
|
||||||
"""
|
"""U-Boot UEFI: Firmware Update (Signed capsule with FIT images) Test
|
||||||
This test verifies capsule-on-disk firmware update
|
This test verifies capsule-on-disk firmware update
|
||||||
with signed capsule files containing FIT images
|
with signed capsule files containing FIT images
|
||||||
"""
|
"""
|
||||||
@ -25,12 +23,15 @@ from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR
|
|||||||
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
|
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
|
||||||
@pytest.mark.buildconfigspec('cmd_sf')
|
@pytest.mark.buildconfigspec('cmd_sf')
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
class TestEfiCapsuleFirmwareSignedFit(object):
|
class TestEfiCapsuleFirmwareSignedFit():
|
||||||
|
"""Capsule-on-disk firmware update test
|
||||||
|
"""
|
||||||
|
|
||||||
def test_efi_capsule_auth1(
|
def test_efi_capsule_auth1(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 1
|
||||||
Test Case 1 - Update U-Boot on SPI Flash, FIT image format
|
Update U-Boot on SPI Flash, FIT image format
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
x150000: U-Boot binary (but dummy)
|
||||||
|
|
||||||
If the capsule is properly signed, the authentication
|
If the capsule is properly signed, the authentication
|
||||||
should pass and the firmware be updated.
|
should pass and the firmware be updated.
|
||||||
@ -103,8 +104,8 @@ class TestEfiCapsuleFirmwareSignedFit(object):
|
|||||||
|
|
||||||
def test_efi_capsule_auth2(
|
def test_efi_capsule_auth2(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 2
|
||||||
Test Case 2 - Update U-Boot on SPI Flash, FIT image format
|
Update U-Boot on SPI Flash, FIT image format
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
0x100000-0x150000: U-Boot binary (but dummy)
|
||||||
|
|
||||||
If the capsule is signed but with an invalid key,
|
If the capsule is signed but with an invalid key,
|
||||||
@ -182,8 +183,8 @@ class TestEfiCapsuleFirmwareSignedFit(object):
|
|||||||
|
|
||||||
def test_efi_capsule_auth3(
|
def test_efi_capsule_auth3(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 3
|
||||||
Test Case 3 - Update U-Boot on SPI Flash, FIT image format
|
Update U-Boot on SPI Flash, FIT image format
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
0x100000-0x150000: U-Boot binary (but dummy)
|
||||||
|
|
||||||
If the capsule is not signed, the authentication
|
If the capsule is not signed, the authentication
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0+
|
# SPDX-License-Identifier: GPL-2.0+
|
||||||
# Copyright (c) 2021, Linaro Limited
|
# Copyright (c) 2021, Linaro Limited
|
||||||
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
# Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
#
|
|
||||||
# U-Boot UEFI: Firmware Update (Signed capsule with raw images) Test
|
|
||||||
|
|
||||||
"""
|
"""U-Boot UEFI: Firmware Update (Signed capsule with raw images) Test
|
||||||
This test verifies capsule-on-disk firmware update
|
This test verifies capsule-on-disk firmware update
|
||||||
with signed capsule files containing raw images
|
with signed capsule files containing raw images
|
||||||
"""
|
"""
|
||||||
@ -23,11 +21,13 @@ from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR
|
|||||||
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
|
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
|
||||||
@pytest.mark.buildconfigspec('cmd_sf')
|
@pytest.mark.buildconfigspec('cmd_sf')
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
class TestEfiCapsuleFirmwareSignedRaw(object):
|
class TestEfiCapsuleFirmwareSignedRaw():
|
||||||
|
"""Firmware Update (Signed capsule with raw images) Test
|
||||||
|
"""
|
||||||
|
|
||||||
def test_efi_capsule_auth1(
|
def test_efi_capsule_auth1(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 1 - Update U-Boot on SPI Flash, raw image format
|
||||||
Test Case 1 - Update U-Boot on SPI Flash, raw image format
|
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
0x100000-0x150000: U-Boot binary (but dummy)
|
||||||
|
|
||||||
If the capsule is properly signed, the authentication
|
If the capsule is properly signed, the authentication
|
||||||
@ -100,8 +100,7 @@ class TestEfiCapsuleFirmwareSignedRaw(object):
|
|||||||
|
|
||||||
def test_efi_capsule_auth2(
|
def test_efi_capsule_auth2(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 2 - Update U-Boot on SPI Flash, raw image format
|
||||||
Test Case 2 - Update U-Boot on SPI Flash, raw image format
|
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
0x100000-0x150000: U-Boot binary (but dummy)
|
||||||
|
|
||||||
If the capsule is signed but with an invalid key,
|
If the capsule is signed but with an invalid key,
|
||||||
@ -179,8 +178,7 @@ class TestEfiCapsuleFirmwareSignedRaw(object):
|
|||||||
|
|
||||||
def test_efi_capsule_auth3(
|
def test_efi_capsule_auth3(
|
||||||
self, u_boot_config, u_boot_console, efi_capsule_data):
|
self, u_boot_config, u_boot_console, efi_capsule_data):
|
||||||
"""
|
"""Test Case 3 - Update U-Boot on SPI Flash, raw image format
|
||||||
Test Case 3 - Update U-Boot on SPI Flash, raw image format
|
|
||||||
0x100000-0x150000: U-Boot binary (but dummy)
|
0x100000-0x150000: U-Boot binary (but dummy)
|
||||||
|
|
||||||
If the capsule is not signed, the authentication
|
If the capsule is not signed, the authentication
|
||||||
|
|||||||
@ -433,11 +433,13 @@ def test_efi_fit_launch(u_boot_console):
|
|||||||
sys_arch = cons.config.buildconfig.get('config_sys_arch', '"sandbox"')[1:-1]
|
sys_arch = cons.config.buildconfig.get('config_sys_arch', '"sandbox"')[1:-1]
|
||||||
is_sandbox = sys_arch == 'sandbox'
|
is_sandbox = sys_arch == 'sandbox'
|
||||||
|
|
||||||
|
if is_sandbox:
|
||||||
|
old_dtb = cons.config.dtb
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if is_sandbox:
|
if is_sandbox:
|
||||||
# Use our own device tree file, will be restored afterwards.
|
# Use our own device tree file, will be restored afterwards.
|
||||||
control_dtb = make_dtb('internal', False)
|
control_dtb = make_dtb('internal', False)
|
||||||
old_dtb = cons.config.dtb
|
|
||||||
cons.config.dtb = control_dtb
|
cons.config.dtb = control_dtb
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user