I am trying to force the init process of an embedded Linux system to
exec() my own init program (systemd) so that I can test an external filesystem before writing it to the system’s flash (and risk bricking the device). With GDB, I can run the command
gdb --pid=1, then in that shell type
call execl("/lib/systemd/systemd", "systemd", 0) (which works exactly as I need it to), but I do not have enough room to put GDB on the system’s flash.
I was wondering exactly what
ptrace() calls GDB uses with its
call command so that I can implement that in my own simple C program.
I tried using
strace to figure out what
ptrace() calls GDB used, but the resulting file was 172,031 lines long. I also tried looking through its source code, but there were too many files to find what I was looking for.
The device is running Linux kernel version 3.10.0, the configuration is available here: https://pastebin.com/rk0Zux62