Commit Graph

351 Commits

Author SHA1 Message Date
Seth Jennings
5e5f3a76f9 Merge pull request #61 from jpoimboe/patch-compile-fail-log
kpatch-build: add patch compile failure output to log
2014-03-14 17:14:33 -05:00
Seth Jennings
37ba81f4ef Merge pull request #60 from jpoimboe/fix-bash-x
kpatch-build: fix SCRIPTDIR for bash -x
2014-03-14 17:01:05 -05:00
Josh Poimboeuf
2aef7d7c41 kpatch-build: add patch compile failure output to log
If the patch doesn't compile, make sure the LOGFILE has the error
output.
2014-03-14 11:12:40 -05:00
Josh Poimboeuf
d4363e0c9b kpatch-build: fix SCRIPTDIR for bash -x
More adventures in bash-land.  Running "bash -x kpatch-build foo.patch"
causes SCRIPTDIR to not get set properly.  This fixes that.
2014-03-14 11:09:29 -05:00
Seth Jennings
c83141be90 Merge pull request #56 from jpoimboe/patch-error-handling
Improve source patch error handling
2014-03-13 17:13:35 -05:00
Seth Jennings
26397afeaf Merge pull request #57 from jpoimboe/no-changed-objects
properly detect no changed objects
2014-03-13 17:06:33 -05:00
Seth Jennings
eb87ccf5fb Merge pull request #58 from jpoimboe/changed-function-output
make the changed function output more readable
2014-03-13 17:04:34 -05:00
Seth Jennings
f3e55ee721 Merge pull request #59 from jpoimboe/compile-debug-symbols
compile tools with -g for debug symbols
2014-03-13 17:02:36 -05:00
Josh Poimboeuf
840a1b3e44 compile tools with -g for debug symbols 2014-03-13 12:28:35 -05:00
Josh Poimboeuf
72af45502f make the changed function output more readable
This makes it much easier to spot which functions have changed,
especially when there are more than one of them.
2014-03-13 12:22:01 -05:00
Josh Poimboeuf
c4ea0ea4ef properly detect no changed objects
The current solution doesn't work because "$?" will always be 0, even if
there were no "CC" lines in the build log.  Instead, just make sure the
changed_objs file isn't empty.
2014-03-13 12:20:13 -05:00
Josh Poimboeuf
72b5f3b4fb try source patch before compiling kernel
Add a patch testing step before compiling the kernel, so that users
don't have to wait for the kernel to compile before seeing if the patch
applies cleanly.

Also allow the printing of the patch command's stdout/stderr to make it
clear what files are being patched and whether there's any fuzz.
2014-03-13 12:08:25 -05:00
Josh Poimboeuf
a611185dce better patch file cleanup
If the patch file fails to apply, it "corrupts" the cache by leaving the
old applied-patch file around.  Fix that by always cleaning up after
ourselves.
2014-03-13 11:53:44 -05:00
Seth Jennings
3acf30c0c8 Merge pull request #50 from jpoimboe/sourcedir-option
kpatch-build: remove "kpatch build" wrapper and add --sourcedir option
2014-03-11 15:03:35 -05:00
Josh Poimboeuf
5ab497a2b3 kpatch-build --sourcedir option
Allow the user to supply a custom kernel source directory.  This copies
the directory to ~/.kpatch/src instead of using it in place.  Otherwise
the "make mrproper" (which is needed for compiling objects in a separate
tree) would modify the original source tree and remove its .config file.

There's currently no caching support for this option.  If needed, we
could implement that pretty easily by calculating an md5sum of the
original source directory.
2014-03-11 10:43:48 -05:00
Josh Poimboeuf
2d728c4f0d make kpatch-build a first class script
kpatch-build is outgrowing the kpatch script and probably is a better
fit as its own utility instead of being wrapped by kpatch.  Install
kpatch-build into /usr/local/bin, remove the kpatch wrapper around it,
and update the README accordingly.
2014-03-11 10:43:48 -05:00
Josh Poimboeuf
9e69a53206 Merge pull request #52 from spartacus06/fixes
add a few comments and st_value !=0 error
2014-03-10 15:13:58 -05:00
Seth Jennings
e8fb5b1c9f fixup comment
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-10 15:11:23 -05:00
Seth Jennings
8b9de30581 add error for sym value != 0
For a local object or function symbol, we expect that
the section offset, sym.st_value, be 0 because we used
-ffunction-sections and -fdata-section during compile.

If value != 0, it undermines assumptions we make and
should return an error.  Exceptions should be handled
on a case by case basis, like __ksymtab_strings.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-10 15:11:23 -05:00
Seth Jennings
582f2b27e0 add comment for __ksymtab_strings case
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-10 14:49:56 -05:00
Josh Poimboeuf
43e1f18141 Merge pull request #51 from spartacus06/testingwork
add automated testing system
2014-03-10 14:38:31 -05:00
Seth Jennings
0cbb7cf5ee add automated testing system
This commit introduces a simple automated testing system
with 3 simple testcase.

For each test case there is a .c, a .patch, and a .inventory
file.  The .c is compiled, using the flags from the kflags file,
to create the original object.  The .c file is then patched
with the .patch file and rebuilt to create the patched object.
The files are then analyzed by the differencing tool and an
output object is generated with a .inventory file that lists
the sections and symbol included in the output object.  That
inventory file is then compared to the .inventory file for
that testcase.  If they are the same, the test passes. If
not, the differences in the inventory files are displayed,
and the test fails.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-10 14:36:11 -05:00
Seth Jennings
abbb12d065 Merge pull request #49 from jpoimboe/show-changed-functions
kpatch-build: show changed functions
2014-03-10 11:24:53 -05:00
Josh Poimboeuf
942fbdf37a kpatch-build: show changed functions
Pipe create-diff-object output to both stdout and the log file, so the
user can see which functions have changed.
2014-03-10 11:18:18 -05:00
Josh Poimboeuf
b95afff9ed Merge pull request #48 from spartacus06/testframework
Testframework
2014-03-10 10:40:19 -05:00
Seth Jennings
8eafea114a add inventory file creation to create-object-diff
In preparation for adding an automated test framework,
add an ability to create-object-diff that will create
a human readable list of included sections and symbols
with type and bind information so that the test framework
can compare against a known-good reference list with the
expected set of sections and symbols.

The file is created when the -i/--inventory option is
used.  The inventory filename is the user supplied output
file name suffixed by .inventory

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-07 17:02:45 -06:00
Seth Jennings
6550dd74f6 replace DEBUG compiler define with -d/--debug runtime option
I'm tired of setting CFLAGS and people shouldn't have to
recompile to get debug output.  This lays the foundations
proper option handling and logging levels.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-07 16:06:32 -06:00
Josh Poimboeuf
50068a640e Merge pull request #46 from spartacus06/fixes
fixup printf formats with -DDEBUG
2014-03-07 13:21:03 -06:00
Seth Jennings
159214a4fc fixup printf formats with -DDEBUG
Fix -Wformat warnings for printf formats with -DDEBUG

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-07 12:07:56 -06:00
Josh Poimboeuf
7618f12f45 Merge pull request #45 from spartacus06/fixes
Fixes
2014-03-05 11:43:23 -06:00
Seth Jennings
2419410a52 fix KPATCH_BUILD path
use the build symlink in /lib/modules for a more portable
path to the build env for the kernel.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-05 11:31:15 -06:00
Seth Jennings
e33695be27 remove dead code
refactoring.  A couple of comment touchups too.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-05 11:26:02 -06:00
Seth Jennings
16fb78696c Merge pull request #44 from jpoimboe/gcc-warnings
enable gcc warnings and fix all warnings
2014-03-05 10:04:36 -06:00
Josh Poimboeuf
693426b5ef enable gcc warnings and fix all warnings 2014-03-05 09:46:10 -06:00
Josh Poimboeuf
81cc4a3542 Merge pull request #37 from spartacus06/fixes
refactor and fix multiple issues
2014-03-05 09:42:22 -06:00
Seth Jennings
949af29309 Merge pull request #43 from jpoimboe/gpl-headers
add GPLv2 headers to source files
2014-03-04 22:45:46 -06:00
Josh Poimboeuf
330a08dd0d add GPLv2 headers to source files 2014-03-04 21:34:19 -06:00
Seth Jennings
f6efd53541 refactor and fix multiple issues
- Fixup debug messages
- Remove dead code
- No more DEPENDENCY state
- Reachability test is now the "Inclusion tree" for determining
  which syms/sections will be included in the output
- 'reachable' field is now and 'include' and is the sole
  consideration in including sections/symbols (no more complex
  conditional checks)
- Order LOCAL before GLOBAL in the symbol table.  Apparently, after
  a FILE sym, all LOCAL symbols should precede GLOBAL syms or readelf
  shows <corrupt>
- Handle __ksymtab_strings section and __ksymtab_* syms

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-04 15:56:41 -06:00
Seth Jennings
5145520695 Merge pull request #41 from puiterwijk/add-license
Add a COPYING file to make it trivial to find the license in a standard place
2014-03-04 09:38:31 -06:00
Patrick Uiterwijk
8ce75225f7 Add a COPYING file to make it trivial to find the license in a standard place 2014-03-04 10:51:58 +01:00
Josh Poimboeuf
179381ac85 Merge pull request #39 from spartacus06/localversionfix
put localversions file in SRCDIR, not OBJDIR
2014-03-02 20:10:45 -06:00
Seth Jennings
d62798fde8 put localversions file in SRCDIR, not OBJDIR
The kernel Makefile look for localversion in the source tree,
not the object tree.  The absense from the source tree results
in a patch module that will not load because the kernel versions
don't match.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-02 19:47:23 -06:00
Seth Jennings
6a36470123 Merge pull request #34 from jpoimboe/cache-fix
build objects in separate directory to fix caching
2014-02-25 09:41:15 -06:00
Seth Jennings
f07a0d9749 Merge pull request #35 from jpoimboe/readme
readme: add some more Q&A's and a limitation
2014-02-20 21:26:11 -06:00
Josh Poimboeuf
c22610646e readme: add some more Q&A's and a limitation 2014-02-20 21:10:46 -06:00
Josh Poimboeuf
5352d8b01a build objects in separate directory to fix caching
Setting KCFLAGS="-ffunction-sections -fdata-sections" causes make to
invalidate all the kernel objects, resulting in all the objects getting
rebuilt on the next pass, thus no build caching.

To fix that, build the objects in a separate directory (obj) for normal
builds, and another separate directory (obj2) for the builds with added
cflags.
2014-02-20 14:52:21 -06:00
Seth Jennings
4f64ad6c2a Merge pull request #33 from jpoimboe/readme-typo
readme typo and grammar fix
2014-02-19 21:59:42 -06:00
Josh Poimboeuf
7ffc0fdeaa readme typo and grammar fix 2014-02-19 21:32:32 -06:00
Seth Jennings
7a63c20011 Merge pull request #32 from jpoimboe/readme-faq
add readme faq
2014-02-19 16:01:32 -06:00
Josh Poimboeuf
af9887c909 add readme faq 2014-02-19 15:56:14 -06:00