Line 26:
Line 26:
</pre>
</pre>
−
If the code consists of more than one source file, they all need to be compiled,
+
Don't forget to put <code>compel/include/uapi/</code> directory into include paths.
−
then linked together with the proper linker flags for compel:
−
<pre>
+
Then link the parasite binary. Include all the .o files needed and compel plugins <code>std</code> and <code>fds</code> by using compel linker script.
−
$ ld foo1.o foo2.o -o foo.o $(compel ldflags)
−
</pre>
−
−
Finally, pack the binary. Packing links the object file with [[compel plugins]].
<pre>
<pre>
−
$ compel pack foo.o -o foo.compel.o [-l ''plugin'' [...]]
+
$ ld foo1.o foo2.o compel/plugins/std.built-in.o compel/plugins/fds.built-ind.o -T compel/arch/$ARCH/scripts/compel-pack.lds.S -o parasite.po
</pre>
</pre>
−
The <code>-l</code> option specifies plugins to be added to the packed binary. The <code>std</code> plugin is added by default, i.e. it does not require any flags.
+
The .po blob can now be loaded as parasite.
−
−
Now, the <code>foo.compel.o</code> is ready for remote execution (note that <code>foo.o</code> was not).
== Running ==
== Running ==