Jagpal Singh Gill | cab87e9 | 2025-01-02 16:33:46 -0800 | [diff] [blame] | 1 | conf = configuration_data() |
| 2 | |
| 3 | # DBus information |
| 4 | conf.set_quoted('BMC_INVENTORY_INTERFACE', 'xyz.openbmc_project.Inventory.Item.Bmc') |
| 5 | conf.set_quoted('BUSNAME_UPDATER', 'xyz.openbmc_project.Software.BMC.Updater') |
| 6 | conf.set_quoted('DOWNLOAD_BUSNAME', 'xyz.openbmc_project.Software.Download') |
| 7 | conf.set_quoted('FILEPATH_IFACE', 'xyz.openbmc_project.Common.FilePath') |
| 8 | conf.set_quoted('INVENTORY_PATH', '/xyz/openbmc_project/inventory/') |
| 9 | conf.set_quoted('MAPPER_BUSNAME', 'xyz.openbmc_project.ObjectMapper') |
| 10 | conf.set_quoted('MAPPER_INTERFACE', 'xyz.openbmc_project.ObjectMapper') |
| 11 | conf.set_quoted('MAPPER_PATH', '/xyz/openbmc_project/object_mapper') |
| 12 | conf.set_quoted('SOFTWARE_OBJPATH', '/xyz/openbmc_project/software') |
| 13 | conf.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1') |
| 14 | conf.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1') |
| 15 | conf.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager') |
| 16 | conf.set_quoted('VERSION_BUSNAME', 'xyz.openbmc_project.Software.Version') |
| 17 | conf.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version') |
| 18 | conf.set_quoted('EXTENDED_VERSION_IFACE', 'xyz.openbmc_project.Software.ExtendedVersion') |
| 19 | conf.set_quoted('COMPATIBLE_IFACE', 'xyz.openbmc_project.Inventory.Decorator.Compatible') |
| 20 | |
| 21 | # Names of the forward and reverse associations |
| 22 | conf.set_quoted('ACTIVATION_FWD_ASSOCIATION', 'inventory') |
| 23 | conf.set_quoted('ACTIVATION_REV_ASSOCIATION', 'activation') |
| 24 | conf.set_quoted('ACTIVE_FWD_ASSOCIATION', 'active') |
| 25 | conf.set_quoted('ACTIVE_REV_ASSOCIATION', 'software_version') |
| 26 | conf.set_quoted('FUNCTIONAL_FWD_ASSOCIATION', 'functional') |
| 27 | conf.set_quoted('FUNCTIONAL_REV_ASSOCIATION', 'software_version') |
| 28 | conf.set_quoted('UPDATEABLE_FWD_ASSOCIATION', 'updateable') |
| 29 | conf.set_quoted('UPDATEABLE_REV_ASSOCIATION', 'software_version') |
| 30 | |
| 31 | # Filesystem files and directories |
| 32 | # The prefix path for the versioned read-only bmc partitions |
| 33 | conf.set_quoted('BMC_ROFS_PREFIX', get_option('media-dir') + '/rofs-') |
| 34 | # The name of the BMC table of contents file |
| 35 | conf.set_quoted('OS_RELEASE_FILE', '/etc/os-release') |
| 36 | # The dir where activation data is stored in files |
| 37 | conf.set_quoted('PERSIST_DIR', '/var/lib/phosphor-bmc-code-mgmt/') |
| 38 | |
| 39 | # Supported BMC layout types |
| 40 | conf.set('STATIC_LAYOUT', get_option('bmc-layout').contains('static')) |
| 41 | conf.set('UBIFS_LAYOUT', get_option('bmc-layout').contains('ubi')) |
| 42 | conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) |
| 43 | |
| 44 | # Configurable features |
| 45 | conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').allowed()) |
| 46 | conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').allowed()) |
| 47 | conf.set('START_UPDATE_DBUS_INTEFACE', get_option('software-update-dbus-interface').allowed()) |
| 48 | |
| 49 | # Configurable variables |
| 50 | conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) |
| 51 | conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) |
| 52 | conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir')) |
| 53 | conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name')) |
| 54 | conf.set_quoted('MEDIA_DIR', get_option('media-dir')) |
| 55 | optional_array = get_option('optional-images') |
| 56 | optional_images = '' |
| 57 | foreach optiona_image : optional_array |
| 58 | optional_images = ' '.join([optional_images, optiona_image]) |
| 59 | endforeach |
| 60 | conf.set_quoted('OPTIONAL_IMAGES', optional_images) |
| 61 | conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name')) |
| 62 | conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext')) |
| 63 | conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path')) |
| 64 | conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path')) |
| 65 | conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name')) |
| 66 | conf.set_quoted('BMC_MSL', get_option('bmc-msl')) |
| 67 | conf.set_quoted('REGEX_BMC_MSL', get_option('regex-bmc-msl')) |
| 68 | |
| 69 | if get_option('host-bios-upgrade').allowed() |
| 70 | conf.set_quoted('BIOS_OBJPATH', get_option('bios-object-path')) |
| 71 | endif |
| 72 | |
| 73 | if get_option('bmc-static-dual-image').allowed() |
| 74 | conf.set('BMC_STATIC_DUAL_IMAGE', get_option('bmc-static-dual-image').allowed()) |
| 75 | conf.set_quoted('ALT_ROFS_DIR', get_option('alt-rofs-dir')) |
| 76 | conf.set_quoted('ALT_RWFS', get_option('alt-rwfs-dir')) |
| 77 | else |
| 78 | conf.set_quoted('ALT_RWFS', '/media/alt/var/persist') |
| 79 | endif |
| 80 | |
| 81 | configure_file(output: 'config.h', configuration: conf) |
| 82 | |
| 83 | unit_files = [ |
| 84 | 'obmc-flash-bmc-setenv@.service.in', |
| 85 | 'reboot-guard-disable.service.in', |
| 86 | 'reboot-guard-enable.service.in', |
| 87 | 'force-reboot.service.in', |
| 88 | 'usr-local.mount.in', |
| 89 | 'xyz.openbmc_project.Software.Download.service.in', |
| 90 | 'xyz.openbmc_project.Software.Sync.service.in' |
| 91 | ] |
| 92 | |
| 93 | image_updater_sources = files( |
| 94 | 'activation.cpp', |
| 95 | 'images.cpp', |
| 96 | 'item_updater.cpp', |
| 97 | 'serialize.cpp', |
| 98 | 'version.cpp', |
| 99 | 'utils.cpp', |
| 100 | 'msl_verify.cpp', |
| 101 | 'update_manager.cpp' |
| 102 | ) |
| 103 | |
| 104 | if get_option('bmc-layout').contains('static') |
| 105 | image_updater_sources += files( |
| 106 | 'static/flash.cpp', |
| 107 | 'static/item_updater_helper.cpp' |
| 108 | ) |
| 109 | elif get_option('bmc-layout').contains('ubi') |
| 110 | image_updater_sources += files( |
| 111 | 'ubi/flash.cpp', |
| 112 | 'ubi/item_updater_helper.cpp' |
| 113 | ) |
| 114 | |
| 115 | unit_files += [ |
| 116 | 'ubi/obmc-flash-bmc-cleanup.service.in', |
| 117 | 'ubi/obmc-flash-bmc-mirroruboot.service.in', |
| 118 | 'ubi/obmc-flash-bmc-ubiremount.service.in', |
| 119 | 'ubi/obmc-flash-bmc-ubiro@.service.in', |
| 120 | 'ubi/obmc-flash-bmc-ubiro-remove@.service.in', |
| 121 | 'ubi/obmc-flash-bmc-ubirw.service.in', |
| 122 | 'ubi/obmc-flash-bmc-ubirw-remove.service.in', |
| 123 | 'ubi/obmc-flash-bmc-updateubootvars@.service.in' |
| 124 | ] |
| 125 | elif get_option('bmc-layout').contains('mmc') |
| 126 | image_updater_sources += files( |
| 127 | 'mmc/flash.cpp', |
| 128 | 'mmc/item_updater_helper.cpp' |
| 129 | ) |
| 130 | |
| 131 | unit_files += [ |
| 132 | 'mmc/obmc-flash-mmc@.service.in', |
| 133 | 'mmc/obmc-flash-mmc-mount.service.in', |
| 134 | 'mmc/obmc-flash-mmc-remove@.service.in', |
| 135 | 'mmc/obmc-flash-mmc-setprimary@.service.in', |
| 136 | 'mmc/obmc-flash-mmc-umount.service.in', |
| 137 | 'mmc/obmc-flash-mmc-mirroruboot.service.in', |
| 138 | ] |
| 139 | endif |
| 140 | |
| 141 | if get_option('host-bios-upgrade').allowed() |
| 142 | unit_files += 'obmc-flash-host-bios@.service.in' |
| 143 | endif |
| 144 | |
| 145 | if get_option('bmc-static-dual-image').allowed() |
| 146 | unit_files += [ |
| 147 | 'static/obmc-flash-bmc-alt@.service.in', |
| 148 | 'static/obmc-flash-bmc-static-mount-alt.service.in', |
| 149 | 'static/obmc-flash-bmc-prepare-for-sync.service.in', |
| 150 | ] |
| 151 | endif |
| 152 | |
| 153 | if get_option('sync-bmc-files').allowed() |
| 154 | executable( |
| 155 | 'phosphor-sync-software-manager', |
| 156 | 'sync_manager.cpp', |
| 157 | 'sync_manager_main.cpp', |
| 158 | 'sync_watch.cpp', |
| 159 | dependencies: deps, |
| 160 | install: true |
| 161 | ) |
| 162 | |
| 163 | install_data('synclist', |
| 164 | install_dir: get_option('sysconfdir') |
| 165 | ) |
| 166 | |
| 167 | install_data('sync-once.sh', |
| 168 | install_mode: 'rwxr-xr-x', |
| 169 | install_dir: get_option('bindir') |
| 170 | ) |
| 171 | endif |
| 172 | |
| 173 | if (get_option('verify-signature').allowed()) |
| 174 | image_updater_sources += files( |
| 175 | 'utils.cpp', |
| 176 | 'image_verify.cpp', |
| 177 | 'openssl_alloc.cpp' |
| 178 | ) |
| 179 | endif |
| 180 | |
| 181 | executable( |
| 182 | 'phosphor-download-manager', |
| 183 | 'download_manager.cpp', |
| 184 | 'download_manager_main.cpp', |
| 185 | dependencies: deps, |
| 186 | install: true |
| 187 | ) |
| 188 | |
| 189 | software_common_sources = files( |
| 190 | 'software_utils.cpp', |
| 191 | ) |
| 192 | |
| 193 | if get_option('software-update-dbus-interface').allowed() |
| 194 | executable( |
| 195 | 'phosphor-software-manager', |
| 196 | 'software_manager.cpp', |
| 197 | image_updater_sources, |
| 198 | software_common_sources, |
| 199 | dependencies: [deps, ssl], |
| 200 | install: true |
| 201 | ) |
| 202 | unit_files += [ |
| 203 | 'xyz.openbmc_project.Software.Manager.service.in' |
| 204 | ] |
| 205 | else |
| 206 | unit_files += [ |
| 207 | 'xyz.openbmc_project.Software.BMC.Updater.service.in', |
| 208 | 'xyz.openbmc_project.Software.Version.service.in' |
| 209 | ] |
| 210 | endif |
| 211 | |
| 212 | executable( |
| 213 | 'phosphor-image-updater', |
| 214 | image_updater_sources, |
| 215 | software_common_sources, |
| 216 | 'item_updater_main.cpp', |
| 217 | dependencies: [deps, ssl, boost_dep], |
| 218 | install: true |
| 219 | ) |
| 220 | |
| 221 | executable( |
| 222 | 'phosphor-version-software-manager', |
| 223 | 'image_manager.cpp', |
| 224 | 'image_manager_main.cpp', |
| 225 | 'version.cpp', |
| 226 | 'watch.cpp', |
| 227 | software_common_sources, |
| 228 | dependencies: [deps, ssl], |
| 229 | install: true |
| 230 | ) |
| 231 | |
| 232 | install_data('obmc-flash-bmc', |
| 233 | install_mode: 'rwxr-xr-x', |
| 234 | install_dir: get_option('bindir') |
| 235 | ) |
| 236 | |
| 237 | install_data('detect-slot-aspeed', |
| 238 | install_mode: 'rwxr-xr-x', |
| 239 | install_dir: get_option('bindir') |
| 240 | ) |
| 241 | |
| 242 | install_data('reset-cs0-aspeed', |
| 243 | install_mode: 'rwxr-xr-x', |
| 244 | install_dir: get_option('bindir') |
| 245 | ) |
| 246 | |
| 247 | install_data('software.conf', |
| 248 | install_dir: '/usr/lib/tmpfiles.d/' |
| 249 | ) |
| 250 | |
| 251 | foreach u : unit_files |
| 252 | configure_file( |
| 253 | input: u, |
| 254 | output: '@BASENAME@', |
| 255 | configuration: conf, |
| 256 | install: true, |
| 257 | install_dir: systemd_system_unit_dir, |
| 258 | ) |
| 259 | endforeach |
| 260 | |
| 261 | # If test coverage of source files within the root directory are wanted, |
| 262 | # need to define and build the tests from here |
Jagpal Singh Gill | cab87e9 | 2025-01-02 16:33:46 -0800 | [diff] [blame] | 263 | if not build_tests.disabled() |
| 264 | gtest = dependency('gtest', main: true, disabler: true, required: build_tests) |
| 265 | include_srcs = declare_dependency(sources: [ |
| 266 | 'utils.cpp', |
| 267 | 'image_verify.cpp', |
| 268 | 'images.cpp', |
| 269 | 'version.cpp'] |
| 270 | ) |
| 271 | |
| 272 | test('utest', |
| 273 | executable( |
| 274 | 'utest', |
| 275 | './test/utest.cpp', |
| 276 | dependencies: [deps, gtest, include_srcs, ssl] |
| 277 | ) |
| 278 | ) |
| 279 | endif |
| 280 | |
| 281 | if get_option('usb-code-update').allowed() |
| 282 | subdir('usb') |
| 283 | endif |
| 284 | |
| 285 | if get_option('side-switch-on-boot').allowed() |
| 286 | subdir('side-switch') |
| 287 | endif |