Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 1 | firmware_inc = include_directories('.') |
| 2 | |
| 3 | # phosphor-ipmi-flash config |
| 4 | config_data = [] |
| 5 | if get_option('update-type') == 'static-layout' |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 6 | if get_option('reboot-update') |
| 7 | config_data += 'config-static-bmc-reboot.json' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 8 | else |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 9 | if get_option('update-status') |
| 10 | config_data += 'config-static-bmc-with-update-status.json' |
| 11 | else |
| 12 | config_data += 'config-static-bmc.json' |
| 13 | endif |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 14 | endif |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 15 | endif |
| 16 | |
| 17 | if get_option('host-bios') |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 18 | config_data += 'config-bios.json' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 19 | endif |
| 20 | |
| 21 | foreach data : config_data |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 22 | configure_file( |
| 23 | input: data + '.in', |
| 24 | output: data, |
| 25 | configuration: conf_data, |
| 26 | install: true, |
| 27 | install_dir: get_option('datadir') / 'phosphor-ipmi-flash', |
| 28 | ) |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 29 | endforeach |
| 30 | |
| 31 | # temp files |
| 32 | install_data( |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 33 | 'phosphor-ipmi-flash.conf', |
| 34 | install_dir: get_option('libdir') / 'tmpfiles.d', |
| 35 | ) |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 36 | |
| 37 | # systemd configs |
| 38 | systemd_data = [ |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 39 | 'phosphor-ipmi-flash-bmc-prepare.target', |
| 40 | 'phosphor-ipmi-flash-bmc-verify.target', |
| 41 | 'phosphor-ipmi-flash-bmc-update.target', |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 42 | ] |
| 43 | |
| 44 | if get_option('host-bios') |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 45 | systemd_data += [ |
| 46 | 'phosphor-ipmi-flash-bios-prepare.target', |
| 47 | 'phosphor-ipmi-flash-bios-verify.target', |
| 48 | 'phosphor-ipmi-flash-bios-update.target', |
| 49 | ] |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 50 | endif |
| 51 | |
| 52 | systemd = dependency('systemd') |
| 53 | if systemd.found() |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 54 | foreach data : systemd_data |
| 55 | configure_file( |
| 56 | input: data + '.in', |
| 57 | output: data, |
| 58 | configuration: conf_data, |
| 59 | install: true, |
| 60 | install_dir: systemd.get_variable('systemdsystemunitdir'), |
| 61 | ) |
| 62 | endforeach |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 63 | endif |
| 64 | |
| 65 | firmware_source = [ |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 66 | 'firmware_handlers_builder.cpp', |
| 67 | 'firmware_handler.cpp', |
| 68 | 'lpc_handler.cpp', |
| 69 | ] |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 70 | |
| 71 | if (get_option('lpc-type') == 'aspeed-lpc' or |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 72 | get_option('tests').allowed()) |
| 73 | firmware_source += 'lpc_aspeed.cpp' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 74 | endif |
| 75 | |
| 76 | if (get_option('lpc-type') == 'nuvoton-lpc' or |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 77 | get_option('tests').allowed()) |
| 78 | firmware_source += 'lpc_nuvoton.cpp' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 79 | endif |
| 80 | |
| 81 | if (get_option('p2a-type') == 'aspeed-p2a' or |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 82 | get_option('tests').allowed()) |
| 83 | firmware_source += 'pci_handler.cpp' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 84 | endif |
| 85 | |
| 86 | if get_option('p2a-type') == 'nuvoton-p2a-vga' |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 87 | firmware_source += 'pci_nuvoton_handler.cpp' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 88 | endif |
| 89 | |
| 90 | if get_option('p2a-type') == 'nuvoton-p2a-mbox' |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 91 | firmware_source += 'pci_nuvoton_handler.cpp' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 92 | endif |
| 93 | |
| 94 | if get_option('net-bridge') |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 95 | firmware_source += 'net_handler.cpp' |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 96 | endif |
| 97 | |
| 98 | firmware_pre = declare_dependency( |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 99 | include_directories: [root_inc, bmc_inc, firmware_inc], |
| 100 | dependencies: [ |
| 101 | dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']), |
| 102 | common_dep, |
| 103 | blobs_dep, |
| 104 | sys_dep, |
| 105 | ], |
| 106 | ) |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 107 | |
| 108 | firmware_lib = static_library( |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 109 | 'firmwareblob', |
| 110 | firmware_source, |
| 111 | conf_h, |
| 112 | implicit_include_directories: false, |
| 113 | dependencies: firmware_pre, |
| 114 | ) |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 115 | |
| 116 | firmware_dep = declare_dependency( |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 117 | link_with: firmware_lib, |
| 118 | dependencies: firmware_pre, |
| 119 | ) |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 120 | |
| 121 | shared_module( |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 122 | 'firmwareblob', |
| 123 | 'main.cpp', |
| 124 | implicit_include_directories: false, |
| 125 | dependencies: [firmware_dep, dependency('libipmid')], |
| 126 | install: true, |
| 127 | install_dir: get_option('libdir') / 'blob-ipmid', |
| 128 | ) |
Willy Tu | bcae900 | 2021-09-12 13:58:04 -0700 | [diff] [blame] | 129 | |
Patrick Williams | acbf875 | 2025-01-30 17:48:00 -0500 | [diff] [blame] | 130 | if get_option('tests').allowed() |
Patrick Williams | 32e9ea1 | 2025-02-01 08:37:51 -0500 | [diff] [blame] | 131 | subdir('test') |
William A. Kennington III | 0df4085 | 2021-11-01 13:56:42 -0700 | [diff] [blame] | 132 | endif |