depends on your definition of "boot".
Boot as in from when the kernel starts, to when userspace is ready:
- write a matching perfetto config and start it later on when userspace is ready (you need to enable the same categories you passed to trace_event on the kernel cmdline)
- Set the preserve_ftrace_buffer: true in the trace config, which will read the existing trace buffer
This will allow you to do kernel-only tracing before boot.
If you want other forms of userspace tracing, you'll have to figure out ways to start perfetto early enough, maybe by starting in initird or something similar.
BUt for your stated purposes, the kernel-only tracing might work
Primiano