meta-phosphor: add offset for uboot environment

The previous static-image building code only confirmed that the
u-boot image was smaller than the offset for the kernel image, but
most systems place the u-boot environment after the u-boot image.
It is possible that we have a u-boot image bigger than the u-boot
partition, which is then overwritten on boot by the u-boot env.
Check for this at image build time and prevent it from happening.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3a1e6654272cedb3e840bbea4771ae4e464c4ecd
diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass
index 8242c78..976e8b4 100644
--- a/meta-phosphor/classes/image_types_phosphor.bbclass
+++ b/meta-phosphor/classes/image_types_phosphor.bbclass
@@ -55,6 +55,9 @@
 # Fixed partition offsets
 FLASH_UBOOT_SPL_SIZE ?= "64"
 FLASH_UBOOT_OFFSET ?= "0"
+FLASH_UBOOT_ENV_OFFSET ?= "384"
+FLASH_UBOOT_ENV_OFFSET:flash-65536 ?= "896"
+FLASH_UBOOT_ENV_OFFSET:flash-131072 ?= "896"
 FLASH_KERNEL_OFFSET ?= "512"
 FLASH_KERNEL_OFFSET:flash-65536 ?= "1024"
 FLASH_KERNEL_OFFSET:flash-131072 ?= "1024"
@@ -301,7 +304,7 @@
     _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
                                'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)),
                   uboot_offset,
-                  int(d.getVar('FLASH_KERNEL_OFFSET', True)))
+                  int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)))
 
     _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
                                d.getVar('FLASH_KERNEL_IMAGE', True)),
@@ -468,7 +471,7 @@
     _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
                                'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)),
                   uboot_offset,
-                  int(d.getVar('FLASH_KERNEL_OFFSET', True)))
+                  int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)))
 
     _append_image(os.path.join(d.getVar('IMGDEPLOYDIR', True),
                                '%s.cpio.%s.fitImage' % (