* [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
@ 2019-09-11 16:23 Ard Biesheuvel
2019-09-12 14:46 ` Laszlo Ersek
2019-09-12 15:20 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2019-09-11 16:23 UTC (permalink / raw)
To: devel; +Cc: leif.lindholm, lersek, philmd, Ard Biesheuvel
After upgrading the CI system we use for building the ArmVirtPkg
targets, we started seeing failures due to the NOOPT build running
out of space when using the CLANG38 toolchain definition combined
with clang 7.
We really don't want to increase the FD/FV sizes in general to
accommodate this, so parameterize the relevant quantities and
increase them by 50% for NOOPT builds.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
v2: implement suggestions by Laszlo on 1) how to parameterize this further,
and b) to avoid adding another .inc file
update kernel header field, as pointed out by Philippe
ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
4 files changed, 66 insertions(+), 9 deletions(-)
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index a4ae25d982a2..d6b58e5c018b 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -10,6 +10,34 @@
[Defines]
DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
+ #
+ # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
+ # one of the supported values, in place of any of the convenience macros, is
+ # permitted.
+ #
+!if $(TARGET) == NOOPT
+ DEFINE FD_SIZE_3MB = TRUE
+!endif
+
+!ifdef $(FD_SIZE_2MB)
+ DEFINE FD_SIZE_IN_KB = 2048
+!else
+!ifdef $(FD_SIZE_3MB)
+ DEFINE FD_SIZE_IN_KB = 3072
+!else
+ DEFINE FD_SIZE_IN_KB = 2048
+!endif
+!endif
+
+!if $(FD_SIZE_IN_KB) == 2048
+ DEFINE FD_SIZE = 0x200000
+ DEFINE FD_NUM_BLOCKS = 0x200
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+ DEFINE FD_SIZE = 0x300000
+ DEFINE FD_NUM_BLOCKS = 0x300
+!endif
+
[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index c2169cb7964b..d3950c8be05e 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -20,14 +20,22 @@
#
################################################################################
+[Defines]
+!if $(FD_SIZE_IN_KB) == 2048
+ DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+ DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000
+!endif
+
[FD.QEMU_EFI]
BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
-Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
+Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
ErasePolarity = 1
# This one is tricky, it must be: BlockSize * NumBlocks = Size
BlockSize = 0x00001000
-NumBlocks = 0x200
+NumBlocks = $(FD_NUM_BLOCKS)
################################################################################
#
@@ -59,7 +67,7 @@ DATA = {
!endif
}
-0x00001000|0x001ff000
+0x00001000|$(FVMAIN_COMPACT_SIZE)
gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
FV = FVMAIN_COMPACT
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
index f675b6d65ee1..46ec967e1cc0 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
+++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
@@ -20,14 +20,22 @@
#
################################################################################
+[Defines]
+!if $(FD_SIZE_IN_KB) == 2048
+ DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+ DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
+!endif
+
[FD.QEMU_EFI]
BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
-Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
+Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
ErasePolarity = 1
# This one is tricky, it must be: BlockSize * NumBlocks = Size
BlockSize = 0x00001000
-NumBlocks = 0x200
+NumBlocks = $(FD_NUM_BLOCKS)
################################################################################
#
@@ -56,7 +64,12 @@ DATA = {
0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
+!if $(FD_SIZE_IN_KB) == 2048
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
+!endif
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
@@ -81,7 +94,7 @@ DATA = {
!endif
}
-0x00008000|0x001f8000
+0x00008000|$(FVMAIN_COMPACT_SIZE)
gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
FV = FVMAIN_COMPACT
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index 79f681cde028..2bbb64abde6b 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -20,14 +20,22 @@
#
################################################################################
+[Defines]
+!if $(FD_SIZE_IN_KB) == 2048
+ DEFINE FVMAIN_COMPACT_SIZE = 0x1fe000
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+ DEFINE FVMAIN_COMPACT_SIZE = 0x2fe000
+!endif
+
[FD.XEN_EFI]
BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
-Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
+Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize
ErasePolarity = 1
# This one is tricky, it must be: BlockSize * NumBlocks = Size
BlockSize = 0x00001000
-NumBlocks = 0x200
+NumBlocks = $(FD_NUM_BLOCKS)
################################################################################
#
@@ -81,7 +89,7 @@ DATA = {
!endif
}
-0x00002000|0x001fe000
+0x00002000|$(FVMAIN_COMPACT_SIZE)
gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
FV = FVMAIN_COMPACT
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-11 16:23 [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds Ard Biesheuvel
@ 2019-09-12 14:46 ` Laszlo Ersek
2019-09-12 14:47 ` Laszlo Ersek
2019-09-12 14:53 ` Ard Biesheuvel
2019-09-12 15:20 ` Philippe Mathieu-Daudé
1 sibling, 2 replies; 9+ messages in thread
From: Laszlo Ersek @ 2019-09-12 14:46 UTC (permalink / raw)
To: Ard Biesheuvel, devel; +Cc: leif.lindholm, philmd
On 09/11/19 18:23, Ard Biesheuvel wrote:
> After upgrading the CI system we use for building the ArmVirtPkg
> targets, we started seeing failures due to the NOOPT build running
> out of space when using the CLANG38 toolchain definition combined
> with clang 7.
>
> We really don't want to increase the FD/FV sizes in general to
> accommodate this, so parameterize the relevant quantities and
> increase them by 50% for NOOPT builds.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> v2: implement suggestions by Laszlo on 1) how to parameterize this further,
> and b) to avoid adding another .inc file
> update kernel header field, as pointed out by Philippe
>
> ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
> ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
> ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
> ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
> 4 files changed, 66 insertions(+), 9 deletions(-)
>
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index a4ae25d982a2..d6b58e5c018b 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -10,6 +10,34 @@
> [Defines]
> DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
>
> + #
> + # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
> + # one of the supported values, in place of any of the convenience macros, is
> + # permitted.
> + #
> +!if $(TARGET) == NOOPT
> + DEFINE FD_SIZE_3MB = TRUE
> +!endif
Sorry, I must have been unclear -- I meant the macros FD_SIZE_2MB /
FD_SIZE_3MB / FD_SIZE_IN_KB as a replacement for the $(TARGET) based
logic, not as an addition to it.
Is it important to select the 3MB build by default, in case "-b NOOPT"
is given on the build command line?
My thinking was that, in your CI env, you could pass -D FD_SIZE_3MB
specifically, whenever you build for -b NOOPT. Other users building for
-b NOOPT would see no change.
My suggestion would be:
(1) s/for NOOPT builds/with -D FD_SIZE_3MB/ in the commit message
(2) drop the above three lines (the TARGET-based conditional)
With those:
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
and you could go ahead and push the patch (no repost needed).
OTOH, if you'd really like to set 3MB for NOOPT automatically, then I
think we'll need a way for letting users override that new default, back
to 2MB.
... Or is such an override possible with this patch already, perhaps?
Thanks!
Laszlo
> +
> +!ifdef $(FD_SIZE_2MB)
> + DEFINE FD_SIZE_IN_KB = 2048
> +!else
> +!ifdef $(FD_SIZE_3MB)
> + DEFINE FD_SIZE_IN_KB = 3072
> +!else
> + DEFINE FD_SIZE_IN_KB = 2048
> +!endif
> +!endif
> +
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FD_SIZE = 0x200000
> + DEFINE FD_NUM_BLOCKS = 0x200
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FD_SIZE = 0x300000
> + DEFINE FD_NUM_BLOCKS = 0x300
> +!endif
> +
> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
> GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
>
> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
> index c2169cb7964b..d3950c8be05e 100644
> --- a/ArmVirtPkg/ArmVirtQemu.fdf
> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
> @@ -20,14 +20,22 @@
> #
> ################################################################################
>
> +[Defines]
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000
> +!endif
> +
> [FD.QEMU_EFI]
> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> ErasePolarity = 1
>
> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> BlockSize = 0x00001000
> -NumBlocks = 0x200
> +NumBlocks = $(FD_NUM_BLOCKS)
>
> ################################################################################
> #
> @@ -59,7 +67,7 @@ DATA = {
> !endif
> }
>
> -0x00001000|0x001ff000
> +0x00001000|$(FVMAIN_COMPACT_SIZE)
> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> FV = FVMAIN_COMPACT
>
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> index f675b6d65ee1..46ec967e1cc0 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> @@ -20,14 +20,22 @@
> #
> ################################################################################
>
> +[Defines]
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
> +!endif
> +
> [FD.QEMU_EFI]
> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> ErasePolarity = 1
>
> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> BlockSize = 0x00001000
> -NumBlocks = 0x200
> +NumBlocks = $(FD_NUM_BLOCKS)
>
> ################################################################################
> #
> @@ -56,7 +64,12 @@ DATA = {
> 0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
> 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
> 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
> +!if $(FD_SIZE_IN_KB) == 2048
> 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
> +!endif
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
> @@ -81,7 +94,7 @@ DATA = {
> !endif
> }
>
> -0x00008000|0x001f8000
> +0x00008000|$(FVMAIN_COMPACT_SIZE)
> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> FV = FVMAIN_COMPACT
>
> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> index 79f681cde028..2bbb64abde6b 100644
> --- a/ArmVirtPkg/ArmVirtXen.fdf
> +++ b/ArmVirtPkg/ArmVirtXen.fdf
> @@ -20,14 +20,22 @@
> #
> ################################################################################
>
> +[Defines]
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FVMAIN_COMPACT_SIZE = 0x1fe000
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FVMAIN_COMPACT_SIZE = 0x2fe000
> +!endif
> +
> [FD.XEN_EFI]
> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize
> ErasePolarity = 1
>
> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> BlockSize = 0x00001000
> -NumBlocks = 0x200
> +NumBlocks = $(FD_NUM_BLOCKS)
>
> ################################################################################
> #
> @@ -81,7 +89,7 @@ DATA = {
> !endif
> }
>
> -0x00002000|0x001fe000
> +0x00002000|$(FVMAIN_COMPACT_SIZE)
> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> FV = FVMAIN_COMPACT
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-12 14:46 ` Laszlo Ersek
@ 2019-09-12 14:47 ` Laszlo Ersek
2019-09-12 14:53 ` Ard Biesheuvel
1 sibling, 0 replies; 9+ messages in thread
From: Laszlo Ersek @ 2019-09-12 14:47 UTC (permalink / raw)
To: Ard Biesheuvel, devel; +Cc: leif.lindholm, philmd
On 09/12/19 16:46, Laszlo Ersek wrote:
> On 09/11/19 18:23, Ard Biesheuvel wrote:
>> After upgrading the CI system we use for building the ArmVirtPkg
>> targets, we started seeing failures due to the NOOPT build running
>> out of space when using the CLANG38 toolchain definition combined
>> with clang 7.
>>
>> We really don't want to increase the FD/FV sizes in general to
>> accommodate this, so parameterize the relevant quantities and
>> increase them by 50% for NOOPT builds.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>> v2: implement suggestions by Laszlo on 1) how to parameterize this further,
>> and b) to avoid adding another .inc file
>> update kernel header field, as pointed out by Philippe
> (1) s/for NOOPT builds/with -D FD_SIZE_3MB/ in the commit message
(there are two instances: subject line, and commit message body)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-12 14:46 ` Laszlo Ersek
2019-09-12 14:47 ` Laszlo Ersek
@ 2019-09-12 14:53 ` Ard Biesheuvel
1 sibling, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2019-09-12 14:53 UTC (permalink / raw)
To: Laszlo Ersek
Cc: edk2-devel-groups-io, Leif Lindholm, Philippe Mathieu-Daudé
On Thu, 12 Sep 2019 at 15:46, Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 09/11/19 18:23, Ard Biesheuvel wrote:
> > After upgrading the CI system we use for building the ArmVirtPkg
> > targets, we started seeing failures due to the NOOPT build running
> > out of space when using the CLANG38 toolchain definition combined
> > with clang 7.
> >
> > We really don't want to increase the FD/FV sizes in general to
> > accommodate this, so parameterize the relevant quantities and
> > increase them by 50% for NOOPT builds.
> >
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> > v2: implement suggestions by Laszlo on 1) how to parameterize this further,
> > and b) to avoid adding another .inc file
> > update kernel header field, as pointed out by Philippe
> >
> > ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
> > ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
> > ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
> > ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
> > 4 files changed, 66 insertions(+), 9 deletions(-)
> >
> > diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> > index a4ae25d982a2..d6b58e5c018b 100644
> > --- a/ArmVirtPkg/ArmVirt.dsc.inc
> > +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> > @@ -10,6 +10,34 @@
> > [Defines]
> > DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
> >
> > + #
> > + # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
> > + # one of the supported values, in place of any of the convenience macros, is
> > + # permitted.
> > + #
> > +!if $(TARGET) == NOOPT
> > + DEFINE FD_SIZE_3MB = TRUE
> > +!endif
>
> Sorry, I must have been unclear -- I meant the macros FD_SIZE_2MB /
> FD_SIZE_3MB / FD_SIZE_IN_KB as a replacement for the $(TARGET) based
> logic, not as an addition to it.
>
> Is it important to select the 3MB build by default, in case "-b NOOPT"
> is given on the build command line?
>
Yes.
> My thinking was that, in your CI env, you could pass -D FD_SIZE_3MB
> specifically, whenever you build for -b NOOPT. Other users building for
> -b NOOPT would see no change.
>
> My suggestion would be:
>
> (1) s/for NOOPT builds/with -D FD_SIZE_3MB/ in the commit message
>
> (2) drop the above three lines (the TARGET-based conditional)
>
> With those:
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> and you could go ahead and push the patch (no repost needed).
>
> OTOH, if you'd really like to set 3MB for NOOPT automatically, then I
> think we'll need a way for letting users override that new default, back
> to 2MB.
>
> ... Or is such an override possible with this patch already, perhaps?
>
Yes. If you set -b NOOPT -D FD_SIZE_2MB (in any order), you will get a
2 MB image.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-11 16:23 [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds Ard Biesheuvel
2019-09-12 14:46 ` Laszlo Ersek
@ 2019-09-12 15:20 ` Philippe Mathieu-Daudé
2019-09-12 16:50 ` Ard Biesheuvel
1 sibling, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-12 15:20 UTC (permalink / raw)
To: Ard Biesheuvel, devel; +Cc: leif.lindholm, lersek
Hi Ard,
On 9/11/19 6:23 PM, Ard Biesheuvel wrote:
> After upgrading the CI system we use for building the ArmVirtPkg
> targets, we started seeing failures due to the NOOPT build running
> out of space when using the CLANG38 toolchain definition combined
> with clang 7.
>
> We really don't want to increase the FD/FV sizes in general to
> accommodate this, so parameterize the relevant quantities and
> increase them by 50% for NOOPT builds.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> v2: implement suggestions by Laszlo on 1) how to parameterize this further,
> and b) to avoid adding another .inc file
> update kernel header field, as pointed out by Philippe
>
> ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
> ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
> ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
> ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
> 4 files changed, 66 insertions(+), 9 deletions(-)
>
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index a4ae25d982a2..d6b58e5c018b 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -10,6 +10,34 @@
> [Defines]
> DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
>
> + #
> + # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
> + # one of the supported values, in place of any of the convenience macros, is
> + # permitted.
> + #
> +!if $(TARGET) == NOOPT
> + DEFINE FD_SIZE_3MB = TRUE
> +!endif
> +
> +!ifdef $(FD_SIZE_2MB)
> + DEFINE FD_SIZE_IN_KB = 2048
> +!else
> +!ifdef $(FD_SIZE_3MB)
> + DEFINE FD_SIZE_IN_KB = 3072
> +!else
> + DEFINE FD_SIZE_IN_KB = 2048
> +!endif
> +!endif
> +
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FD_SIZE = 0x200000
> + DEFINE FD_NUM_BLOCKS = 0x200
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FD_SIZE = 0x300000
> + DEFINE FD_NUM_BLOCKS = 0x300
> +!endif
> +
> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
> GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
>
> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
> index c2169cb7964b..d3950c8be05e 100644
> --- a/ArmVirtPkg/ArmVirtQemu.fdf
> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
> @@ -20,14 +20,22 @@
> #
> ################################################################################
>
> +[Defines]
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000
> +!endif
> +
> [FD.QEMU_EFI]
> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> ErasePolarity = 1
>
> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> BlockSize = 0x00001000
> -NumBlocks = 0x200
> +NumBlocks = $(FD_NUM_BLOCKS)
>
> ################################################################################
> #
> @@ -59,7 +67,7 @@ DATA = {
> !endif
> }
>
> -0x00001000|0x001ff000
> +0x00001000|$(FVMAIN_COMPACT_SIZE)
> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> FV = FVMAIN_COMPACT
>
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> index f675b6d65ee1..46ec967e1cc0 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> @@ -20,14 +20,22 @@
> #
> ################################################################################
>
> +[Defines]
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
> +!endif
> +
> [FD.QEMU_EFI]
> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> ErasePolarity = 1
>
> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> BlockSize = 0x00001000
> -NumBlocks = 0x200
> +NumBlocks = $(FD_NUM_BLOCKS)
>
> ################################################################################
> #
> @@ -56,7 +64,12 @@ DATA = {
> 0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
> 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
> 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
> +!if $(FD_SIZE_IN_KB) == 2048
> 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
> +!endif
Ah, I was thinking of some inplace endian swapping
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
> @@ -81,7 +94,7 @@ DATA = {
You forgot Aarch32:
0x00, 0x00, 0x20, 0x00, # image size: 2 MB
0x01, 0x02, 0x03, 0x04 # endiannness flag
> !endif
> }
>
> -0x00008000|0x001f8000
> +0x00008000|$(FVMAIN_COMPACT_SIZE)
> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> FV = FVMAIN_COMPACT
>
> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> index 79f681cde028..2bbb64abde6b 100644
> --- a/ArmVirtPkg/ArmVirtXen.fdf
> +++ b/ArmVirtPkg/ArmVirtXen.fdf
Same 'image size' changes apply to this file too :(
> @@ -20,14 +20,22 @@
> #
> ################################################################################
>
> +[Defines]
> +!if $(FD_SIZE_IN_KB) == 2048
> + DEFINE FVMAIN_COMPACT_SIZE = 0x1fe000
> +!endif
> +!if $(FD_SIZE_IN_KB) == 3072
> + DEFINE FVMAIN_COMPACT_SIZE = 0x2fe000
> +!endif
> +
> [FD.XEN_EFI]
> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize
> ErasePolarity = 1
>
> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> BlockSize = 0x00001000
> -NumBlocks = 0x200
> +NumBlocks = $(FD_NUM_BLOCKS)
>
> ################################################################################
> #
> @@ -81,7 +89,7 @@ DATA = {
> !endif
> }
>
> -0x00002000|0x001fe000
> +0x00002000|$(FVMAIN_COMPACT_SIZE)
> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> FV = FVMAIN_COMPACT
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-12 15:20 ` Philippe Mathieu-Daudé
@ 2019-09-12 16:50 ` Ard Biesheuvel
2019-09-12 17:05 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 9+ messages in thread
From: Ard Biesheuvel @ 2019-09-12 16:50 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: edk2-devel-groups-io, Leif Lindholm, Laszlo Ersek
On Thu, 12 Sep 2019 at 16:20, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Hi Ard,
>
> On 9/11/19 6:23 PM, Ard Biesheuvel wrote:
> > After upgrading the CI system we use for building the ArmVirtPkg
> > targets, we started seeing failures due to the NOOPT build running
> > out of space when using the CLANG38 toolchain definition combined
> > with clang 7.
> >
> > We really don't want to increase the FD/FV sizes in general to
> > accommodate this, so parameterize the relevant quantities and
> > increase them by 50% for NOOPT builds.
> >
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> > v2: implement suggestions by Laszlo on 1) how to parameterize this further,
> > and b) to avoid adding another .inc file
> > update kernel header field, as pointed out by Philippe
> >
> > ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
> > ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
> > ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
> > ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
> > 4 files changed, 66 insertions(+), 9 deletions(-)
> >
> > diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> > index a4ae25d982a2..d6b58e5c018b 100644
> > --- a/ArmVirtPkg/ArmVirt.dsc.inc
> > +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> > @@ -10,6 +10,34 @@
> > [Defines]
> > DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
> >
> > + #
> > + # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
> > + # one of the supported values, in place of any of the convenience macros, is
> > + # permitted.
> > + #
> > +!if $(TARGET) == NOOPT
> > + DEFINE FD_SIZE_3MB = TRUE
> > +!endif
> > +
> > +!ifdef $(FD_SIZE_2MB)
> > + DEFINE FD_SIZE_IN_KB = 2048
> > +!else
> > +!ifdef $(FD_SIZE_3MB)
> > + DEFINE FD_SIZE_IN_KB = 3072
> > +!else
> > + DEFINE FD_SIZE_IN_KB = 2048
> > +!endif
> > +!endif
> > +
> > +!if $(FD_SIZE_IN_KB) == 2048
> > + DEFINE FD_SIZE = 0x200000
> > + DEFINE FD_NUM_BLOCKS = 0x200
> > +!endif
> > +!if $(FD_SIZE_IN_KB) == 3072
> > + DEFINE FD_SIZE = 0x300000
> > + DEFINE FD_NUM_BLOCKS = 0x300
> > +!endif
> > +
> > [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
> > GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
> >
> > diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
> > index c2169cb7964b..d3950c8be05e 100644
> > --- a/ArmVirtPkg/ArmVirtQemu.fdf
> > +++ b/ArmVirtPkg/ArmVirtQemu.fdf
> > @@ -20,14 +20,22 @@
> > #
> > ################################################################################
> >
> > +[Defines]
> > +!if $(FD_SIZE_IN_KB) == 2048
> > + DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000
> > +!endif
> > +!if $(FD_SIZE_IN_KB) == 3072
> > + DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000
> > +!endif
> > +
> > [FD.QEMU_EFI]
> > BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> > -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> > +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> > ErasePolarity = 1
> >
> > # This one is tricky, it must be: BlockSize * NumBlocks = Size
> > BlockSize = 0x00001000
> > -NumBlocks = 0x200
> > +NumBlocks = $(FD_NUM_BLOCKS)
> >
> > ################################################################################
> > #
> > @@ -59,7 +67,7 @@ DATA = {
> > !endif
> > }
> >
> > -0x00001000|0x001ff000
> > +0x00001000|$(FVMAIN_COMPACT_SIZE)
> > gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> > FV = FVMAIN_COMPACT
> >
> > diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> > index f675b6d65ee1..46ec967e1cc0 100644
> > --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
> > +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> > @@ -20,14 +20,22 @@
> > #
> > ################################################################################
> >
> > +[Defines]
> > +!if $(FD_SIZE_IN_KB) == 2048
> > + DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
> > +!endif
> > +!if $(FD_SIZE_IN_KB) == 3072
> > + DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
> > +!endif
> > +
> > [FD.QEMU_EFI]
> > BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> > -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> > +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> > ErasePolarity = 1
> >
> > # This one is tricky, it must be: BlockSize * NumBlocks = Size
> > BlockSize = 0x00001000
> > -NumBlocks = 0x200
> > +NumBlocks = $(FD_NUM_BLOCKS)
> >
> > ################################################################################
> > #
> > @@ -56,7 +64,12 @@ DATA = {
> > 0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
> > 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
> > 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
> > +!if $(FD_SIZE_IN_KB) == 2048
> > 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
> > +!endif
> > +!if $(FD_SIZE_IN_KB) == 3072
> > + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
> > +!endif
>
> Ah, I was thinking of some inplace endian swapping
>
If you can make it work, patches welcome :-)
> > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
> > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
> > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
> > @@ -81,7 +94,7 @@ DATA = {
>
> You forgot Aarch32:
>
> 0x00, 0x00, 0x20, 0x00, # image size: 2 MB
>
> 0x01, 0x02, 0x03, 0x04 # endiannness flag
>
>
> > !endif
> > }
> >
> > -0x00008000|0x001f8000
> > +0x00008000|$(FVMAIN_COMPACT_SIZE)
> > gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> > FV = FVMAIN_COMPACT
> >
> > diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> > index 79f681cde028..2bbb64abde6b 100644
> > --- a/ArmVirtPkg/ArmVirtXen.fdf
> > +++ b/ArmVirtPkg/ArmVirtXen.fdf
>
> Same 'image size' changes apply to this file too :(
>
Thanks for spotting that.
> > @@ -20,14 +20,22 @@
> > #
> > ################################################################################
> >
> > +[Defines]
> > +!if $(FD_SIZE_IN_KB) == 2048
> > + DEFINE FVMAIN_COMPACT_SIZE = 0x1fe000
> > +!endif
> > +!if $(FD_SIZE_IN_KB) == 3072
> > + DEFINE FVMAIN_COMPACT_SIZE = 0x2fe000
> > +!endif
> > +
> > [FD.XEN_EFI]
> > BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
> > -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
> > +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize
> > ErasePolarity = 1
> >
> > # This one is tricky, it must be: BlockSize * NumBlocks = Size
> > BlockSize = 0x00001000
> > -NumBlocks = 0x200
> > +NumBlocks = $(FD_NUM_BLOCKS)
> >
> > ################################################################################
> > #
> > @@ -81,7 +89,7 @@ DATA = {
> > !endif
> > }
> >
> > -0x00002000|0x001fe000
> > +0x00002000|$(FVMAIN_COMPACT_SIZE)
> > gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> > FV = FVMAIN_COMPACT
> >
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-12 16:50 ` Ard Biesheuvel
@ 2019-09-12 17:05 ` Philippe Mathieu-Daudé
2019-09-12 17:13 ` Ard Biesheuvel
0 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-12 17:05 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: edk2-devel-groups-io, Leif Lindholm, Laszlo Ersek
On 9/12/19 6:50 PM, Ard Biesheuvel wrote:
> On Thu, 12 Sep 2019 at 16:20, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Hi Ard,
>>
>> On 9/11/19 6:23 PM, Ard Biesheuvel wrote:
>>> After upgrading the CI system we use for building the ArmVirtPkg
>>> targets, we started seeing failures due to the NOOPT build running
>>> out of space when using the CLANG38 toolchain definition combined
>>> with clang 7.
>>>
>>> We really don't want to increase the FD/FV sizes in general to
>>> accommodate this, so parameterize the relevant quantities and
>>> increase them by 50% for NOOPT builds.
>>>
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>> ---
>>> v2: implement suggestions by Laszlo on 1) how to parameterize this further,
>>> and b) to avoid adding another .inc file
>>> update kernel header field, as pointed out by Philippe
>>>
>>> ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
>>> ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
>>> ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
>>> ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
>>> 4 files changed, 66 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
>>> index a4ae25d982a2..d6b58e5c018b 100644
>>> --- a/ArmVirtPkg/ArmVirt.dsc.inc
>>> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
>>> @@ -10,6 +10,34 @@
>>> [Defines]
>>> DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
>>>
>>> + #
>>> + # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
>>> + # one of the supported values, in place of any of the convenience macros, is
>>> + # permitted.
>>> + #
>>> +!if $(TARGET) == NOOPT
>>> + DEFINE FD_SIZE_3MB = TRUE
>>> +!endif
>>> +
>>> +!ifdef $(FD_SIZE_2MB)
>>> + DEFINE FD_SIZE_IN_KB = 2048
>>> +!else
>>> +!ifdef $(FD_SIZE_3MB)
>>> + DEFINE FD_SIZE_IN_KB = 3072
>>> +!else
>>> + DEFINE FD_SIZE_IN_KB = 2048
>>> +!endif
>>> +!endif
>>> +
>>> +!if $(FD_SIZE_IN_KB) == 2048
>>> + DEFINE FD_SIZE = 0x200000
>>> + DEFINE FD_NUM_BLOCKS = 0x200
>>> +!endif
>>> +!if $(FD_SIZE_IN_KB) == 3072
>>> + DEFINE FD_SIZE = 0x300000
>>> + DEFINE FD_NUM_BLOCKS = 0x300
>>> +!endif
>>> +
>>> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
>>> GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
>>>
>>> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
>>> index c2169cb7964b..d3950c8be05e 100644
>>> --- a/ArmVirtPkg/ArmVirtQemu.fdf
>>> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
>>> @@ -20,14 +20,22 @@
>>> #
>>> ################################################################################
>>>
>>> +[Defines]
>>> +!if $(FD_SIZE_IN_KB) == 2048
>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000
>>> +!endif
>>> +!if $(FD_SIZE_IN_KB) == 3072
>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000
>>> +!endif
>>> +
>>> [FD.QEMU_EFI]
>>> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
>>> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>> ErasePolarity = 1
>>>
>>> # This one is tricky, it must be: BlockSize * NumBlocks = Size
>>> BlockSize = 0x00001000
>>> -NumBlocks = 0x200
>>> +NumBlocks = $(FD_NUM_BLOCKS)
>>>
>>> ################################################################################
>>> #
>>> @@ -59,7 +67,7 @@ DATA = {
>>> !endif
>>> }
>>>
>>> -0x00001000|0x001ff000
>>> +0x00001000|$(FVMAIN_COMPACT_SIZE)
>>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
>>> FV = FVMAIN_COMPACT
>>>
>>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
>>> index f675b6d65ee1..46ec967e1cc0 100644
>>> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
>>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
>>> @@ -20,14 +20,22 @@
>>> #
>>> ################################################################################
>>>
>>> +[Defines]
>>> +!if $(FD_SIZE_IN_KB) == 2048
>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
>>> +!endif
>>> +!if $(FD_SIZE_IN_KB) == 3072
>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
>>> +!endif
>>> +
>>> [FD.QEMU_EFI]
>>> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
>>> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>> ErasePolarity = 1
>>>
>>> # This one is tricky, it must be: BlockSize * NumBlocks = Size
>>> BlockSize = 0x00001000
>>> -NumBlocks = 0x200
>>> +NumBlocks = $(FD_NUM_BLOCKS)
>>>
>>> ################################################################################
>>> #
>>> @@ -56,7 +64,12 @@ DATA = {
>>> 0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
>>> 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
>>> 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
>>> +!if $(FD_SIZE_IN_KB) == 2048
>>> 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
>>> +!endif
>>> +!if $(FD_SIZE_IN_KB) == 3072
>>> + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
>>> +!endif
>>
>> Ah, I was thinking of some inplace endian swapping
>>
>
> If you can make it work, patches welcome :-)
I was thinking of this:
0xf6, 0x1f, 0x00, 0xea, # b 0x8000
0x18, 0x28, 0x6f, 0x01, # magic
0x00, 0x00, 0x00, 0x00, # start
((($(FD_SIZE)) & 0x000000ff) << 24), # image size
((($(FD_SIZE)) & 0x0000ff00) << 8),
((($(FD_SIZE)) & 0x00ff0000) >> 8),
((($(FD_SIZE)) & 0xff000000) >> 24),
0x01, 0x02, 0x03, 0x04 # endiannness flag
But now that I look at it, I realize it is uglier to review than your
if/endif...
>>> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
>>> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
>>> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
>>> @@ -81,7 +94,7 @@ DATA = {
>>
>> You forgot Aarch32:
>>
>> 0x00, 0x00, 0x20, 0x00, # image size: 2 MB
>>
>> 0x01, 0x02, 0x03, 0x04 # endiannness flag
>>
>>
>>> !endif
>>> }
>>>
>>> -0x00008000|0x001f8000
>>> +0x00008000|$(FVMAIN_COMPACT_SIZE)
>>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
>>> FV = FVMAIN_COMPACT
>>>
>>> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
>>> index 79f681cde028..2bbb64abde6b 100644
>>> --- a/ArmVirtPkg/ArmVirtXen.fdf
>>> +++ b/ArmVirtPkg/ArmVirtXen.fdf
>>
>> Same 'image size' changes apply to this file too :(
>>
>
> Thanks for spotting that.
>
>>> @@ -20,14 +20,22 @@
>>> #
>>> ################################################################################
>>>
>>> +[Defines]
>>> +!if $(FD_SIZE_IN_KB) == 2048
>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x1fe000
>>> +!endif
>>> +!if $(FD_SIZE_IN_KB) == 3072
>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x2fe000
>>> +!endif
>>> +
>>> [FD.XEN_EFI]
>>> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
>>> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
>>> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize
>>> ErasePolarity = 1
>>>
>>> # This one is tricky, it must be: BlockSize * NumBlocks = Size
>>> BlockSize = 0x00001000
>>> -NumBlocks = 0x200
>>> +NumBlocks = $(FD_NUM_BLOCKS)
>>>
>>> ################################################################################
>>> #
>>> @@ -81,7 +89,7 @@ DATA = {
>>> !endif
>>> }
>>>
>>> -0x00002000|0x001fe000
>>> +0x00002000|$(FVMAIN_COMPACT_SIZE)
>>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
>>> FV = FVMAIN_COMPACT
>>>
>>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-12 17:05 ` Philippe Mathieu-Daudé
@ 2019-09-12 17:13 ` Ard Biesheuvel
2019-09-12 17:14 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 9+ messages in thread
From: Ard Biesheuvel @ 2019-09-12 17:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: edk2-devel-groups-io, Leif Lindholm, Laszlo Ersek
On Thu, 12 Sep 2019 at 18:05, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> On 9/12/19 6:50 PM, Ard Biesheuvel wrote:
> > On Thu, 12 Sep 2019 at 16:20, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> >>
> >> Hi Ard,
> >>
> >> On 9/11/19 6:23 PM, Ard Biesheuvel wrote:
> >>> After upgrading the CI system we use for building the ArmVirtPkg
> >>> targets, we started seeing failures due to the NOOPT build running
> >>> out of space when using the CLANG38 toolchain definition combined
> >>> with clang 7.
> >>>
> >>> We really don't want to increase the FD/FV sizes in general to
> >>> accommodate this, so parameterize the relevant quantities and
> >>> increase them by 50% for NOOPT builds.
> >>>
> >>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> >>> ---
> >>> v2: implement suggestions by Laszlo on 1) how to parameterize this further,
> >>> and b) to avoid adding another .inc file
> >>> update kernel header field, as pointed out by Philippe
> >>>
> >>> ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
> >>> ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
> >>> ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
> >>> ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
> >>> 4 files changed, 66 insertions(+), 9 deletions(-)
> >>>
> >>> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> >>> index a4ae25d982a2..d6b58e5c018b 100644
> >>> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> >>> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> >>> @@ -10,6 +10,34 @@
> >>> [Defines]
> >>> DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
> >>>
> >>> + #
> >>> + # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
> >>> + # one of the supported values, in place of any of the convenience macros, is
> >>> + # permitted.
> >>> + #
> >>> +!if $(TARGET) == NOOPT
> >>> + DEFINE FD_SIZE_3MB = TRUE
> >>> +!endif
> >>> +
> >>> +!ifdef $(FD_SIZE_2MB)
> >>> + DEFINE FD_SIZE_IN_KB = 2048
> >>> +!else
> >>> +!ifdef $(FD_SIZE_3MB)
> >>> + DEFINE FD_SIZE_IN_KB = 3072
> >>> +!else
> >>> + DEFINE FD_SIZE_IN_KB = 2048
> >>> +!endif
> >>> +!endif
> >>> +
> >>> +!if $(FD_SIZE_IN_KB) == 2048
> >>> + DEFINE FD_SIZE = 0x200000
> >>> + DEFINE FD_NUM_BLOCKS = 0x200
> >>> +!endif
> >>> +!if $(FD_SIZE_IN_KB) == 3072
> >>> + DEFINE FD_SIZE = 0x300000
> >>> + DEFINE FD_NUM_BLOCKS = 0x300
> >>> +!endif
> >>> +
> >>> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
> >>> GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
> >>>
> >>> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
> >>> index c2169cb7964b..d3950c8be05e 100644
> >>> --- a/ArmVirtPkg/ArmVirtQemu.fdf
> >>> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
> >>> @@ -20,14 +20,22 @@
> >>> #
> >>> ################################################################################
> >>>
> >>> +[Defines]
> >>> +!if $(FD_SIZE_IN_KB) == 2048
> >>> + DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000
> >>> +!endif
> >>> +!if $(FD_SIZE_IN_KB) == 3072
> >>> + DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000
> >>> +!endif
> >>> +
> >>> [FD.QEMU_EFI]
> >>> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> >>> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> >>> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> >>> ErasePolarity = 1
> >>>
> >>> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> >>> BlockSize = 0x00001000
> >>> -NumBlocks = 0x200
> >>> +NumBlocks = $(FD_NUM_BLOCKS)
> >>>
> >>> ################################################################################
> >>> #
> >>> @@ -59,7 +67,7 @@ DATA = {
> >>> !endif
> >>> }
> >>>
> >>> -0x00001000|0x001ff000
> >>> +0x00001000|$(FVMAIN_COMPACT_SIZE)
> >>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> >>> FV = FVMAIN_COMPACT
> >>>
> >>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> >>> index f675b6d65ee1..46ec967e1cc0 100644
> >>> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
> >>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
> >>> @@ -20,14 +20,22 @@
> >>> #
> >>> ################################################################################
> >>>
> >>> +[Defines]
> >>> +!if $(FD_SIZE_IN_KB) == 2048
> >>> + DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
> >>> +!endif
> >>> +!if $(FD_SIZE_IN_KB) == 3072
> >>> + DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
> >>> +!endif
> >>> +
> >>> [FD.QEMU_EFI]
> >>> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
> >>> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> >>> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
> >>> ErasePolarity = 1
> >>>
> >>> # This one is tricky, it must be: BlockSize * NumBlocks = Size
> >>> BlockSize = 0x00001000
> >>> -NumBlocks = 0x200
> >>> +NumBlocks = $(FD_NUM_BLOCKS)
> >>>
> >>> ################################################################################
> >>> #
> >>> @@ -56,7 +64,12 @@ DATA = {
> >>> 0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
> >>> 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
> >>> 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
> >>> +!if $(FD_SIZE_IN_KB) == 2048
> >>> 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
> >>> +!endif
> >>> +!if $(FD_SIZE_IN_KB) == 3072
> >>> + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
> >>> +!endif
> >>
> >> Ah, I was thinking of some inplace endian swapping
> >>
> >
> > If you can make it work, patches welcome :-)
>
> I was thinking of this:
>
> 0xf6, 0x1f, 0x00, 0xea, # b 0x8000
>
> 0x18, 0x28, 0x6f, 0x01, # magic
>
> 0x00, 0x00, 0x00, 0x00, # start
>
> ((($(FD_SIZE)) & 0x000000ff) << 24), # image size
>
> ((($(FD_SIZE)) & 0x0000ff00) << 8),
>
> ((($(FD_SIZE)) & 0x00ff0000) >> 8),
>
> ((($(FD_SIZE)) & 0xff000000) >> 24),
>
> 0x01, 0x02, 0x03, 0x04 # endiannness flag
>
>
> But now that I look at it, I realize it is uglier to review than your
> if/endif...
>
Does the .fdf parser even support that kind of arithmetic? :-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds
2019-09-12 17:13 ` Ard Biesheuvel
@ 2019-09-12 17:14 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-12 17:14 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: edk2-devel-groups-io, Leif Lindholm, Laszlo Ersek
On 9/12/19 7:13 PM, Ard Biesheuvel wrote:
> On Thu, 12 Sep 2019 at 18:05, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> On 9/12/19 6:50 PM, Ard Biesheuvel wrote:
>>> On Thu, 12 Sep 2019 at 16:20, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>>>
>>>> Hi Ard,
>>>>
>>>> On 9/11/19 6:23 PM, Ard Biesheuvel wrote:
>>>>> After upgrading the CI system we use for building the ArmVirtPkg
>>>>> targets, we started seeing failures due to the NOOPT build running
>>>>> out of space when using the CLANG38 toolchain definition combined
>>>>> with clang 7.
>>>>>
>>>>> We really don't want to increase the FD/FV sizes in general to
>>>>> accommodate this, so parameterize the relevant quantities and
>>>>> increase them by 50% for NOOPT builds.
>>>>>
>>>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>>>> ---
>>>>> v2: implement suggestions by Laszlo on 1) how to parameterize this further,
>>>>> and b) to avoid adding another .inc file
>>>>> update kernel header field, as pointed out by Philippe
>>>>>
>>>>> ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++
>>>>> ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++---
>>>>> ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++---
>>>>> ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++---
>>>>> 4 files changed, 66 insertions(+), 9 deletions(-)
>>>>>
>>>>> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
>>>>> index a4ae25d982a2..d6b58e5c018b 100644
>>>>> --- a/ArmVirtPkg/ArmVirt.dsc.inc
>>>>> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
>>>>> @@ -10,6 +10,34 @@
>>>>> [Defines]
>>>>> DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
>>>>>
>>>>> + #
>>>>> + # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
>>>>> + # one of the supported values, in place of any of the convenience macros, is
>>>>> + # permitted.
>>>>> + #
>>>>> +!if $(TARGET) == NOOPT
>>>>> + DEFINE FD_SIZE_3MB = TRUE
>>>>> +!endif
>>>>> +
>>>>> +!ifdef $(FD_SIZE_2MB)
>>>>> + DEFINE FD_SIZE_IN_KB = 2048
>>>>> +!else
>>>>> +!ifdef $(FD_SIZE_3MB)
>>>>> + DEFINE FD_SIZE_IN_KB = 3072
>>>>> +!else
>>>>> + DEFINE FD_SIZE_IN_KB = 2048
>>>>> +!endif
>>>>> +!endif
>>>>> +
>>>>> +!if $(FD_SIZE_IN_KB) == 2048
>>>>> + DEFINE FD_SIZE = 0x200000
>>>>> + DEFINE FD_NUM_BLOCKS = 0x200
>>>>> +!endif
>>>>> +!if $(FD_SIZE_IN_KB) == 3072
>>>>> + DEFINE FD_SIZE = 0x300000
>>>>> + DEFINE FD_NUM_BLOCKS = 0x300
>>>>> +!endif
>>>>> +
>>>>> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
>>>>> GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
>>>>>
>>>>> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
>>>>> index c2169cb7964b..d3950c8be05e 100644
>>>>> --- a/ArmVirtPkg/ArmVirtQemu.fdf
>>>>> +++ b/ArmVirtPkg/ArmVirtQemu.fdf
>>>>> @@ -20,14 +20,22 @@
>>>>> #
>>>>> ################################################################################
>>>>>
>>>>> +[Defines]
>>>>> +!if $(FD_SIZE_IN_KB) == 2048
>>>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000
>>>>> +!endif
>>>>> +!if $(FD_SIZE_IN_KB) == 3072
>>>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000
>>>>> +!endif
>>>>> +
>>>>> [FD.QEMU_EFI]
>>>>> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
>>>>> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>>>> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>>>> ErasePolarity = 1
>>>>>
>>>>> # This one is tricky, it must be: BlockSize * NumBlocks = Size
>>>>> BlockSize = 0x00001000
>>>>> -NumBlocks = 0x200
>>>>> +NumBlocks = $(FD_NUM_BLOCKS)
>>>>>
>>>>> ################################################################################
>>>>> #
>>>>> @@ -59,7 +67,7 @@ DATA = {
>>>>> !endif
>>>>> }
>>>>>
>>>>> -0x00001000|0x001ff000
>>>>> +0x00001000|$(FVMAIN_COMPACT_SIZE)
>>>>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
>>>>> FV = FVMAIN_COMPACT
>>>>>
>>>>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
>>>>> index f675b6d65ee1..46ec967e1cc0 100644
>>>>> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
>>>>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
>>>>> @@ -20,14 +20,22 @@
>>>>> #
>>>>> ################################################################################
>>>>>
>>>>> +[Defines]
>>>>> +!if $(FD_SIZE_IN_KB) == 2048
>>>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
>>>>> +!endif
>>>>> +!if $(FD_SIZE_IN_KB) == 3072
>>>>> + DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
>>>>> +!endif
>>>>> +
>>>>> [FD.QEMU_EFI]
>>>>> BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
>>>>> -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>>>> +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
>>>>> ErasePolarity = 1
>>>>>
>>>>> # This one is tricky, it must be: BlockSize * NumBlocks = Size
>>>>> BlockSize = 0x00001000
>>>>> -NumBlocks = 0x200
>>>>> +NumBlocks = $(FD_NUM_BLOCKS)
>>>>>
>>>>> ################################################################################
>>>>> #
>>>>> @@ -56,7 +64,12 @@ DATA = {
>>>>> 0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
>>>>> 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
>>>>> 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
>>>>> +!if $(FD_SIZE_IN_KB) == 2048
>>>>> 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
>>>>> +!endif
>>>>> +!if $(FD_SIZE_IN_KB) == 3072
>>>>> + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
>>>>> +!endif
>>>>
>>>> Ah, I was thinking of some inplace endian swapping
>>>>
>>>
>>> If you can make it work, patches welcome :-)
>>
>> I was thinking of this:
>>
>> 0xf6, 0x1f, 0x00, 0xea, # b 0x8000
>>
>> 0x18, 0x28, 0x6f, 0x01, # magic
>>
>> 0x00, 0x00, 0x00, 0x00, # start
>>
>> ((($(FD_SIZE)) & 0x000000ff) << 24), # image size
>>
>> ((($(FD_SIZE)) & 0x0000ff00) << 8),
>>
>> ((($(FD_SIZE)) & 0x00ff0000) >> 8),
>>
>> ((($(FD_SIZE)) & 0xff000000) >> 24),
>>
>> 0x01, 0x02, 0x03, 0x04 # endiannness flag
>>
>>
>> But now that I look at it, I realize it is uglier to review than your
>> if/endif...
>>
>
> Does the .fdf parser even support that kind of arithmetic? :-)
No =)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-09-12 17:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-11 16:23 [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds Ard Biesheuvel
2019-09-12 14:46 ` Laszlo Ersek
2019-09-12 14:47 ` Laszlo Ersek
2019-09-12 14:53 ` Ard Biesheuvel
2019-09-12 15:20 ` Philippe Mathieu-Daudé
2019-09-12 16:50 ` Ard Biesheuvel
2019-09-12 17:05 ` Philippe Mathieu-Daudé
2019-09-12 17:13 ` Ard Biesheuvel
2019-09-12 17:14 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox