From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.6607.1591879957272585429 for ; Thu, 11 Jun 2020 05:52:37 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CDBEA1FB; Thu, 11 Jun 2020 05:52:36 -0700 (PDT) Received: from localhost.localdomain (unknown [10.37.8.184]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7AB0D3F66F; Thu, 11 Jun 2020 05:52:34 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Laszlo Ersek , Leif Lindholm , Ilias Apalodimas , Julien Grall , Jiewen Yao , Sami Mujawar , Jiewen Yao Subject: [PATCH v2 1/3] ArmVirtPkg: add FDF rule for self-relocating PrePi Date: Thu, 11 Jun 2020 14:52:26 +0200 Message-Id: <20200611125228.252500-2-ard.biesheuvel@arm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611125228.252500-1-ard.biesheuvel@arm.com> References: <20200611125228.252500-1-ard.biesheuvel@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In preparation for making the self-relocating PrePi use the ordinary BasePeCoffLib routines for relocating the image in place in memory at start, add a special FDF rule that builds SEC modules as PE32 images with the relocation metadata preserved. Signed-off-by: Ard Biesheuvel Acked-by: Jiewen Yao Reviewed-by: Laszlo Ersek Acked-by: Sami Mujawar --- ArmVirtPkg/ArmVirtQemuKernel.fdf | 2 +- ArmVirtPkg/ArmVirtXen.fdf | 2 +- ArmVirtPkg/ArmVirtRules.fdf.inc | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKerne= l.fdf index 72fc8dd698f8..55e33aba0d55 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf @@ -136,7 +136,7 @@ [FV.FVMAIN_COMPACT] READ_LOCK_CAP =3D TRUE=0D READ_LOCK_STATUS =3D TRUE=0D =0D - INF ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf=0D + INF RuleOverride =3D SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelo= catable.inf=0D =0D FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {=0D SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE {=0D diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf index 6a97bceeacbc..f708878f4965 100644 --- a/ArmVirtPkg/ArmVirtXen.fdf +++ b/ArmVirtPkg/ArmVirtXen.fdf @@ -233,7 +233,7 @@ [FV.FVMAIN_COMPACT] READ_LOCK_CAP =3D TRUE=0D READ_LOCK_STATUS =3D TRUE=0D =0D - INF ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf=0D + INF RuleOverride =3D SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelo= catable.inf=0D =0D FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {=0D SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE {=0D diff --git a/ArmVirtPkg/ArmVirtRules.fdf.inc b/ArmVirtPkg/ArmVirtRules.fdf.= inc index 63de26abe056..b8ec040d2330 100644 --- a/ArmVirtPkg/ArmVirtRules.fdf.inc +++ b/ArmVirtPkg/ArmVirtRules.fdf.inc @@ -39,6 +39,11 @@ [Rule.Common.SEC] TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi= =0D }=0D =0D +[Rule.Common.SEC.SELF_RELOC]=0D + FILE SEC =3D $(NAMED_GUID) {=0D + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + }=0D +=0D [Rule.Common.PEI_CORE]=0D FILE PEI_CORE =3D $(NAMED_GUID) FIXED {=0D TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi= =0D --=20 2.26.2