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