-
Notifications
You must be signed in to change notification settings - Fork 11
/
meson.build
346 lines (302 loc) · 10.7 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
project('phosphor-bmc-code-mgmt', 'cpp',
default_options: [
'buildtype=debugoptimized',
'cpp_std=c++23',
'warning_level=3',
'werror=true'
],
meson_version: '>=1.1.1',
license: 'Apache-2.0',
version: '1.0')
add_project_arguments(
'-DBOOST_SYSTEM_NO_DEPRECATED',
'-DBOOST_ERROR_CODE_HEADER_ONLY',
'-DBOOST_NO_RTTI',
'-DBOOST_NO_TYPEID',
'-DBOOST_ALL_NO_LIB',
'-DBOOST_ASIO_DISABLE_THREADS',
'-DBOOST_ASIO_NO_DEPRECATED',
language: 'cpp',
)
cpp = meson.get_compiler('cpp')
conf = configuration_data()
# DBus information
conf.set_quoted('BMC_INVENTORY_INTERFACE', 'xyz.openbmc_project.Inventory.Item.Bmc')
conf.set_quoted('BUSNAME_UPDATER', 'xyz.openbmc_project.Software.BMC.Updater')
conf.set_quoted('DOWNLOAD_BUSNAME', 'xyz.openbmc_project.Software.Download')
conf.set_quoted('FILEPATH_IFACE', 'xyz.openbmc_project.Common.FilePath')
conf.set_quoted('INVENTORY_PATH', '/xyz/openbmc_project/inventory/')
conf.set_quoted('MAPPER_BUSNAME', 'xyz.openbmc_project.ObjectMapper')
conf.set_quoted('MAPPER_INTERFACE', 'xyz.openbmc_project.ObjectMapper')
conf.set_quoted('MAPPER_PATH', '/xyz/openbmc_project/object_mapper')
conf.set_quoted('SOFTWARE_OBJPATH', '/xyz/openbmc_project/software')
conf.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1')
conf.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1')
conf.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager')
conf.set_quoted('VERSION_BUSNAME', 'xyz.openbmc_project.Software.Version')
conf.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version')
conf.set_quoted('EXTENDED_VERSION_IFACE', 'xyz.openbmc_project.Software.ExtendedVersion')
conf.set_quoted('COMPATIBLE_IFACE', 'xyz.openbmc_project.Inventory.Decorator.Compatible')
# Names of the forward and reverse associations
conf.set_quoted('ACTIVATION_FWD_ASSOCIATION', 'inventory')
conf.set_quoted('ACTIVATION_REV_ASSOCIATION', 'activation')
conf.set_quoted('ACTIVE_FWD_ASSOCIATION', 'active')
conf.set_quoted('ACTIVE_REV_ASSOCIATION', 'software_version')
conf.set_quoted('FUNCTIONAL_FWD_ASSOCIATION', 'functional')
conf.set_quoted('FUNCTIONAL_REV_ASSOCIATION', 'software_version')
conf.set_quoted('UPDATEABLE_FWD_ASSOCIATION', 'updateable')
conf.set_quoted('UPDATEABLE_REV_ASSOCIATION', 'software_version')
# Filesystem files and directories
# The prefix path for the versioned read-only bmc partitions
conf.set_quoted('BMC_ROFS_PREFIX', get_option('media-dir') + '/rofs-')
# The name of the BMC table of contents file
conf.set_quoted('OS_RELEASE_FILE', '/etc/os-release')
# The dir where activation data is stored in files
conf.set_quoted('PERSIST_DIR', '/var/lib/phosphor-bmc-code-mgmt/')
# Supported BMC layout types
conf.set('STATIC_LAYOUT', get_option('bmc-layout').contains('static'))
conf.set('UBIFS_LAYOUT', get_option('bmc-layout').contains('ubi'))
conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc'))
# Configurable features
conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').allowed())
conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').allowed())
# Configurable variables
conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed'))
conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name'))
conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir'))
conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name'))
conf.set_quoted('MEDIA_DIR', get_option('media-dir'))
optional_array = get_option('optional-images')
optional_images = ''
foreach optiona_image : optional_array
optional_images = ' '.join([optional_images, optiona_image])
endforeach
conf.set_quoted('OPTIONAL_IMAGES', optional_images)
conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name'))
conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext'))
conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path'))
conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path'))
conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name'))
conf.set_quoted('BMC_MSL', get_option('bmc-msl'))
conf.set_quoted('REGEX_BMC_MSL', get_option('regex-bmc-msl'))
if get_option('host-bios-upgrade').allowed()
conf.set_quoted('BIOS_OBJPATH', get_option('bios-object-path'))
endif
if get_option('bmc-static-dual-image').allowed()
conf.set('BMC_STATIC_DUAL_IMAGE', get_option('bmc-static-dual-image').allowed())
conf.set_quoted('ALT_ROFS_DIR', get_option('alt-rofs-dir'))
conf.set_quoted('ALT_RWFS', get_option('alt-rwfs-dir'))
else
conf.set_quoted('ALT_RWFS', '/media/alt/var/persist')
endif
configure_file(output: 'config.h', configuration: conf)
boost_dep = dependency('boost')
sdbusplus_dep = dependency('sdbusplus')
sdbusplusplus_prog = find_program('sdbus++', native: true)
sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
pdi_dep = dependency('phosphor-dbus-interfaces')
phosphor_logging_dep = dependency('phosphor-logging')
cereal_dep = dependency('cereal', required: false)
has_cereal = cpp.has_header_symbol(
'cereal/cereal.hpp',
'cereal::specialize',
dependencies: cereal_dep,
required: false)
if not has_cereal
cereal_opts = import('cmake').subproject_options()
cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
cereal_proj = import('cmake').subproject(
'cereal',
options: cereal_opts,
required: false)
assert(cereal_proj.found(), 'cereal is required')
cereal_dep = cereal_proj.dependency('cereal')
endif
deps = [
cereal_dep,
pdi_dep,
phosphor_logging_dep,
sdbusplus_dep,
]
ssl = dependency('openssl')
systemd = dependency('systemd')
systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
unit_files = [
'reboot-guard-disable.service.in',
'reboot-guard-enable.service.in',
'force-reboot.service.in',
'usr-local.mount.in',
'xyz.openbmc_project.Software.BMC.Updater.service.in',
'xyz.openbmc_project.Software.Download.service.in',
'xyz.openbmc_project.Software.Sync.service.in',
'xyz.openbmc_project.Software.Version.service.in'
]
image_updater_sources = files(
'activation.cpp',
'images.cpp',
'item_updater.cpp',
'serialize.cpp',
'version.cpp',
'utils.cpp',
'msl_verify.cpp',
'update_manager.cpp'
)
if get_option('bmc-layout').contains('static')
image_updater_sources += files(
'static/flash.cpp',
'static/item_updater_helper.cpp'
)
elif get_option('bmc-layout').contains('ubi')
image_updater_sources += files(
'ubi/flash.cpp',
'ubi/item_updater_helper.cpp'
)
unit_files += [
'ubi/obmc-flash-bmc-cleanup.service.in',
'ubi/obmc-flash-bmc-mirroruboot.service.in',
'ubi/obmc-flash-bmc-ubiremount.service.in',
'ubi/[email protected]',
'ubi/[email protected]',
'ubi/obmc-flash-bmc-ubirw.service.in',
'ubi/obmc-flash-bmc-ubirw-remove.service.in',
'ubi/[email protected]'
]
elif get_option('bmc-layout').contains('mmc')
image_updater_sources += files(
'mmc/flash.cpp',
'mmc/item_updater_helper.cpp'
)
unit_files += [
'mmc/[email protected]',
'mmc/obmc-flash-mmc-mount.service.in',
'mmc/[email protected]',
'mmc/[email protected]',
'mmc/obmc-flash-mmc-umount.service.in',
'mmc/obmc-flash-mmc-mirroruboot.service.in',
]
endif
if get_option('host-bios-upgrade').allowed()
unit_files += '[email protected]'
endif
if get_option('bmc-static-dual-image').allowed()
unit_files += [
'static/[email protected]',
'static/obmc-flash-bmc-static-mount-alt.service.in',
'static/obmc-flash-bmc-prepare-for-sync.service.in',
]
endif
if get_option('sync-bmc-files').allowed()
executable(
'phosphor-sync-software-manager',
'sync_manager.cpp',
'sync_manager_main.cpp',
'sync_watch.cpp',
dependencies: deps,
install: true
)
install_data('synclist',
install_dir: get_option('sysconfdir')
)
install_data('sync-once.sh',
install_mode: 'rwxr-xr-x',
install_dir: get_option('bindir')
)
endif
if (get_option('verify-signature').allowed())
image_updater_sources += files(
'utils.cpp',
'image_verify.cpp',
'openssl_alloc.cpp'
)
endif
executable(
'phosphor-download-manager',
'download_manager.cpp',
'download_manager_main.cpp',
dependencies: deps,
install: true
)
software_common_sources = files(
'software_utils.cpp',
)
if get_option('software-update-dbus-interface').allowed()
executable(
'phosphor-software-manager',
'software_manager.cpp',
image_updater_sources,
software_common_sources,
dependencies: [deps, ssl],
install: true
)
unit_files += [
'xyz.openbmc_project.Software.Manager.service.in'
]
endif
executable(
'phosphor-image-updater',
image_updater_sources,
software_common_sources,
'item_updater_main.cpp',
dependencies: [deps, ssl, boost_dep],
install: true
)
executable(
'phosphor-version-software-manager',
'image_manager.cpp',
'image_manager_main.cpp',
'version.cpp',
'watch.cpp',
software_common_sources,
dependencies: [deps, ssl],
install: true
)
install_data('obmc-flash-bmc',
install_mode: 'rwxr-xr-x',
install_dir: get_option('bindir')
)
install_data('detect-slot-aspeed',
install_mode: 'rwxr-xr-x',
install_dir: get_option('bindir')
)
install_data('reset-cs0-aspeed',
install_mode: 'rwxr-xr-x',
install_dir: get_option('bindir')
)
install_data('software.conf',
install_dir: '/usr/lib/tmpfiles.d/'
)
foreach u : unit_files
configure_file(
input: u,
output: '@BASENAME@',
configuration: conf,
install: true,
install_dir: systemd_system_unit_dir,
)
endforeach
# If test coverage of source files within the root directory are wanted,
# need to define and build the tests from here
build_tests = get_option('tests')
if not build_tests.disabled()
gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
include_srcs = declare_dependency(sources: [
'utils.cpp',
'image_verify.cpp',
'images.cpp',
'version.cpp']
)
test('utest',
executable(
'utest',
'./test/utest.cpp',
dependencies: [deps, gtest, include_srcs, ssl]
)
)
endif
if get_option('usb-code-update').allowed()
subdir('usb')
endif
if get_option('side-switch-on-boot').allowed()
subdir('side-switch')
endif