image_types_phosphor: Add u-boot spl to static image

If the [SPL_BINARY][1] variable is set, add the spl binary to
the static image, then increase the u-boot offset by the size
of the spl (default to 64kb).

[1]: https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#var-SPL_BINARY

(From meta-phosphor rev: 31fdddf87d96ddeed1b16639368c6bea991392b1)

Change-Id: I96fef2323dec511257ea17ce6d4aa888d3ba1dbf
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass
index 39534db..0259cf6 100644
--- a/meta-phosphor/classes/image_types_phosphor.bbclass
+++ b/meta-phosphor/classes/image_types_phosphor.bbclass
@@ -42,6 +42,7 @@
 FLASH_NOR_UBI_OVERHEAD ?= "64"
 
 # Fixed partition offsets
+FLASH_UBOOT_SPL_SIZE ?= "64"
 FLASH_UBOOT_OFFSET ?= "0"
 FLASH_KERNEL_OFFSET ?= "512"
 FLASH_KERNEL_OFFSET_flash-131072 ?= "1024"
@@ -336,9 +337,19 @@
                                'if=%s' % imgpath,
                                'of=%s' % nor_image])
 
+    uboot_offset = int(d.getVar('FLASH_UBOOT_OFFSET', True))
+
+    spl_binary = d.getVar('SPL_BINARY', True)
+    if spl_binary:
+        _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
+                                   'u-boot-spl.%s' % d.getVar('UBOOT_SUFFIX',True)),
+                      int(d.getVar('FLASH_UBOOT_OFFSET', True)),
+                      int(d.getVar('FLASH_UBOOT_SPL_SIZE', True)))
+        uboot_offset += int(d.getVar('FLASH_UBOOT_SPL_SIZE', True))
+
     _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
                                'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)),
-                  int(d.getVar('FLASH_UBOOT_OFFSET', True)),
+                  uboot_offset,
                   int(d.getVar('FLASH_KERNEL_OFFSET', True)))
 
     _append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),