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