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