image_types_phosphor: Make Version Purpose configurable

The current version purpose is set to BMC[1]. Make it a configurable
variable for cases where other Purpose value is more appropriate, like
setting it to System if the machine includes the host-fw package that
would package the BMC and host firmware code into a combined image.

1: https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Software/Version.interface.yaml

Tested: Verified the purpose is still BMC, then verifed that setting the
        variable from a machine.conf file changed its value.

(From meta-phosphor rev: 356265535d268858840ddbe52ff8c1e37f084188)

Change-Id: I159e73f9b9c310321dda885b10dbc1cd56a674ee
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass
index 23ff347..e29f4ff 100644
--- a/meta-phosphor/classes/image_types_phosphor.bbclass
+++ b/meta-phosphor/classes/image_types_phosphor.bbclass
@@ -57,6 +57,8 @@
 INSECURE_KEY = "${@'${SIGNING_KEY}' == '${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv'}"
 SIGNING_KEY_DEPENDS = "${@oe.utils.conditional('INSECURE_KEY', 'True', 'phosphor-insecure-signing-key-native:do_populate_sysroot', '', d)}"
 
+VERSION_PURPOSE ?= "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"
+
 UBOOT_SUFFIX ?= "bin"
 
 python() {
@@ -418,10 +420,11 @@
         'publickey')
 
 python do_generate_phosphor_manifest() {
+    purpose = d.getVar('VERSION_PURPOSE', True)
     version = do_get_version(d)
     target_machine = d.getVar('MACHINE', True)
     with open('MANIFEST', 'w') as fd:
-        fd.write('purpose=xyz.openbmc_project.Software.Version.VersionPurpose.BMC\n')
+        fd.write('purpose={}\n'.format(purpose))
         fd.write('version={}\n'.format(version.strip('"')))
         fd.write('KeyType={}\n'.format(get_pubkey_type(d)))
         fd.write('HashType=RSA-SHA256\n')