kpatch-build: ubuntu fix for vmlinux_3 error

kpatch load fails on Ubuntu with:

  kpatch: unable to find module 'vmlinux_3'

The root cause is that the vmlinux file on Ubuntu is named
vmlinux-3.13.0-24-generic instead of just vmlinux.

Let's just call it "vmlinux" in the objname field.
This commit is contained in:
Josh Poimboeuf 2014-06-12 16:53:19 -05:00
parent 3ca8106987
commit e0416a3b42
1 changed files with 11 additions and 7 deletions

View File

@ -2125,6 +2125,9 @@ int main(int argc, char *argv[])
/* extract module name (destructive to arguments.modulefile) */ /* extract module name (destructive to arguments.modulefile) */
name = basename(arguments.args[2]); name = basename(arguments.args[2]);
if (!strncmp(name, "vmlinux-", 8))
name = "vmlinux";
else {
pos = strchr(name,'.'); pos = strchr(name,'.');
if (pos) { if (pos) {
/* kernel module */ /* kernel module */
@ -2133,6 +2136,7 @@ int main(int argc, char *argv[])
while ((pos = strchr(pos, '-'))) while ((pos = strchr(pos, '-')))
*pos++ = '_'; *pos++ = '_';
} }
}
/* create strings, patches, and dynrelas sections */ /* create strings, patches, and dynrelas sections */
kpatch_create_strings_elements(kelf_out); kpatch_create_strings_elements(kelf_out);