1project('phosphor-bmc-code-mgmt', 'cpp', 2 default_options: [ 3 'buildtype=debugoptimized', 4 'cpp_std=c++17', 5 'warning_level=3', 6 'werror=true' 7 ], 8 license: 'Apache-2.0', 9 version: '1.0') 10 11conf = configuration_data() 12 13# DBus information 14conf.set_quoted('BMC_INVENTORY_INTERFACE', 'xyz.openbmc_project.Inventory.Item.Bmc') 15conf.set_quoted('BUSNAME_UPDATER', 'xyz.openbmc_project.Software.BMC.Updater') 16conf.set_quoted('DOWNLOAD_BUSNAME', 'xyz.openbmc_project.Software.Download') 17conf.set_quoted('FILEPATH_IFACE', 'xyz.openbmc_project.Common.FilePath') 18conf.set_quoted('INVENTORY_PATH', '/xyz/openbmc_project/inventory/') 19conf.set_quoted('MAPPER_BUSNAME', 'xyz.openbmc_project.ObjectMapper') 20conf.set_quoted('MAPPER_INTERFACE', 'xyz.openbmc_project.ObjectMapper') 21conf.set_quoted('MAPPER_PATH', '/xyz/openbmc_project/object_mapper') 22conf.set_quoted('SOFTWARE_OBJPATH', '/xyz/openbmc_project/software') 23conf.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1') 24conf.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1') 25conf.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager') 26conf.set_quoted('VERSION_BUSNAME', 'xyz.openbmc_project.Software.Version') 27conf.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version') 28 29# Names of the forward and reverse associations 30conf.set_quoted('ACTIVATION_FWD_ASSOCIATION', 'inventory') 31conf.set_quoted('ACTIVATION_REV_ASSOCIATION', 'activation') 32conf.set_quoted('ACTIVE_FWD_ASSOCIATION', 'active') 33conf.set_quoted('ACTIVE_REV_ASSOCIATION', 'software_version') 34conf.set_quoted('FUNCTIONAL_FWD_ASSOCIATION', 'functional') 35conf.set_quoted('FUNCTIONAL_REV_ASSOCIATION', 'software_version') 36conf.set_quoted('UPDATEABLE_FWD_ASSOCIATION', 'updateable') 37conf.set_quoted('UPDATEABLE_REV_ASSOCIATION', 'software_version') 38 39# Filesystem files and directories 40# The path of the alt rwfs overlay 41conf.set_quoted('ALT_RWFS', '/media/alt/var/persist') 42# The prefix path for the versioned read-only bmc partitions 43conf.set_quoted('BMC_ROFS_PREFIX', get_option('media-dir') + '/rofs-') 44# The name of the BMC table of contents file 45conf.set_quoted('OS_RELEASE_FILE', '/etc/os-release') 46# The dir where activation data is stored in files 47conf.set_quoted('PERSIST_DIR', '/var/lib/phosphor-bmc-code-mgmt/') 48 49# Supported BMC layout types 50conf.set('STATIC_LAYOUT', get_option('bmc-layout').contains('static')) 51conf.set('UBIFS_LAYOUT', get_option('bmc-layout').contains('ubi')) 52 53# Configurable features 54conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) 55conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) 56 57# Configurable variables 58conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) 59conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) 60conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir')) 61conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name')) 62conf.set_quoted('MEDIA_DIR', get_option('media-dir')) 63conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name')) 64conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext')) 65conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path')) 66conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path')) 67conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name')) 68 69configure_file(output: 'config.h', configuration: conf) 70 71deps = [ 72 dependency('phosphor-dbus-interfaces'), 73 dependency('phosphor-logging'), 74 dependency('sdbusplus') 75] 76 77ssl = dependency('openssl') 78 79systemd = dependency('systemd') 80systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir') 81 82unit_files = [ 83 'obmc-flash-bmc-setenv@.service.in', 84 'reboot-guard-disable.service.in', 85 'reboot-guard-enable.service.in', 86 'force-reboot.service.in', 87 'usr-local.mount.in', 88 'xyz.openbmc_project.Software.BMC.Updater.service.in', 89 'xyz.openbmc_project.Software.Download.service.in', 90 'xyz.openbmc_project.Software.Sync.service.in', 91 'xyz.openbmc_project.Software.Version.service.in' 92] 93 94sdbuspp = find_program('sdbus++') 95subdir('xyz/openbmc_project/Software/Image') 96 97image_updater_sources = files( 98 'activation.cpp', 99 'item_updater.cpp', 100 'item_updater_main.cpp', 101 'serialize.cpp', 102 'version.cpp', 103 'utils.cpp' 104) 105 106if get_option('bmc-layout').contains('static') 107 image_updater_sources += files( 108 'static/flash.cpp', 109 'static/item_updater_helper.cpp' 110 ) 111elif get_option('bmc-layout').contains('ubi') 112 image_updater_sources += files( 113 'ubi/flash.cpp', 114 'ubi/item_updater_helper.cpp' 115 ) 116 117 unit_files += [ 118 'ubi/obmc-flash-bmc-cleanup.service.in', 119 'ubi/obmc-flash-bmc-mirroruboot.service.in', 120 'ubi/obmc-flash-bmc-ubiremount.service.in', 121 'ubi/obmc-flash-bmc-ubiro@.service.in', 122 'ubi/obmc-flash-bmc-ubiro-remove@.service.in', 123 'ubi/obmc-flash-bmc-ubirw.service.in', 124 'ubi/obmc-flash-bmc-ubirw-remove.service.in', 125 'ubi/obmc-flash-bmc-updateubootvars@.service.in' 126 ] 127elif get_option('bmc-layout').contains('mmc') 128 image_updater_sources += files( 129 'mmc/flash.cpp', 130 'mmc/item_updater_helper.cpp' 131 ) 132endif 133 134if get_option('host-bios-upgrade').enabled() 135 unit_files += 'obmc-flash-host-bios@.service.in' 136endif 137 138if get_option('sync-bmc-files').enabled() 139 executable( 140 'phosphor-sync-software-manager', 141 'sync_manager.cpp', 142 'sync_manager_main.cpp', 143 'sync_watch.cpp', 144 dependencies: deps, 145 install: true 146 ) 147 148 install_data('synclist', 149 install_dir: get_option('sysconfdir') 150 ) 151endif 152 153if get_option('verify-signature').enabled() 154 image_updater_sources += files( 155 'image_verify.cpp', 156 'openssl_alloc.cpp' 157 ) 158endif 159 160executable( 161 'phosphor-download-manager', 162 'download_manager.cpp', 163 'download_manager_main.cpp', 164 dependencies: deps, 165 install: true 166) 167 168executable( 169 'phosphor-image-updater', 170 image_error_cpp, 171 image_error_hpp, 172 image_updater_sources, 173 dependencies: [deps, ssl], 174 install: true 175) 176 177executable( 178 'phosphor-version-software-manager', 179 image_error_cpp, 180 image_error_hpp, 181 'image_manager.cpp', 182 'image_manager_main.cpp', 183 'version.cpp', 184 'watch.cpp', 185 dependencies: [deps, ssl], 186 install: true 187) 188 189install_data('obmc-flash-bmc', 190 install_mode: 'rwxr-xr-x', 191 install_dir: get_option('bindir') 192) 193 194install_data('software.conf', 195 install_dir: '/usr/lib/tmpfiles.d/' 196) 197 198foreach u : unit_files 199 configure_file( 200 input: u, 201 output: '@BASENAME@', 202 configuration: conf, 203 install: true, 204 install_dir: systemd_system_unit_dir, 205 ) 206endforeach 207 208# If test coverage of source files within the root directory are wanted, 209# need to define and build the tests from here 210build_tests = get_option('tests') 211if not build_tests.disabled() 212 oe_sdk = get_option('oe-sdk') 213 if oe_sdk.enabled() 214 # Setup OE SYSROOT 215 OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip() 216 if OECORE_TARGET_SYSROOT == '' 217 error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.') 218 endif 219 message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT) 220 rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib']) 221 ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip() 222 dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so] 223 else 224 dynamic_linker = [] 225 endif 226 227 gtest = dependency('gtest', main: true, disabler: true, required: build_tests) 228 include_srcs = declare_dependency(sources: [ 229 'image_verify.cpp', 230 'version.cpp'] 231 ) 232 233 test('utest', 234 executable( 235 'utest', 236 './test/utest.cpp', 237 link_args: dynamic_linker, 238 build_rpath: get_option('oe-sdk').enabled() ? rpath : '', 239 dependencies: [deps, gtest, include_srcs, ssl] 240 ) 241) 242endif 243