From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web10.843.1591734812323997331 for ; Tue, 09 Jun 2020 13:33:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YejWAQsS; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591734811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hxi7/qq26ySZmIBpxX3qRBOdfozbpC/NFYq6uVU/FLk=; b=YejWAQsSjq8wIEE2nCgYwgDjMBnKiPQWTkrR7XZBFV4pWW+5ToNQcj3nz+bcf6vZaxQYJJ GEHtUK31SqTtSJFEIMMePeEkYhU/5w1dcIno4IG5ZBAS1lNrTx9x6e0b/M/9kg4yEMCj+v rx9v2sZF0VO310Es6Y20wUPz/Q8jCxg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-ThJRnQPdOmSriGi7uKooHA-1; Tue, 09 Jun 2020 16:33:27 -0400 X-MC-Unique: ThJRnQPdOmSriGi7uKooHA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 413101009440; Tue, 9 Jun 2020 20:33:26 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-194.ams2.redhat.com [10.36.112.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D6C389290; Tue, 9 Jun 2020 20:33:24 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 1/4] ArmVirtPkg: add FDF rule for self-relocating PrePi To: devel@edk2.groups.io, ard.biesheuvel@arm.com Cc: Bob Feng , Liming Gao , Leif Lindholm , Ilias Apalodimas , Julien Grall , Jiewen Yao References: <20200608173413.1100679-1-ard.biesheuvel@arm.com> <20200608173413.1100679-2-ard.biesheuvel@arm.com> From: "Laszlo Ersek" Message-ID: <0250dbce-418c-7141-da7d-806aae6c7d95@redhat.com> Date: Tue, 9 Jun 2020 22:33:23 +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: <20200608173413.1100679-2-ard.biesheuvel@arm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 06/08/20 19:34, Ard Biesheuvel wrote: > 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 > --- > 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/ArmVirtQemuKernel.fdf > index 72fc8dd698f8..55e33aba0d55 100644 > --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf > +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf > @@ -136,7 +136,7 @@ [FV.FVMAIN_COMPACT] > READ_LOCK_CAP = TRUE > READ_LOCK_STATUS = TRUE > > - INF ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf > + INF RuleOverride = SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf > > FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { > SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { > 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 = TRUE > READ_LOCK_STATUS = TRUE > > - INF ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf > + INF RuleOverride = SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf > > FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { > SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { > diff --git a/ArmVirtPkg/ArmVirtRules.fdf.inc b/ArmVirtPkg/ArmVirtRules.fdf.inc > index 63de26abe056..8496767c718e 100644 > --- a/ArmVirtPkg/ArmVirtRules.fdf.inc > +++ b/ArmVirtPkg/ArmVirtRules.fdf.inc > @@ -39,6 +39,11 @@ [Rule.Common.SEC] > TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi > } > > +[Rule.Common.SEC.SELF_RELOC] > + FILE SEC = $(NAMED_GUID) { > + PE32 PE32 Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi > + } > + > [Rule.Common.PEI_CORE] > FILE PEI_CORE = $(NAMED_GUID) FIXED { > TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi > Reviewed-by: Laszlo Ersek