Patrick Williams | 0fdaf0b | 2023-08-06 18:49:47 -0500 | [diff] [blame] | 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" |
Vijay Khemka | d2a6c6a | 2019-07-01 15:36:57 -0700 | [diff] [blame] | 2 | |
Patrick Williams | 5500d05 | 2023-08-05 09:21:19 -0500 | [diff] [blame] | 3 | IPMB_CHANNELS ?= "" |
Potin Lai | 18258f0 | 2023-12-29 00:33:33 +0800 | [diff] [blame] | 4 | IPMB_REMOTE_ADDR ?= "" |
Patrick Williams | 5500d05 | 2023-08-05 09:21:19 -0500 | [diff] [blame] | 5 | |
| 6 | python do_ipmb_channels() { |
| 7 | import json |
| 8 | channels = [] |
Potin Lai | 18258f0 | 2023-12-29 00:33:33 +0800 | [diff] [blame] | 9 | ipmb_channel = d.getVar('IPMB_CHANNELS').split() |
| 10 | ipmb_remote_addr = d.getVar('IPMB_REMOTE_ADDR').split() |
Patrick Williams | 5500d05 | 2023-08-05 09:21:19 -0500 | [diff] [blame] | 11 | |
Potin Lai | 18258f0 | 2023-12-29 00:33:33 +0800 | [diff] [blame] | 12 | for i in range(len(ipmb_channel)): |
Patrick Williams | 5500d05 | 2023-08-05 09:21:19 -0500 | [diff] [blame] | 13 | channels.append({ |
| 14 | "type": "ipmb", |
Potin Lai | 18258f0 | 2023-12-29 00:33:33 +0800 | [diff] [blame] | 15 | "slave-path": ipmb_channel[i], |
Patrick Williams | 5500d05 | 2023-08-05 09:21:19 -0500 | [diff] [blame] | 16 | "bmc-addr": 32, |
Potin Lai | 2c35d0d | 2024-01-05 15:46:23 +0800 | [diff] [blame] | 17 | "remote-addr": int(ipmb_remote_addr[i]) if i < len(ipmb_remote_addr) else 64, |
Potin Lai | 18258f0 | 2023-12-29 00:33:33 +0800 | [diff] [blame] | 18 | "devIndex": i |
Patrick Williams | 5500d05 | 2023-08-05 09:21:19 -0500 | [diff] [blame] | 19 | }) |
| 20 | |
| 21 | data = { "channels" : channels } |
| 22 | |
| 23 | path = os.path.join(d.getVar('D') + d.getVar('datadir'), |
| 24 | 'ipmbbridge', 'ipmb-channels.json') |
| 25 | |
| 26 | with open(path, 'w') as f: |
| 27 | json.dump(data, f, indent=4) |
| 28 | } |
| 29 | do_ipmb_channels[vardeps] += "IPMB_CHANNELS" |
| 30 | addtask ipmb_channels after do_install before do_package |
Vijay Khemka | d2a6c6a | 2019-07-01 15:36:57 -0700 | [diff] [blame] | 31 | |
Patrick Williams | 6f74664 | 2021-08-06 07:40:55 -0500 | [diff] [blame] | 32 | do_install:append() { |
Patrick Williams | 5500d05 | 2023-08-05 09:21:19 -0500 | [diff] [blame] | 33 | install -d ${D}${datadir}/ipmbbridge |
Vijay Khemka | d2a6c6a | 2019-07-01 15:36:57 -0700 | [diff] [blame] | 34 | } |