apphandler: add firmware version aux bytes parsing
Default regex string only tries to match Major and Minor version.
To match more firmware version info, platforms need to define it own
regex string to match more strings, and assign correct mapping index in
matches array.
matches[0]: matched index for major ver
matches[1]: matched index for minor ver
matches[2]: matched index for aux[0] (set 0 to skip)
matches[3]: matched index for aux[1] (set 0 to skip)
matches[4]: matched index for aux[2] (set 0 to skip)
matches[5]: matched index for aux[3] (set 0 to skip)
Test Results:
```
regex = "([\d]+).([\d]+).([\d]+)-dev-([\d]+)-g([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})"
matches = {1,2,5,6,7,8}
version = 2.14.0-dev-750-g37a7c5ad1-dirty
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | |
| | | | | | | |-- Aux byte 3 (0xAD), index 8
| | | | | | |---- Aux byte 2 (0xC5), index 7
| | | | | |------ Aux byte 1 (0xA7), index 6
| | | | |-------- Aux byte 0 (0x37), index 5
| | | |------------- Not used, index 4
| | |------------------- Not used, index 3
| |---------------------- Minor (14), index 2
|------------------------ Major (2), index 1
```
rev.major: 2
rev.minor: 14
rev.aux[0]: 55 (0x37)
rev.aux[1]: 167 (0xA7)
rev.aux[2]: 197 (0xC5)
rev.aux[3]: 173 (0xAD)
Change-Id: I01c4d6b7468cea04d5046bbc4a60c4db20a7f2a9
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/meson.build b/meson.build
index 55d25b0..2b82689 100644
--- a/meson.build
+++ b/meson.build
@@ -34,6 +34,14 @@
conf_data.set_quoted('HOST_IPMI_LIB_PATH', get_option('host-ipmi-lib-path'))
conf_data.set_quoted('FW_VER_REGEX', get_option('fw-ver-regex'))
+matches_map = get_option('matches-map')
+conf_data.set('MAJOR_MATCH_INDEX', matches_map[0])
+conf_data.set('MINOR_MATCH_INDEX', matches_map[1])
+conf_data.set('AUX_0_MATCH_INDEX', matches_map[2])
+conf_data.set('AUX_1_MATCH_INDEX', matches_map[3])
+conf_data.set('AUX_2_MATCH_INDEX', matches_map[4])
+conf_data.set('AUX_3_MATCH_INDEX', matches_map[5])
+
conf_h = configure_file(
output: 'config.h',
configuration: conf_data)