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')) 52conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) 53 54# Configurable features 55conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) 56conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) 57 58# Configurable variables 59conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) 60conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) 61conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir')) 62conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name')) 63conf.set_quoted('MEDIA_DIR', get_option('media-dir')) 64optional_array = get_option('optional-images') 65optional_images = '' 66foreach optiona_image : optional_array 67 optional_images = ' '.join([optional_images, optiona_image]) 68endforeach 69conf.set_quoted('OPTIONAL_IMAGES', optional_images) 70conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name')) 71conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext')) 72conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path')) 73conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path')) 74conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name')) 75conf.set_quoted('BMC_MSL', get_option('bmc-msl')) 76conf.set_quoted('REGEX_BMC_MSL', get_option('regex-bmc-msl')) 77 78 79configure_file(output: 'config.h', configuration: conf) 80 81deps = [ 82 dependency('phosphor-dbus-interfaces'), 83 dependency('phosphor-logging'), 84 dependency('sdbusplus') 85] 86 87ssl = dependency('openssl') 88 89systemd = dependency('systemd') 90systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir') 91 92unit_files = [ 93 'obmc-flash-bmc-setenv@.service.in', 94 'reboot-guard-disable.service.in', 95 'reboot-guard-enable.service.in', 96 'force-reboot.service.in', 97 'usr-local.mount.in', 98 'xyz.openbmc_project.Software.BMC.Updater.service.in', 99 'xyz.openbmc_project.Software.Download.service.in', 100 'xyz.openbmc_project.Software.Sync.service.in', 101 'xyz.openbmc_project.Software.Version.service.in' 102] 103 104sdbuspp = find_program('sdbus++') 105subdir('xyz/openbmc_project/Software/Image') 106 107image_updater_sources = files( 108 'activation.cpp', 109 'images.cpp', 110 'item_updater.cpp', 111 'item_updater_main.cpp', 112 'serialize.cpp', 113 'version.cpp', 114 'utils.cpp', 115 'msl_verify.cpp' 116) 117 118if get_option('bmc-layout').contains('static') 119 image_updater_sources += files( 120 'static/flash.cpp', 121 'static/item_updater_helper.cpp' 122 ) 123elif get_option('bmc-layout').contains('ubi') 124 image_updater_sources += files( 125 'ubi/flash.cpp', 126 'ubi/item_updater_helper.cpp' 127 ) 128 129 unit_files += [ 130 'ubi/obmc-flash-bmc-cleanup.service.in', 131 'ubi/obmc-flash-bmc-mirroruboot.service.in', 132 'ubi/obmc-flash-bmc-ubiremount.service.in', 133 'ubi/obmc-flash-bmc-ubiro@.service.in', 134 'ubi/obmc-flash-bmc-ubiro-remove@.service.in', 135 'ubi/obmc-flash-bmc-ubirw.service.in', 136 'ubi/obmc-flash-bmc-ubirw-remove.service.in', 137 'ubi/obmc-flash-bmc-updateubootvars@.service.in' 138 ] 139elif get_option('bmc-layout').contains('mmc') 140 image_updater_sources += files( 141 'mmc/flash.cpp', 142 'mmc/item_updater_helper.cpp' 143 ) 144 145 unit_files += [ 146 'mmc/obmc-flash-mmc@.service.in', 147 'mmc/obmc-flash-mmc-mount.service.in', 148 'mmc/obmc-flash-mmc-remove@.service.in', 149 'mmc/obmc-flash-mmc-setprimary@.service.in', 150 'mmc/obmc-flash-mmc-umount.service.in', 151 ] 152endif 153 154if get_option('host-bios-upgrade').enabled() 155 unit_files += 'obmc-flash-host-bios@.service.in' 156endif 157 158if get_option('sync-bmc-files').enabled() 159 executable( 160 'phosphor-sync-software-manager', 161 'sync_manager.cpp', 162 'sync_manager_main.cpp', 163 'sync_watch.cpp', 164 dependencies: deps, 165 install: true 166 ) 167 168 install_data('synclist', 169 install_dir: get_option('sysconfdir') 170 ) 171endif 172 173if get_option('verify-signature').enabled() 174 image_updater_sources += files( 175 'image_verify.cpp', 176 'openssl_alloc.cpp' 177 ) 178endif 179 180executable( 181 'phosphor-download-manager', 182 'download_manager.cpp', 183 'download_manager_main.cpp', 184 dependencies: deps, 185 install: true 186) 187 188executable( 189 'phosphor-image-updater', 190 image_error_cpp, 191 image_error_hpp, 192 image_updater_sources, 193 dependencies: [deps, ssl], 194 install: true 195) 196 197executable( 198 'phosphor-version-software-manager', 199 image_error_cpp, 200 image_error_hpp, 201 'image_manager.cpp', 202 'image_manager_main.cpp', 203 'version.cpp', 204 'watch.cpp', 205 dependencies: [deps, ssl], 206 install: true 207) 208 209install_data('obmc-flash-bmc', 210 install_mode: 'rwxr-xr-x', 211 install_dir: get_option('bindir') 212) 213 214install_data('software.conf', 215 install_dir: '/usr/lib/tmpfiles.d/' 216) 217 218foreach u : unit_files 219 configure_file( 220 input: u, 221 output: '@BASENAME@', 222 configuration: conf, 223 install: true, 224 install_dir: systemd_system_unit_dir, 225 ) 226endforeach 227 228# If test coverage of source files within the root directory are wanted, 229# need to define and build the tests from here 230build_tests = get_option('tests') 231if not build_tests.disabled() 232 oe_sdk = get_option('oe-sdk') 233 if oe_sdk.enabled() 234 # Setup OE SYSROOT 235 OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip() 236 if OECORE_TARGET_SYSROOT == '' 237 error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.') 238 endif 239 message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT) 240 rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib']) 241 ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip() 242 dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so] 243 else 244 dynamic_linker = [] 245 endif 246 247 gtest = dependency('gtest', main: true, disabler: true, required: build_tests) 248 include_srcs = declare_dependency(sources: [ 249 'image_verify.cpp', 250 'images.cpp', 251 'version.cpp'] 252 ) 253 254 test('utest', 255 executable( 256 'utest', 257 './test/utest.cpp', 258 link_args: dynamic_linker, 259 build_rpath: get_option('oe-sdk').enabled() ? rpath : '', 260 dependencies: [deps, gtest, include_srcs, ssl] 261 ) 262) 263endif 264