Skip to content

Commit faca4ce

Browse files
authored
Update 5_openbmc_ipmi.md
1 parent fadee85 commit faca4ce

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

content/learning-paths/servers-and-cloud-computing/openbmc-rdv3/5_openbmc_ipmi.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ layout: learningpathall
88

99
## Customize IPMI Commands in OpenBMC
1010

11-
With the host console accessible through OpenBMC, you're now ready to extend its functionality by implementing a custom IPMI command handler.
11+
With the host console accessible through OpenBMC, you are now ready to extend its functionality by implementing a custom IPMI command handler.
1212

1313
The Intelligent Platform Management Interface ([IPMI](https://en.wikipedia.org/wiki/Intelligent_Platform_Management_Interface)) is a standardized protocol for managing and monitoring servers, even when the operating system is not running. In OpenBMC, IPMI support is built-in and can be extended using custom handlers through the D-Bus/IPMI infrastructure.
1414

15-
In this module, you'll implement a custom IPMI command handler that returns a simple string response. You'll write the handler in C++, package it with a BitBake recipe, build it into the OpenBMC image, and test it using `ipmitool` inside the simulated FVP environment.
15+
In this module, you'll implement a custom IPMI command handler that returns a simple string response. You will write the handler in C++, package it with a BitBake recipe, build it into the OpenBMC image, and test it using `ipmitool` inside the simulated FVP environment.
1616

1717
### Step 1: Create a BitBake Recipe
1818

19-
Create a new file named phosphor-ipmi-example.bb at the same folder.
19+
Create a new file named `phosphor-ipmi-example.bb` in the same folder.
2020

2121
```bash
2222
touch ~/openbmc/meta-evb/meta-evb-arm/meta-evb-fvp-base/recipes-phosphor/ipmi/phosphor-ipmi-example.bb
2323
```
2424

25-
Paste the following content:
25+
Paste the following content into it:
2626

2727
```bash
2828
SUMMARY = "Custom IPMI commands"
@@ -52,13 +52,15 @@ FILES:${PN} += "${libdir}/ipmid-providers/libmyipmi.so"
5252

5353
### Step 2: Create a Custom IPMI Handler
5454

55-
Create a folder `phosphor-ipmi-example` at the same path, and add a new file `fvp-ipmi.cpp`:
55+
Create a folder `phosphor-ipmi-example` at the same path, and add a new file called `fvp-ipmi.cpp`:
5656

5757
```bash
5858
mkdir ~/openbmc/meta-evb/meta-evb-arm/meta-evb-fvp-base/recipes-phosphor/ipmi/phosphor-ipmi-example
5959
touch ~/openbmc/meta-evb/meta-evb-arm/meta-evb-fvp-base/recipes-phosphor/ipmi/phosphor-ipmi-example/fvp-ipmi.cpp
6060
```
6161

62+
Add the contents below into `fvp-ipmi.cpp`:
63+
6264
```cpp
6365
#include <ipmid/api.hpp>
6466
#include <ipmid/utils.hpp>
@@ -85,13 +87,13 @@ void register_my_ipmi() {
8587
This function registers a custom IPMI handler using NetFn `0x30` and Command `0x20`.
8688
When triggered, it returns a static ASCII string: `"Hello from OpenBMC IPMI!"`.
8789
At runtime, this string is encoded as a sequence of hex bytes and sent back through the IPMI response.
88-
You'll observe this by running `ipmitool raw` and decoding the output.
90+
You will observe this by running `ipmitool raw` and decoding the output.
8991
9092
### Step 3: Add to Build Configuration
9193
92-
To verify the IPMI command, you need to add the following to the configuration to install ipmitool and phosphor-ipmi-example.
94+
To verify the IPMI command, you need to add the following to the configuration to install `ipmitool` and `phosphor-ipmi-example`.
9395
94-
Edit fvp.conf at: `~/openbmc/meta-evb/meta-evb-arm/meta-evb-fvp-base/conf/machine/fvp.conf`
96+
Edit `fvp.conf` at `~/openbmc/meta-evb/meta-evb-arm/meta-evb-fvp-base/conf/machine/fvp.conf`
9597
9698
Append the following packages:
9799
@@ -127,7 +129,7 @@ This command invokes your custom IPMI handler registered under:
127129
* Command: 0x20
128130

129131
You should see a response similar to:
130-
```
132+
```output
131133
root@fvp:~# ipmitool raw 0x30 0x20
132134
18 48 65 6c 6c 6f 20 66 72 6f 6d 20 4f 70 65 6e
133135
42 4d 43 20 49 50 4d 49 21
@@ -146,11 +148,11 @@ echo "48 65 6c 6c 6f 20 66 72 6f 6d 20 4f 70 65 6e 42 4d 43 20 49 50 4d 49 21" |
146148
```
147149

148150
The output will be:
149-
```
151+
```output
150152
"Hello from OpenBMC IPMI!"
151153
```
152154
This output confirms that the custom string returned by your `myIpmiCommand()` function has been correctly encoded and transmitted via IPMI:
153-
```
155+
```bash
154156
std::string reply = "Hello from OpenBMC IPMI!";
155157
return ipmi::responseSuccess(reply);
156158
```
@@ -162,9 +164,9 @@ The response from `ipmitool raw` confirms that your custom IPMI handler was:
162164
- Correctly executed in the simulated environment via IPMI raw access
163165
- Returning the intended payload, encoded as ASCII and received in hex format
164166

165-
By decoding the hex payload into ASCII, you’ve verified the full path from handler registration to command execution and payload delivery.
167+
By decoding the hex payload into ASCII, you have verified the full path from handler registration to command execution and payload delivery.
166168

167-
You’ve now successfully implemented and tested a custom IPMI command in OpenBMC using pre-silicon simulation.
169+
You have now successfully implemented and tested a custom IPMI command in OpenBMC using pre-silicon simulation.
168170

169171
This sets the foundation for adding OEM commands or platform-specific extensions to your BMC firmware.
170172
You can now expand this pattern to support argument parsing, custom data formats, or system-level control—enabling rapid prototyping of features such as sensor telemetry, power domain control, or boot policy configuration.

0 commit comments

Comments
 (0)