Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 1 | project('phosphor-bmc-code-mgmt', 'cpp', |
| 2 | default_options: [ |
| 3 | 'warning_level=3', |
| 4 | 'werror=true', |
| 5 | 'cpp_std=c++17' |
| 6 | ], |
| 7 | license: 'Apache-2.0', |
| 8 | version: '1.0') |
| 9 | |
| 10 | conf = configuration_data() |
| 11 | |
| 12 | # DBus information |
| 13 | conf.set_quoted('BMC_INVENTORY_INTERFACE', 'xyz.openbmc_project.Inventory.Item.Bmc') |
| 14 | conf.set_quoted('BUSNAME_UPDATER', 'xyz.openbmc_project.Software.BMC.Updater') |
| 15 | conf.set_quoted('DOWNLOAD_BUSNAME', 'xyz.openbmc_project.Software.Download') |
| 16 | conf.set_quoted('FILEPATH_IFACE', 'xyz.openbmc_project.Common.FilePath') |
| 17 | conf.set_quoted('INVENTORY_PATH', '/xyz/openbmc_project/inventory/') |
| 18 | conf.set_quoted('MAPPER_BUSNAME', 'xyz.openbmc_project.ObjectMapper') |
| 19 | conf.set_quoted('MAPPER_INTERFACE', 'xyz.openbmc_project.ObjectMapper') |
| 20 | conf.set_quoted('MAPPER_PATH', '/xyz/openbmc_project/object_mapper') |
| 21 | conf.set_quoted('SOFTWARE_OBJPATH', '/xyz/openbmc_project/software') |
| 22 | conf.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1') |
| 23 | conf.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1') |
| 24 | conf.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager') |
| 25 | conf.set_quoted('VERSION_BUSNAME', 'xyz.openbmc_project.Software.Version') |
| 26 | conf.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version') |
| 27 | |
| 28 | # Names of the forward and reverse associations |
| 29 | conf.set_quoted('ACTIVATION_FWD_ASSOCIATION', 'inventory') |
| 30 | conf.set_quoted('ACTIVATION_REV_ASSOCIATION', 'activation') |
| 31 | conf.set_quoted('ACTIVE_FWD_ASSOCIATION', 'active') |
| 32 | conf.set_quoted('ACTIVE_REV_ASSOCIATION', 'software_version') |
| 33 | conf.set_quoted('FUNCTIONAL_FWD_ASSOCIATION', 'functional') |
| 34 | conf.set_quoted('FUNCTIONAL_REV_ASSOCIATION', 'software_version') |
| 35 | conf.set_quoted('UPDATEABLE_FWD_ASSOCIATION', 'updateable') |
| 36 | conf.set_quoted('UPDATEABLE_REV_ASSOCIATION', 'software_version') |
| 37 | |
| 38 | # Filesystem files and directories |
| 39 | # The path of the alt rwfs overlay |
| 40 | conf.set_quoted('ALT_RWFS', '/media/alt/var/persist') |
| 41 | # The prefix path for the versioned read-only bmc partitions |
| 42 | conf.set_quoted('BMC_ROFS_PREFIX', get_option('media-dir') + '/rofs-') |
| 43 | # The name of the BMC table of contents file |
| 44 | conf.set_quoted('OS_RELEASE_FILE', '/etc/os-release') |
| 45 | # The dir where activation data is stored in files |
| 46 | conf.set_quoted('PERSIST_DIR', '/var/lib/phosphor-bmc-code-mgmt/') |
| 47 | |
| 48 | # Supported BMC layout types |
| 49 | conf.set('STATIC_LAYOUT', get_option('bmc-layout').contains('static')) |
| 50 | conf.set('UBIFS_LAYOUT', get_option('bmc-layout').contains('ubi')) |
| 51 | |
| 52 | # Configurable features |
| 53 | conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) |
| 54 | conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) |
| 55 | |
| 56 | # Configurable variables |
| 57 | conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) |
| 58 | conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) |
| 59 | conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir')) |
| 60 | conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name')) |
| 61 | conf.set_quoted('MEDIA_DIR', get_option('media-dir')) |
| 62 | conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name')) |
| 63 | conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext')) |
| 64 | conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path')) |
| 65 | conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path')) |
| 66 | conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name')) |
| 67 | |
| 68 | configure_file(output: 'config.h', configuration: conf) |
Adriana Kobylak | 113492e | 2020-05-05 13:45:45 -0500 | [diff] [blame] | 69 | |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 70 | deps = [ |
| 71 | dependency('phosphor-dbus-interfaces'), |
| 72 | dependency('phosphor-logging'), |
| 73 | dependency('sdbusplus') |
| 74 | ] |
| 75 | |
| 76 | ssl = dependency('openssl') |
| 77 | |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 78 | systemd = dependency('systemd') |
| 79 | systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir') |
| 80 | |
| 81 | unit_files = [ |
| 82 | 'obmc-flash-bmc-setenv@.service', |
| 83 | 'reboot-guard-disable.service', |
| 84 | 'reboot-guard-enable.service', |
| 85 | 'force-reboot.service', |
| 86 | 'usr-local.mount', |
| 87 | 'xyz.openbmc_project.Software.BMC.Updater.service', |
| 88 | 'xyz.openbmc_project.Software.Download.service', |
| 89 | 'xyz.openbmc_project.Software.Sync.service', |
| 90 | 'xyz.openbmc_project.Software.Version.service' |
| 91 | ] |
| 92 | |
Adriana Kobylak | 113492e | 2020-05-05 13:45:45 -0500 | [diff] [blame] | 93 | sdbuspp = find_program('sdbus++') |
| 94 | subdir('xyz/openbmc_project/Software/Image') |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 95 | |
| 96 | image_updater_sources = files( |
| 97 | 'activation.cpp', |
| 98 | 'item_updater.cpp', |
| 99 | 'item_updater_main.cpp', |
| 100 | 'serialize.cpp', |
| 101 | 'version.cpp', |
| 102 | 'utils.cpp' |
| 103 | ) |
| 104 | |
| 105 | if get_option('bmc-layout').contains('static') |
| 106 | subdir('static') |
| 107 | endif |
| 108 | if get_option('bmc-layout').contains('ubi') |
| 109 | subdir('ubi') |
| 110 | endif |
| 111 | |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 112 | if get_option('host-bios-upgrade').enabled() |
| 113 | unit_files += 'obmc-flash-host-bios@.service' |
| 114 | endif |
| 115 | |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 116 | if get_option('sync-bmc-files').enabled() |
| 117 | executable( |
| 118 | 'phosphor-sync-software-manager', |
| 119 | 'sync_manager.cpp', |
| 120 | 'sync_manager_main.cpp', |
| 121 | 'sync_watch.cpp', |
| 122 | dependencies: deps, |
| 123 | install: true |
| 124 | ) |
Adriana Kobylak | 817209f | 2020-05-07 09:52:03 -0500 | [diff] [blame] | 125 | |
| 126 | install_data('synclist', |
| 127 | install_dir: get_option('sysconfdir') |
| 128 | ) |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 129 | endif |
| 130 | |
| 131 | if get_option('verify-signature').enabled() |
| 132 | image_updater_sources += files( |
| 133 | 'image_verify.cpp', |
| 134 | 'openssl_alloc.cpp' |
| 135 | ) |
| 136 | endif |
| 137 | |
| 138 | executable( |
| 139 | 'phosphor-download-manager', |
| 140 | 'download_manager.cpp', |
| 141 | 'download_manager_main.cpp', |
| 142 | dependencies: deps, |
| 143 | install: true |
| 144 | ) |
| 145 | |
| 146 | executable( |
| 147 | 'phosphor-image-updater', |
| 148 | image_error_cpp, |
| 149 | image_error_hpp, |
| 150 | image_updater_sources, |
| 151 | dependencies: [deps, ssl], |
| 152 | install: true |
| 153 | ) |
| 154 | |
| 155 | executable( |
| 156 | 'phosphor-version-software-manager', |
| 157 | image_error_cpp, |
| 158 | image_error_hpp, |
| 159 | 'image_manager.cpp', |
| 160 | 'image_manager_main.cpp', |
| 161 | 'version.cpp', |
| 162 | 'watch.cpp', |
| 163 | dependencies: [deps, ssl], |
| 164 | install: true |
| 165 | ) |
Adriana Kobylak | 817209f | 2020-05-07 09:52:03 -0500 | [diff] [blame] | 166 | |
| 167 | install_data('obmc-flash-bmc', |
| 168 | install_mode: 'rwxr-xr-x', |
| 169 | install_dir: get_option('bindir') |
| 170 | ) |
| 171 | |
| 172 | install_data('software.conf', |
| 173 | install_dir: '/usr/lib/tmpfiles.d/' |
| 174 | ) |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 175 | |
| 176 | foreach u : unit_files |
| 177 | configure_file( |
| 178 | copy: true, |
| 179 | input: u, |
| 180 | install: true, |
| 181 | install_dir: systemd_system_unit_dir, |
| 182 | output: u, |
| 183 | ) |
| 184 | endforeach |