Hi 

 

Below Boot log shows that the QEMU platform uses a semi-hosting method to load the binaries

VERBOSE: Trying alternative IO

VERBOSE: Using Semi-hosting IO

so I am assuming the FIP header check failure is expected.

 

Please provide below information to reproduce this issue at our end:

  1. Meta repo information and its commit id used for testing
  2. TF-A change-id/commit-id used for testing

 

It looks unlikely the size of the BL2 image is that large (0xFFFFFFFF).

Also, please have a look at this page: https://trustedfirmware-a.readthedocs.io/en/latest/plat/qemu.html?highlight=qemu#booting-via-semi-hosting-option that guides to boot via semi hosting method.

 

Thanks,

Manish Badarkhe

From: TF-A <tf-a-bounces@lists.trustedfirmware.org> on behalf of Manish Pandey2 via TF-A <tf-a@lists.trustedfirmware.org>
Date: Monday, 18 October 2021 at 10:57
To: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>,
的老 <sprhawk@gmail.com>
Subject: Re: [TF-A] BL1 loading BL2 but returned file length 4294967295

Hi,

 

Looking at the logs it seems that fip is not parsed correctly and trying to get to alternate image which OfCourse is not available and giving BL2 size as "0xffffffff"

WARNING: Firmware Image Package header check failed.
VERBOSE: Trying alternative IO
VERBOSE: Using Semi-hosting IO
INFO:    Loading image id=1 at address 0xe01b000
WARNING: Image id=1 size(4294967295, 151552) out of bounds

 

Can you try appending fip in TFA_BUILD_TARGET = "bl1 bl2 bl31 fip" (BTW you can replace "bl1 bl2 bl31" with "all" )

 

thanks

Manish


From: TF-A <tf-a-bounces@lists.trustedfirmware.org> on behalf of 的老 via TF-A <tf-a@lists.trustedfirmware.org>
Sent: 16 October 2021 14:51
To: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: [TF-A] BL1 loading BL2 but returned file length 4294967295

 

Hi

 

I'm new to TF-A and OP Tee.

While I am using qemu to start TF-A, I got BL1 detected and failed to load BL2, due to BL2 size out of bounds.

I changed TF-A BL1 source code to show more information:

 

diff --git a/common/bl_common.c b/common/bl_common.c
index 2fcb5385d9..a6239a5257 100644
--- a/common/bl_common.c
+++ b/common/bl_common.c

@@ -110,7 +111,7 @@ static int load_image(unsigned int image_id, image_info_t *image_data)

        /* Check that the image size to load is within limit */
        if (image_size > image_data->image_max_size) {
-               WARN("Image id=%u size out of bounds\n", image_id);
+               WARN("Image id=%u size(%lu, %u) out of bounds\n", image_id, image_size, image_data->image_max_size);
                io_result = -EFBIG;
                goto exit;
        }

 

the log shows:

NOTICE:  Booting Trusted Firmware
NOTICE:  BL1: v2.3():v2.3-dirty
NOTICE:  BL1: Built : 15:56:43, Apr 20 2020
INFO:    BL1: RAM 0xe04e000 - 0xe056000
VERBOSE: BL1: cortex_a57: CPU workaround for 806969 was not applied
WARNING: BL1: cortex_a57: CPU workaround for 813419 was missing!
VERBOSE: BL1: cortex_a57: CPU workaround for 813420 was not applied
VERBOSE: BL1: cortex_a57: CPU workaround for 814670 was not applied
WARNING: BL1: cortex_a57: CPU workaround for 817169 was missing!
INFO:    BL1: cortex_a57: CPU workaround for disable_ldnp_overread was applied
WARNING: BL1: cortex_a57: CPU workaround for 826974 was missing!
WARNING: BL1: cortex_a57: CPU workaround for 826977 was missing!
WARNING: BL1: cortex_a57: CPU workaround for 828024 was missing!
WARNING: BL1: cortex_a57: CPU workaround for 829520 was missing!
WARNING: BL1: cortex_a57: CPU workaround for 833471 was missing!
WARNING: BL1: cortex_a57: CPU workaround for 859972 was missing!
INFO:    BL1: cortex_a57: CPU workaround for cve_2017_5715 was applied
INFO:    BL1: cortex_a57: CPU workaround for cve_2018_3639 was applied
INFO:    BL1: Loading BL2
VERBOSE: Using Memmap
WARNING: Firmware Image Package header check failed.
VERBOSE: Trying alternative IO
VERBOSE: Using Semi-hosting IO
INFO:    Loading image id=1 at address 0xe01b000
WARNING: Image id=1 size(4294967295, 151552) out of bounds
ERROR:   Failed to load BL2 firmware.

 

I'm using yocto (dunfell) + meta-arm to build / test TF-A + OP TEE under qemuarm64.

meta-arm rev: c4f04f3fb66f8f4365b08b553af8206372e90a63

variables defined inside conf/local.conf ( for test )

 

 23 MACHINE ?= "qemuarm64"
 25
 26 INSANE_SKIP_pn-optee-examples = "ldflags"
 27 COMPATIBLE_MACHINE_pn-optee-examples = "qemuarm64"
 28 COMPATIBLE_MACHINE_pn-optee-os = "qemuarm64"
 29 COMPATIBLE_MACHINE_pn-optee-client = "qemuarm64"
 30 COMPATIBLE_MACHINE_pn-trusted-firmware-a = "qemuarm64"
 31
 32 TFA_PLATFORM = "qemu"
 33 TFA_UBOOT = "1"
 34 TFA_DEBUG = "1"
 35 TFA_SPD = "opteed"
 36 TFA_BUILD_TARGET = "bl1 bl2 bl31"
 37
 38 OPTEEMACHINE:qemuarm64 = "vexpress-qemu_armv8a"
 39 OPTEEOUTPUTMACHINE:qemuarm64 = "vexpress"
 40
 41 UBOOT_MACHINE_qemuarm64  = "qemu_arm64_defconfig"

 

I started qemu using following command line:

 

BIOS=tmp/deploy/images/qemuarm64/bl1.bin \
KERNEL=tmp/deploy/images/qemuarm64/Image-qemuarm64.bin \
    runqemu mydefined-image-core-image-dev-optee nographic -d \
        qemuparams=" \
         -machine secure=on \
         -m 4096 \
         -d unimp -semihosting -semihosting-config enable=on,target=native \
        "

 

Thanks