new file mode 100644
@@ -0,0 +1,60 @@
+.. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+
+.. _api:
+
+.. contents:: Table of Contents
+ :local:
+ :depth: 1
+
+LIBBPF API
+==================
+
+
+libbpf.h
+------------------
+
+.. doxygenfile:: libbpf.h
+ :project: libbpf
+
+bpf_core_read.h
+------------------
+
+.. doxygenfile:: bpf_core_read.h
+ :project: libbpf
+
+btf.h
+------------------
+
+.. doxygenfile:: btf.h
+ :project: libbpf
+
+bpf_endian.h
+------------------
+
+.. doxygenfile:: bpf_endian.h
+ :project: libbpf
+
+libbpf_common.h
+------------------
+
+.. doxygenfile:: libbpf_common.h
+ :project: libbpf
+
+hashmap.h
+------------------
+
+.. doxygenfile:: hashmap.h
+ :project: libbpf
+
+
+bpf_helpers.h
+------------------
+
+.. doxygenfile:: bpf_helpers.h
+ :project: libbpf
+
+bpf_helper_defs.h
+------------------
+
+.. doxygenfile:: hashmap.h
+ :project: libbpf
new file mode 100644
@@ -0,0 +1,39 @@
+.. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+
+.. _build:
+
+Building libbpf
+=======================================
+
+libelf is an internal dependency of libbpf and thus it is required to link
+against and must be installed on the system for applications to work.
+pkg-config is used by default to find libelf, and the program called
+can be overridden with PKG_CONFIG.
+
+If using pkg-config at build time is not desired, it can be disabled by
+setting NO_PKG_CONFIG=1 when calling make.
+
+To build both static libbpf.a and shared libbpf.so:
+
+.. code-block:: bash
+
+ $ cd src
+ $ make
+
+To build only static libbpf.a library in directory build/ and install them
+together with libbpf headers in a staging directory root/:
+
+.. code-block:: bash
+
+ $ cd src
+ $ mkdir build root
+ $ BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=root make install
+
+To build both static libbpf.a and shared libbpf.so against a custom libelf
+dependency installed in /build/root/ and install them together with libbpf
+headers in a build directory /build/root/:
+
+.. code-block:: bash
+
+ $ cd src
+ $ PKG_CONFIG_PATH=/build/root/lib64/pkgconfig DESTDIR=/build/root make
\ No newline at end of file
@@ -1,3 +1,5 @@
+.. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+
libbpf documentation
=======================================
@@ -13,3 +15,7 @@ be that this was already addressed or answered before.
.. toctree::
:caption: Documentation:
+
+ api
+ naming_convention
+ build
\ No newline at end of file
similarity index 97%
rename from tools/lib/bpf/README.rst
rename to tools/lib/bpf/docs/naming_convention.rst
@@ -1,6 +1,8 @@
.. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
-libbpf API naming convention
+.. _naming_convention:
+
+API naming convention
============================
libbpf API provides access to a few logically separated groups of
@@ -76,7 +78,7 @@ Please take a look at Documentation/networking/af_xdp.rst in the Linux
kernel source tree on how to use XDP sockets and for some common
mistakes in case you do not get any traffic up to user space.
-libbpf ABI
+ABI
==========
libbpf can be both linked statically or used as DSO. To avoid possible
@@ -116,7 +118,8 @@ This bump in ABI version is at most once per kernel development cycle.
For example, if current state of ``libbpf.map`` is:
-.. code-block::
+.. code-block:: c
+
LIBBPF_0.0.1 {
global:
bpf_func_a;
@@ -128,7 +131,8 @@ For example, if current state of ``libbpf.map`` is:
, and a new symbol ``bpf_func_c`` is being introduced, then
``libbpf.map`` should be changed like this:
-.. code-block::
+.. code-block:: c
+
LIBBPF_0.0.1 {
global:
bpf_func_a;
@@ -148,7 +152,7 @@ Format of version script and ways to handle ABI changes, including
incompatible ones, described in details in [1].
Stand-alone build
-=================
+-------------------
Under https://github.com/libbpf/libbpf there is a (semi-)automated
mirror of the mainline's version of libbpf for a stand-alone build.
@@ -157,12 +161,12 @@ However, all changes to libbpf's code base must be upstreamed through
the mainline kernel tree.
License
-=======
+-------------------
libbpf is dual-licensed under LGPL 2.1 and BSD 2-Clause.
Links
-=====
+-------------------
[1] https://www.akkadia.org/drepper/dsohowto.pdf
(Chapter 3. Maintaining APIs and ABIs).
This adds rst files containg documentation files relevant for libbpf development. naming_convention.rst is pulled from the previous README.rst file. api.rst is an index page that links to the api documentation generationg from doxygen+breathe. Signed-off-by: grantseltzer <grantseltzer@gmail.com> --- tools/lib/bpf/docs/api.rst | 60 +++++++++++++++++++ tools/lib/bpf/docs/build.rst | 39 ++++++++++++ tools/lib/bpf/docs/index.rst | 6 ++ .../naming_convention.rst} | 18 +++--- 4 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 tools/lib/bpf/docs/api.rst create mode 100644 tools/lib/bpf/docs/build.rst rename tools/lib/bpf/{README.rst => docs/naming_convention.rst} (97%)