You are not logged in.
Pages: 1
during my recent ventures with kernel compilation I've run into something I can't quite explain the reason behind
I tried to patch a file, in this case module.c. I cloned the repository, then did a git checkout of a commit. Then I edited the file module.c with the updated line of code. Just one line! Then I ran git diff and pushed it to a patch file. Next I did a git checkout of the module.c file to return it to the original state. Next up I tried patching the file using patch and the patch file. Failure
what am I missing?
laptop% nvim arch/x86/kernel/module.c
laptop% git diff
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 005c03e93fc5..71019b5c9bbc 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -183,6 +183,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
goto overflow;
break;
case R_X86_64_PC32:
+ case R_X86_64_PLT32:
val -= (u64)loc;
*(u32 *)loc = val;
#if 0
laptop%
laptop% nvim plt32.diff
laptop% git checkout arch/x86/kernel/module.c
laptop% patch -p1 -i plt32.diff
patching file arch/x86/kernel/module.c
Hunk #1 FAILED at 183.
1 out of 1 hunk FAILED -- saving rejects to file arch/x86/kernel/module.c.rejOffline
Why is there an nvim call? What does the actual patch file look like? Does it work if you "git diff > plt32.diff"?
Offline
it does work that way. Must be I was missing a newline or something. Either that or the git diff output was altered printing to console.
Now I wonder what exactly it is I’m missing. I copied the entire line from console up to the next prompt. According to Nvim and cat there is no newline. I have no idea what I’m missing doing it the select & shift+ins.
But lesson learned
Offline
maybe the file have tabs and by copying and pasting the tabs are transformed into spaces?
Offline
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
Pages: 1