github.com/inspektor-gadget/inspektor-gadget@v0.28.1/docs/reference/btfgen.md (about)

     1  ---
     2  title: 'btfgen'
     3  weight: 100
     4  description: 'Using btfgen to enable the gadget in systems without BTF'
     5  ---
     6  
     7  [btfgen][btfgen] enables running gadgets on system that don't provide BTF
     8  information. The `ig image build` command generates a new layer on the gadget
     9  image with the BTF information of the types used by the gadget for the most
    10  common kernels available in [btfhub][btfhub], this information is then used when
    11  running the gadget if the kernel doesn't have BTF enabled.
    12  
    13  ## Enabling btfgen
    14  
    15  Given that generating the BTF information for a gadget takes a while, this
    16  support is disabled by default.
    17  
    18  The [btfhub-archive][btfhub-archive] repository needs to be present on the machine:
    19  
    20  ```bash
    21  $ git clone --depth 1 https://github.com/aquasecurity/btfhub-archive/ $HOME/btfhub-archive/
    22  ```
    23  
    24  Then, pass the `--btfgen` and the path of the btfhub-archive repository to the
    25  build command:
    26  
    27  ```bash
    28  $ sudo -E ig image build . --btfgen --btfhub-archive $HOME/btfhub-archive -t myimage
    29  ```
    30  
    31  The resulting image will contain the BTF information and can be pushed, run or
    32  tagged as any other gadget image.
    33  
    34  [btfgen]: https://kinvolk.io/blog/2022/03/btfgen-one-step-closer-to-truly-portable-ebpf-programs/
    35  [btfhub]: https://github.com/aquasecurity/btfhub
    36  [btfhub-archive]: https://github.com/aquasecurity/btfhub-archive/