Patches and Diffs Applying a patch or diff may sound complex, but it is relativily trival. This will provide a brief introduction. There is a more detailed article at the Linux Journal web site. The detail below assume that you have a recent diff and patch utility installed on your machine. If you do not, see: diff : GNU Web site patch : GNU Web site svn : svn Creating a diff When you would like to submitting_a_patch some modifications, or changes, that you believe should be included into the mainline project, you must submit a patch. After creating a patch, you are ready to submit it to the project. gcc U-Boot Linux kernel uClinux distribution Each project has it's own coding style - which must be followed. Patches which do not meeting the coding style defined by the mainline project will be rejected without being reviewed. Creating a diff from two files When submitting a change that you have created, the diff utility is used. It is normally used as: diff -Naur olddir newdir > dir.patch this will create a patch file between the old dir and the new dir. Creating a diff from svn checked out files The first step in creating a diff is to ensure that the files that you want added are under version control. rgetz@pinky:~/blackfin-trunk/uclinux-dist/linux-2.6.x> svn status ? svn-commit.2.tmp ? svn-commit.3.tmp ? svn-commit.tmp M include/asm-blackfin/entry.h ? arch/blackfin/kernel/.setup.c.swp M arch/blackfin/kernel/traps.c M arch/blackfin/mach-common/entry.S M drivers/video/fbmem.c You should not have any files that are labeled with a ? which you want to include as part of the patch. The status fields are: A : Added C : Conflicted D : Deleted I : Ignored M : Modified R : Replaced X : item is unversioned, but is used by an externals definition ? : item is not under version control ! : item is missing (removed by non-svn command) or incomplete ~ : versioned item obstructed by some item of a different kind You can add files to version control with the svn add command. Once this is done, you can create the patch with: rgetz@pinky:~/blackfin-trunk/uclinux-dist/linux-2.6.x> svn diff > patchname.diff For more information about svn, see svn information. Patching an application patch -p0 patch linux-2.6.x/ -p1 --dry-run < ../bfin_patch/kgdb_patch/kgdb_bfin_linux-2.6.x.patch patching file linux-2.6.x/ patching file arch/blackfin/Kconfig Hunk #1 succeeded at 908 (offset 94 lines). patching file arch/blackfin/kernel/Makefile patching file arch/blackfin/kernel/kgdb.c patching file arch/blackfin/kernel/kgdb_test.c patching file drivers/net/Makefile patching file drivers/net/kgdb_eth.c patching file drivers/serial/Kconfig patching file drivers/serial/Makefile patching file drivers/serial/bfin_5xx.c patching file drivers/serial/kgdb_bfin_uart.c patching file include/asm-blackfin/kgdb.h patching file include/linux/debugger.h patching file include/linux/kgdb.h patching file kernel/Kconfig.kgdb patching file kernel/Makefile patching file kernel/kgdb.c patching file kernel/sched.c Hunk #2 succeeded at 6867 (offset 5 lines). patching file net/core/netpoll.c diffstat diffstat dir.patch example: rgetz@pinky:~/blackfin-release/uClinux-dist/linux-2.6.x> diffstat ../bfin_patch/kgdb_patch/kgdb_bfin_linux-2.6.x.patch Documentation/blackfin/kgdb_bfin.txt | 151 +++ arch/blackfin/Kconfig | 2 arch/blackfin/kernel/Makefile | 2 arch/blackfin/kernel/kgdb.c | 453 ++++++++++ arch/blackfin/kernel/kgdb_test.c | 112 ++ drivers/net/Makefile | 1 drivers/net/kgdb_eth.c | 160 +++ drivers/serial/Kconfig | 2 drivers/serial/Makefile | 1 drivers/serial/bfin_5xx.c | 105 ++ drivers/serial/kgdb_bfin_uart.c | 92 ++ include/asm-blackfin/kgdb.h | 183 ++++ include/linux/debugger.h | 59 + include/linux/kgdb.h | 185 ++++ kernel/Kconfig.kgdb | 70 + kernel/Makefile | 1 kernel/kgdb.c | 1519 +++++++++++++++++++++++++++++++++++ kernel/sched.c | 4 net/core/netpoll.c | 1 19 files changed, 3102 insertions(+), 1 deletion(-)