<div dir="ltr"><div><div>Hi Josh,<br><br>Yes, I'm indeed calling create-diff-object directly to patch my own module. All the steps are taken from the kpatch bundle itself (kpatch-master/test/testmod/) and can be summarized as follows:<br><br>1) Write a module (let's say orange.c)<br>2) Build orange.ko WITHOUT KCFLAGS="-ffunction-sections -fdata-sections" and preserve it somewhere, may be as orange.ko.sacrosanct<br><br>You may start using the module orange.ko.sacrosanct<br><br>3) Build orange.o WITH KCFLAGS="-ffunction-sections -fdata-sections" and copy orange.o as orange.o.orig<br>4) Make your desired changes in orange.c and again build orange.o WITH KCFLAGS="-ffunction-sections -fdata-sections" and copy it as orange.o.patched<br><br>Now we have all the necessary ingredients.<br><br>5) Now run the following sequentially:<br>    <br>    create-diff-object orange.o.orig orange.o.patched orange.ko.sacrosanct output.o<br>    <br>    Copy output.o to kpatch-master/kmod/patch<br>    <br>    md5sum output.o | awk '{printf "%s\0", $1}' > checksum.tmp<br>    <br>    objcopy --add-section .kpatch.checksum=checksum.tmp --set-section-flags .kpatch.checksum=alloc,load,contents,readonly output.o<br>    <br>    rm -f checksum.tmp<br>    <br>    KBUILD_EXTRA_SYMBOLS="$(readlink -e ../../kmod/core/Module.symvers)" make<br><br>In the kpatch-master/kmod/patch directory, a new kernel object will get created, let's call it kpatch-orange-patch.ko<br><br>6) Run: kpatch install kpatch-oranange-patch.ko<br><br>7) Run: kpatch load kpatch-oranange-patch.ko<br><br>Enjoy...<br><br></div>Regards,<br></div>Somdeep Das<br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 12, 2015 at 8:03 PM, Josh Poimboeuf <span dir="ltr"><<a href="mailto:jpoimboe@redhat.com" target="_blank">jpoimboe@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Jun 12, 2015 at 11:42:00AM +0530, Somdeep Das wrote:<br>
> Hi Josh,<br>
><br>
> First of all, a big thanks for your swift reply.<br>
><br>
> The issue got resolved :). I had been building the "complex" module<br>
> wrongly. I was building the third argument of create-diff-object (which is<br>
> the .ko file) with KCFLAGS="-ffunction-sections -fdata-sections" set. This<br>
> is not to be done apparently. I unset the KCFLAGS while building the .ko<br>
> file and everything went smoothly.<br>
><br>
> Thanks again :).<br>
<br>
</span>Glad it worked!  It sounds like you're calling create-diff-object<br>
directly, in order to create a patch for an out-of-tree module.  Is that<br>
right?  If so, nicely done.  Would you mind sharing the steps you took?<br>
That might be some good info for the README.  Or could possibly even be<br>
a nice feature to add to kpatch-build.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Josh<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">50|V|[)33|></div>
</div>