blob: 0ff1c178d835c0c76386cc1871d97bdeefd4d7b9 [file] [log] [blame]
Jagpal Singh Gillcab87e92025-01-02 16:33:46 -08001conf = configuration_data()
2
3# DBus information
4conf.set_quoted('BMC_INVENTORY_INTERFACE', 'xyz.openbmc_project.Inventory.Item.Bmc')
5conf.set_quoted('BUSNAME_UPDATER', 'xyz.openbmc_project.Software.BMC.Updater')
6conf.set_quoted('DOWNLOAD_BUSNAME', 'xyz.openbmc_project.Software.Download')
7conf.set_quoted('FILEPATH_IFACE', 'xyz.openbmc_project.Common.FilePath')
8conf.set_quoted('INVENTORY_PATH', '/xyz/openbmc_project/inventory/')
9conf.set_quoted('MAPPER_BUSNAME', 'xyz.openbmc_project.ObjectMapper')
10conf.set_quoted('MAPPER_INTERFACE', 'xyz.openbmc_project.ObjectMapper')
11conf.set_quoted('MAPPER_PATH', '/xyz/openbmc_project/object_mapper')
12conf.set_quoted('SOFTWARE_OBJPATH', '/xyz/openbmc_project/software')
13conf.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1')
14conf.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1')
15conf.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager')
16conf.set_quoted('VERSION_BUSNAME', 'xyz.openbmc_project.Software.Version')
17conf.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version')
18conf.set_quoted('EXTENDED_VERSION_IFACE', 'xyz.openbmc_project.Software.ExtendedVersion')
19conf.set_quoted('COMPATIBLE_IFACE', 'xyz.openbmc_project.Inventory.Decorator.Compatible')
20
21# Names of the forward and reverse associations
22conf.set_quoted('ACTIVATION_FWD_ASSOCIATION', 'inventory')
23conf.set_quoted('ACTIVATION_REV_ASSOCIATION', 'activation')
24conf.set_quoted('ACTIVE_FWD_ASSOCIATION', 'active')
25conf.set_quoted('ACTIVE_REV_ASSOCIATION', 'software_version')
26conf.set_quoted('FUNCTIONAL_FWD_ASSOCIATION', 'functional')
27conf.set_quoted('FUNCTIONAL_REV_ASSOCIATION', 'software_version')
28conf.set_quoted('UPDATEABLE_FWD_ASSOCIATION', 'updateable')
29conf.set_quoted('UPDATEABLE_REV_ASSOCIATION', 'software_version')
30
31# Filesystem files and directories
32# The prefix path for the versioned read-only bmc partitions
33conf.set_quoted('BMC_ROFS_PREFIX', get_option('media-dir') + '/rofs-')
34# The name of the BMC table of contents file
35conf.set_quoted('OS_RELEASE_FILE', '/etc/os-release')
36# The dir where activation data is stored in files
37conf.set_quoted('PERSIST_DIR', '/var/lib/phosphor-bmc-code-mgmt/')
38
39# Supported BMC layout types
40conf.set('STATIC_LAYOUT', get_option('bmc-layout').contains('static'))
41conf.set('UBIFS_LAYOUT', get_option('bmc-layout').contains('ubi'))
42conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc'))
43
44# Configurable features
45conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').allowed())
46conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').allowed())
47conf.set('START_UPDATE_DBUS_INTEFACE', get_option('software-update-dbus-interface').allowed())
48
49# Configurable variables
50conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed'))
51conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name'))
52conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir'))
53conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name'))
54conf.set_quoted('MEDIA_DIR', get_option('media-dir'))
55optional_array = get_option('optional-images')
56optional_images = ''
57foreach optiona_image : optional_array
58 optional_images = ' '.join([optional_images, optiona_image])
59endforeach
60conf.set_quoted('OPTIONAL_IMAGES', optional_images)
61conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name'))
62conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext'))
63conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path'))
64conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path'))
65conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name'))
66conf.set_quoted('BMC_MSL', get_option('bmc-msl'))
67conf.set_quoted('REGEX_BMC_MSL', get_option('regex-bmc-msl'))
68
69if get_option('host-bios-upgrade').allowed()
70 conf.set_quoted('BIOS_OBJPATH', get_option('bios-object-path'))
71endif
72
73if 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'))
77else
78 conf.set_quoted('ALT_RWFS', '/media/alt/var/persist')
79endif
80
81configure_file(output: 'config.h', configuration: conf)
82
83unit_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
93image_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
104if get_option('bmc-layout').contains('static')
105 image_updater_sources += files(
106 'static/flash.cpp',
107 'static/item_updater_helper.cpp'
108 )
109elif 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 ]
125elif 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 ]
139endif
140
141if get_option('host-bios-upgrade').allowed()
142 unit_files += 'obmc-flash-host-bios@.service.in'
143endif
144
145if 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 ]
151endif
152
153if 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 )
171endif
172
173if (get_option('verify-signature').allowed())
174 image_updater_sources += files(
175 'utils.cpp',
176 'image_verify.cpp',
177 'openssl_alloc.cpp'
178 )
179endif
180
181executable(
182 'phosphor-download-manager',
183 'download_manager.cpp',
184 'download_manager_main.cpp',
185 dependencies: deps,
186 install: true
187)
188
189software_common_sources = files(
190 'software_utils.cpp',
191)
192
193if 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 ]
205else
206 unit_files += [
207 'xyz.openbmc_project.Software.BMC.Updater.service.in',
208 'xyz.openbmc_project.Software.Version.service.in'
209 ]
210endif
211
212executable(
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
221executable(
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
232install_data('obmc-flash-bmc',
233 install_mode: 'rwxr-xr-x',
234 install_dir: get_option('bindir')
235)
236
237install_data('detect-slot-aspeed',
238 install_mode: 'rwxr-xr-x',
239 install_dir: get_option('bindir')
240)
241
242install_data('reset-cs0-aspeed',
243 install_mode: 'rwxr-xr-x',
244 install_dir: get_option('bindir')
245)
246
247install_data('software.conf',
248 install_dir: '/usr/lib/tmpfiles.d/'
249)
250
251foreach 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 )
259endforeach
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 Gillcab87e92025-01-02 16:33:46 -0800263if 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)
279endif
280
281if get_option('usb-code-update').allowed()
282 subdir('usb')
283endif
284
285if get_option('side-switch-on-boot').allowed()
286 subdir('side-switch')
287endif