An example to show how to use libbpf for bpf relocate.
For other related examples, please refer to Expanding eBPF Compile Once, Run Everywhere(CO-RE) to Userspace Compatibility
Clone your newly created repository to your local machine:
git clone https://github.com/your_username/your_new_repository.git --recursive
Or after clone the repo, you can update the git submodule with following commands:
git submodule update --init --recursive
For dependencies, it varies from distribution to distribution. You can refer to shell.nix and dockerfile for installation.
On Ubuntu, you may run make install
or
sudo apt-get install -y --no-install-recommends \
libelf1 libelf-dev zlib1g-dev \
make clang llvm
to install dependencies.
To build the project, run the following command:
make build
This will compile your code and create the necessary binaries. You can you the Github Code space
or Github Action
to build the project as well.
You can run the binary with:
sudo src/relo
This template also includes a GitHub action that will automatically build and publish your project when you push to the repository.
To customize this action, edit the .github/workflows/publish.yml
file.
We welcome contributions to improve this template! If you have any ideas or suggestions, feel free to create an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more information.