Skip to content

easy-ebpf/lab-1

Repository files navigation

tutorial-simple-example

  • This repository contains 2 example eBPF programs: minimal and bootstrap.
  • 如需在codespace/devcontainer內編譯bootstrap,則需在編譯參數LD的地方加上/usr/lib/libargp.a
  • 如有#include <asm/types.h>找不到檔案的情況,可以執行下列指令:
sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm

0. Setup Environment

a. VirtualBox

b. Ubuntu

  • sudo apt install -y bpftool libbpf-dev build-essential clang

c. Codespace/devcontainer (不推,有的程式會跑不了)

1. 檔案概述

  • some_program.bpf.c :
    This is the eBPF program we're going to load into the Kernel.

  • some_program.c :
    This file is our frontend in the userspace, and it is responsible for loading the eBPF program into Kernel.

2. 編譯流桯

image