0

I've run into an issue with patch (version 2.6) and was wondering if anyone else has run into this problem:
System A: Virtual Machine (VBOX) with FC21. diff == 3.3, patch == 2.7.5
Generate a Linux kernel patch for ixgbe driver (updating driver to support new HW)
Orig directory: linux/drivers/net/ethernet/intel/ixgbe
update dir: /home/patches/ixgbe-4.0.3
Patch file generated via diff -Naur <orig> <update> > file.patch
File looks OK. There are changed files as well as "new" file being added to the Orig.
Using BuildRoot (2015.08.01) and their patching setup, the patch executes, and works just fine, the driver builds and the image boots.
System B: Corp Server with RHEL6. diff == 2.8.1, patch == 2.6
Copied the entire Buildroot setup to this machine. Modify directory paths and the build runs OK, up until the patch. Output shows that changed files get updated OK, but any "new" file ends up in the "update dir" path, which doesn't exist in this environment. Verified the /home/xx/yy/zz directory DOES exist, that patch created from the filename in the patch file. Why????
System A works just fine, it puts the "new" file in the correct kernel directory.

Anyone seen this strange behavior before? How can I:

  1. tell diff to use the orig directory?
  2. tell patch to use the orig directory? (Build root handles patching via scripts)

Any assistance would be greatly appreciated. . . Stephen

Mr Lister
  • 45,515
  • 15
  • 108
  • 150

1 Answers1

0

TL;DR: to generate the patch, make sure the original and modified directories are side-by-side.

Patches will be applied with -p1, i.e. the first component of the paths will be stripped off. So on the original side, you'll have drivers/net/ethernet/intel/ixgbe/<filename>, but on the patched side, you'll have home/patches/igbe/<filename>. Now it looks like patch 2.6 will take the path at the patched side, which clearly doesn't exist. I'm actually surprised that it does work with later patch versions.

The canonical way to generate patches is to make a copy of the full original source directory, i.e. the entire linux directory, and put that side-by-side with the patched directory. Then you do diff -Naur linux-orig linux-patched from the directory just above. Or, better yet, start from a git-controlled linux directory, make the modification, commit the change, and do git format-patch -1 -o <path-to-buildroot-patches>.

Arnout
  • 2,927
  • 16
  • 24