meson: build: Initial commit, create config file

Create the meson.build and meson_options.txt to generate a config.h
file. Set the config default values to static as it's set currently
and the values that the recipe sets as a default (max number of
versions to 1 and media directory to /run/media).

Tested: Verified the meson-generated config.h fle was equivalent to
        the autotools-generated one. Verified config values were
        changed with the config options, ex: 'meson build -Dbmc-layout=ubi'

Change-Id: I987db2e28db209e4f16b305375d007ad34ff9bd3
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..59aaa8f
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,68 @@
+project('phosphor-bmc-code-mgmt', 'cpp',
+    default_options: [
+        'warning_level=3',
+        'werror=true',
+        'cpp_std=c++17'
+    ],
+    license: 'Apache-2.0',
+    version: '1.0')
+
+conf = configuration_data()
+
+# DBus information
+conf.set_quoted('BMC_INVENTORY_INTERFACE', 'xyz.openbmc_project.Inventory.Item.Bmc')
+conf.set_quoted('BUSNAME_UPDATER', 'xyz.openbmc_project.Software.BMC.Updater')
+conf.set_quoted('DOWNLOAD_BUSNAME', 'xyz.openbmc_project.Software.Download')
+conf.set_quoted('FILEPATH_IFACE', 'xyz.openbmc_project.Common.FilePath')
+conf.set_quoted('INVENTORY_PATH', '/xyz/openbmc_project/inventory/')
+conf.set_quoted('MAPPER_BUSNAME', 'xyz.openbmc_project.ObjectMapper')
+conf.set_quoted('MAPPER_INTERFACE', 'xyz.openbmc_project.ObjectMapper')
+conf.set_quoted('MAPPER_PATH', '/xyz/openbmc_project/object_mapper')
+conf.set_quoted('SOFTWARE_OBJPATH', '/xyz/openbmc_project/software')
+conf.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1')
+conf.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1')
+conf.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager')
+conf.set_quoted('VERSION_BUSNAME', 'xyz.openbmc_project.Software.Version')
+conf.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version')
+
+# Names of the forward and reverse associations
+conf.set_quoted('ACTIVATION_FWD_ASSOCIATION', 'inventory')
+conf.set_quoted('ACTIVATION_REV_ASSOCIATION', 'activation')
+conf.set_quoted('ACTIVE_FWD_ASSOCIATION', 'active')
+conf.set_quoted('ACTIVE_REV_ASSOCIATION', 'software_version')
+conf.set_quoted('FUNCTIONAL_FWD_ASSOCIATION', 'functional')
+conf.set_quoted('FUNCTIONAL_REV_ASSOCIATION', 'software_version')
+conf.set_quoted('UPDATEABLE_FWD_ASSOCIATION', 'updateable')
+conf.set_quoted('UPDATEABLE_REV_ASSOCIATION', 'software_version')
+
+# Filesystem files and directories
+# The path of the alt rwfs overlay
+conf.set_quoted('ALT_RWFS', '/media/alt/var/persist')
+# The prefix path for the versioned read-only bmc partitions
+conf.set_quoted('BMC_ROFS_PREFIX', get_option('media-dir') + '/rofs-')
+# The name of the BMC table of contents file
+conf.set_quoted('OS_RELEASE_FILE', '/etc/os-release')
+# The dir where activation data is stored in files
+conf.set_quoted('PERSIST_DIR', '/var/lib/phosphor-bmc-code-mgmt/')
+
+# Supported BMC layout types
+conf.set('STATIC_LAYOUT', get_option('bmc-layout').contains('static'))
+conf.set('UBIFS_LAYOUT', get_option('bmc-layout').contains('ubi'))
+
+# Configurable features
+conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled())
+conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled())
+
+# Configurable variables
+conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed'))
+conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name'))
+conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir'))
+conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name'))
+conf.set_quoted('MEDIA_DIR', get_option('media-dir'))
+conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name'))
+conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext'))
+conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path'))
+conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path'))
+conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name'))
+
+configure_file(output: 'config.h', configuration: conf)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..e0fc849
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,79 @@
+# Supported BMC layout types. Reference:
+# https://github.com/openbmc/docs/blob/master/code-update/flash-layout.md#supported-filesystem-choices
+# - static: NOR flash configured with fixed-sized MTD partitions.
+# - ubi: NOR flash device configured with UBI volumes.
+option('bmc-layout', type: 'combo',
+    choices: ['static', 'ubi'],
+    value: 'static',
+    description: 'The BMC layout type.')
+
+# Features
+option('host-bios-upgrade', type: 'feature',
+    description: 'Enable host bios upgrade support.')
+
+option('sync-bmc-files', type: 'feature',
+    description: 'Enable sync of filesystem files.')
+
+option('verify-signature', type: 'feature',
+    description: 'Enable image signature validation.')
+
+# Variables
+option(
+    'active-bmc-max-allowed', type: 'integer',
+    value: 1,
+    description: 'The maximum allowed active BMC versions.',
+)
+
+option(
+    'hash-file-name', type: 'string',
+    value: 'hashfunc',
+    description: 'The name of the hash file.',
+)
+
+option(
+    'img-upload-dir', type: 'string',
+    value: '/tmp/images',
+    description: 'Directory where downloaded software images are placed.',
+)
+
+option(
+    'manifest-file-name', type: 'string',
+    value: 'MANIFEST',
+    description: 'The name of the MANIFEST file.',
+)
+
+option(
+    'media-dir', type: 'string',
+    value: '/run/media',
+    description: 'The base dir where all read-only partitions are mounted.',
+)
+
+option(
+    'publickey-file-name', type: 'string',
+    value: 'publickey',
+    description: 'The name of the public key file.',
+)
+
+option(
+    'signature-file-ext', type: 'string',
+    value: '.sig',
+    description: 'The extension of the Signature file.',
+)
+
+option(
+    'signed-image-conf-path', type: 'string',
+    value: '/etc/activationdata/',
+    description: 'Path of public key and hash function files.',
+)
+
+option(
+    'sync-list-dir-path', type: 'string',
+    value: '/etc/',
+    description: 'The path to the sync list file directory.',
+)
+
+option(
+    'sync-list-file-name', type: 'string',
+    value: 'synclist',
+    description: 'The name of the sync list file.',
+)