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