Skip to content

Commit 5528737

Browse files
authored
Merge pull request #305 from fujitatomoya/local-build-install-doc
add local build and install procedure in README.md.
2 parents f902a61 + 1e09792 commit 5528737

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,77 @@ For CDI to work the following needs to be done:
6161
- The container runtime should be able to find the CDI file by the device name
6262
and update the container config using CDI file content.
6363

64+
## How to build and install CDI CLI?
65+
66+
### What is the CDI CLI?
67+
68+
The `cdi` command-line tool is a utility for inspecting and interacting with the CDI (Container Device Interface) cache.
69+
It allows developers and system administrators to:
70+
71+
- **List CDI Spec files**: View all available CDI specification files in the configured directories
72+
- **List vendors**: Display registered device vendors in the CDI cache
73+
- **List device classes**: Show available device classes from CDI Specs
74+
- **List devices**: Enumerate all CDI devices available in the system
75+
- **Validate specs**: Verify CDI specification files against the JSON schema
76+
- **Inject devices**: Inject CDI device configurations into OCI runtime specifications
77+
- **Monitor cache**: Watch for changes in the CDI cache and Spec directories
78+
- **Resolve devices**: Resolve fully-qualified device names to their configurations
79+
80+
The CLI tool is particularly useful for debugging CDI configurations, validating spec files, and testing device assignments before deploying them in production environments.
81+
82+
### Building the CDI CLI
83+
84+
To build the CDI command-line tool from source:
85+
86+
```bash
87+
# Clone the repository (if not already done)
88+
git clone https://github.com/cncf-tags/container-device-interface.git
89+
cd container-device-interface
90+
91+
# Build the binary
92+
make
93+
```
94+
95+
This will compile the `cdi` binary and place it in the `bin/` directory along with other utilities like `validate`.
96+
97+
### Install the CDI CLI
98+
99+
After building, install the binary to your system:
100+
101+
```bash
102+
# Install to /usr/local/bin (requires sudo)
103+
sudo install -m 0755 bin/cdi /usr/local/bin/cdi
104+
105+
# Verify installation
106+
cdi --help
107+
```
108+
109+
### Basic Usage
110+
111+
Once installed, you can use the `cdi` command to interact with CDI devices:
112+
113+
```bash
114+
# List all CDI Spec files
115+
cdi specs
116+
117+
# List all available CDI devices
118+
cdi devices
119+
120+
# List all vendors
121+
cdi vendors
122+
123+
# List all device classes
124+
cdi classes
125+
126+
# Validate CDI Spec files
127+
cdi validate
128+
129+
# Monitor CDI cache for changes
130+
cdi monitor
131+
```
132+
133+
Use `cdi --help` or `cdi <command> --help` for detailed information about each command and its options.
134+
64135
## How to configure CDI?
65136

66137
### CRI-O configuration

0 commit comments

Comments
 (0)