From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Thu, 26 Sep 2019 12:22:19 -0700 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E92C6C05AA52; Thu, 26 Sep 2019 19:22:18 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-49.rdu2.redhat.com [10.10.120.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC21660C5D; Thu, 26 Sep 2019 19:22:17 +0000 (UTC) Subject: Re: [edk2-devel] Problem with decompression on EDK2 To: devel@edk2.groups.io, tien.hock.loh@intel.com Cc: "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" References: From: "Laszlo Ersek" Message-ID: Date: Thu, 26 Sep 2019 21:22:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 26 Sep 2019 19:22:19 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/26/19 11:27, Loh, Tien Hock wrote: > Hi > > I have an issue while porting a new platform to EDK2. After porting the Stratix 10 platform (ARM) to EDK2 it works correctly. However, when I tried to add more INF to the FDF file, it failed to decompress the image during boot time, log as below > INFO: DDR: DRAM calibration success. > INFO: Scrubbing ECC > INFO: Init HPS NOC's DDR Scheduler. > NOTICE: BL2: v2.1(debug):v2.1-15-g5880144-dirty > NOTICE: BL2: Built : 14:02:01, Aug 22 2019 > INFO: BL2: Doing platform setup > INFO: BL2: Loading image id 3 > INFO: Loading image id=3 at address 0xffe1c000 > INFO: Image id=3 loaded: 0xffe1c000 - 0xffe22019 > INFO: BL2: Loading image id 5 > INFO: Loading image id=5 at address 0x50000 > INFO: Image id=5 loaded: 0x50000 - 0x150000 > NOTICE: BL2: Booting BL31 > INFO: Entry point address = 0xffe1c000 > INFO: SPSR = 0x3cd > NOTICE: BL31: v2.1(release):v2.1-604-g3441952 > NOTICE: BL31: Built : 15:32:55, Sep 25 2019 > UEFI firmware (version 1.0 built at 15:15:26 on Sep 26 2019) > Decompress Failed - Invalid Parameter > > ASSERT_EFI_ERROR (Status = Not Found) > ASSERT [ArmPlatformPrePiUniCore] /nfs/png/disks/swuser_work_thloh/push/build/edk2/ArmPlatformPkg/PrePi/PrePi.c(151): !EFI_ERROR (Status) > > This happens if I add more items to the image, and if I reduce the size of the image, it works correctly again. This could be a clue to what could've gone wrong. Does anyone have any ideas what might've gone wrong? > I traced the decompression to LzmaDecode, and got lost in the code there. The compressed section in a firmware volume is likely truncated at build time, and does not decompress at boot time. I would expect the "build" utility to report this issue, and stop with an error. When you run "build" in the successful and in the failing cases, what are the stats, respectively, that are printed at the end of the build logs? Also, you could check your FDF file(s) near "EE4E5898-3914-4259-9D6E-DC7BD79403CF"; perhaps you find interesting bits. Furthermore, if the boundary seems to be 16MB, then it could be an issue in the processing code. See "ExtendedSize" in "MdePkg/Include/Pi/PiFirmwareFile.h". I vaguely recall issues around some code trying to parse EFI_FFS_FILE_HEADER2 as EFI_FFS_FILE_HEADER, or EFI_COMMON_SECTION_HEADER2 as EFI_COMMON_SECTION_HEADER. Thanks Laszlo