]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: introduce the FD_SIZE_IN_KB macro / build flag
authorLaszlo Ersek <lersek@redhat.com>
Wed, 3 May 2017 15:54:49 +0000 (17:54 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 4 May 2017 22:55:40 +0000 (00:55 +0200)
FD_SIZE_xMB defines have existed for flash size selection. They can be
passed as "-D FD_SIZE_xMB" on the command line. Passing multiple of them
at the same time has never been supported; earlier settings on the command
line cannot be overridden.

Introduce the integer valued FD_SIZE_IN_KB macro, which provides the
following improvements:

- several instances of it are permitted on the command line, with the last
  one taking effect,

- conditional statements in the DSC and FDF files need only check a single
  macro, and multiple values can be checked in a single !if with the ||
  operator,

- nested !ifdef / !else ladders can be replaced with flat equality tests,

- in the future, flash sizes can be expressed with a finer than MB
  granularity, if necessary.

For now, we're going to preserve the FD_SIZE_xMB defines as convenience
wrappers for FD_SIZE_IN_KB.

FD_SIZE_IN_KB is being added to the DSC files because this way we can
depend on it in both the DSC and FDF files.

Cc: Gary Ching-Pang Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/OvmfPkg.fdf.inc
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc

index 9cc0578d64303cee912525a501290368d59e7af6..f12d61c2b682005080d0685c47a22e591ce11cde 100644 (file)
 #\r
 ##\r
 \r
 #\r
 ##\r
 \r
-#\r
-# Default flash size is 2MB.\r
-#\r
-# Defining FD_SIZE_1MB on the build command line can override this.\r
-#\r
-\r
 DEFINE BLOCK_SIZE        = 0x1000\r
 DEFINE VARS_SIZE         = 0x20000\r
 DEFINE VARS_BLOCKS       = 0x20\r
 \r
 DEFINE BLOCK_SIZE        = 0x1000\r
 DEFINE VARS_SIZE         = 0x20000\r
 DEFINE VARS_BLOCKS       = 0x20\r
 \r
-!ifdef $(FD_SIZE_1MB)\r
-\r
+!if $(FD_SIZE_IN_KB) == 1024\r
 DEFINE FW_BASE_ADDRESS   = 0xFFF00000\r
 DEFINE FW_SIZE           = 0x00100000\r
 DEFINE FW_BLOCKS         = 0x100\r
 DEFINE FW_BASE_ADDRESS   = 0xFFF00000\r
 DEFINE FW_SIZE           = 0x00100000\r
 DEFINE FW_BLOCKS         = 0x100\r
@@ -36,9 +29,9 @@ DEFINE CODE_BLOCKS       = 0xE0
 DEFINE FVMAIN_SIZE       = 0x000CC000\r
 DEFINE SECFV_OFFSET      = 0x000EC000\r
 DEFINE SECFV_SIZE        = 0x14000\r
 DEFINE FVMAIN_SIZE       = 0x000CC000\r
 DEFINE SECFV_OFFSET      = 0x000EC000\r
 DEFINE SECFV_SIZE        = 0x14000\r
+!endif\r
 \r
 \r
-!else\r
-\r
+!if $(FD_SIZE_IN_KB) == 2048\r
 DEFINE FW_BASE_ADDRESS   = 0xFFE00000\r
 DEFINE FW_SIZE           = 0x00200000\r
 DEFINE FW_BLOCKS         = 0x200\r
 DEFINE FW_BASE_ADDRESS   = 0xFFE00000\r
 DEFINE FW_SIZE           = 0x00200000\r
 DEFINE FW_BLOCKS         = 0x200\r
@@ -48,7 +41,6 @@ DEFINE CODE_BLOCKS       = 0x1E0
 DEFINE FVMAIN_SIZE       = 0x001AC000\r
 DEFINE SECFV_OFFSET      = 0x001CC000\r
 DEFINE SECFV_SIZE        = 0x34000\r
 DEFINE FVMAIN_SIZE       = 0x001AC000\r
 DEFINE SECFV_OFFSET      = 0x001CC000\r
 DEFINE SECFV_SIZE        = 0x34000\r
-\r
 !endif\r
 \r
 SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress     = $(FW_BASE_ADDRESS)\r
 !endif\r
 \r
 SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress     = $(FW_BASE_ADDRESS)\r
index 0796b0db816be26469ad03af8d26555f7181e012..5a21840a55c91b22ea6af5b845235c75dfde9c74 100644 (file)
   DEFINE SMM_REQUIRE             = FALSE\r
   DEFINE TLS_ENABLE              = FALSE\r
 \r
   DEFINE SMM_REQUIRE             = FALSE\r
   DEFINE TLS_ENABLE              = FALSE\r
 \r
+  #\r
+  # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to\r
+  # one of the supported values, in place of any of the convenience macros, is\r
+  # permitted.\r
+  #\r
+!ifdef $(FD_SIZE_1MB)\r
+  DEFINE FD_SIZE_IN_KB           = 1024\r
+!else\r
+!ifdef $(FD_SIZE_2MB)\r
+  DEFINE FD_SIZE_IN_KB           = 2048\r
+!else\r
+  DEFINE FD_SIZE_IN_KB           = 2048\r
+!endif\r
+!endif\r
+\r
 [BuildOptions]\r
   GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
   GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
 [BuildOptions]\r
   GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
   GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
index 71ac62f023b5f6c9e707d384fdceaac697e3b78f..11866b7207c799ac06915b13ca672309b40cc994 100644 (file)
   DEFINE SMM_REQUIRE             = FALSE\r
   DEFINE TLS_ENABLE              = FALSE\r
 \r
   DEFINE SMM_REQUIRE             = FALSE\r
   DEFINE TLS_ENABLE              = FALSE\r
 \r
+  #\r
+  # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to\r
+  # one of the supported values, in place of any of the convenience macros, is\r
+  # permitted.\r
+  #\r
+!ifdef $(FD_SIZE_1MB)\r
+  DEFINE FD_SIZE_IN_KB           = 1024\r
+!else\r
+!ifdef $(FD_SIZE_2MB)\r
+  DEFINE FD_SIZE_IN_KB           = 2048\r
+!else\r
+  DEFINE FD_SIZE_IN_KB           = 2048\r
+!endif\r
+!endif\r
+\r
 [BuildOptions]\r
   GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
   GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
 [BuildOptions]\r
   GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
   GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
index 2ceb31d7ffd5b494f8a4bbb68003957dbd99bf8f..2fab544600f5a6e139b268936acb7168d807248b 100644 (file)
   DEFINE SMM_REQUIRE             = FALSE\r
   DEFINE TLS_ENABLE              = FALSE\r
 \r
   DEFINE SMM_REQUIRE             = FALSE\r
   DEFINE TLS_ENABLE              = FALSE\r
 \r
+  #\r
+  # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to\r
+  # one of the supported values, in place of any of the convenience macros, is\r
+  # permitted.\r
+  #\r
+!ifdef $(FD_SIZE_1MB)\r
+  DEFINE FD_SIZE_IN_KB           = 1024\r
+!else\r
+!ifdef $(FD_SIZE_2MB)\r
+  DEFINE FD_SIZE_IN_KB           = 2048\r
+!else\r
+  DEFINE FD_SIZE_IN_KB           = 2048\r
+!endif\r
+!endif\r
+\r
 [BuildOptions]\r
   GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
   GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
 [BuildOptions]\r
   GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r
   GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG\r