summaryrefslogtreecommitdiff
path: root/tools/kapi/README.md
blob: 3839f3ff2964a41f04176e09a5b0fa2d6df60beb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# kapi — Kernel API Specification Extractor

Userspace utility that extracts and displays kernel API specifications from
three sources:

- `--source PATH` — parse kerneldoc blocks in a C source file or tree
- `--vmlinux PATH` — decode the `.kapi_specs` ELF section of a compiled vmlinux
- `--debugfs PATH` — read the live specs from `/sys/kernel/debug/kapi/` on a
  running kernel (this is also the mode used when no input option is given, in
  which case PATH is `/sys/kernel/debug`)

Output formats: `plain` (default), `json`, `rst`.

See `Documentation/dev-tools/kernel-api-spec.rst` for the full user guide,
including the kerneldoc DSL reference and the surrounding framework design.

## Build

```
make -C tools/kapi
```

(wraps `cargo build --release`; the binary is produced at
`tools/kapi/target/release/kapi`).

## Usage

```
tools/kapi/target/release/kapi --help
tools/kapi/target/release/kapi --source fs/open.c sys_open
tools/kapi/target/release/kapi --vmlinux vmlinux -f json
tools/kapi/target/release/kapi --debugfs /sys/kernel/debug
```