Using the patch Command

If you have a special, nonstandard patch to applysuch as a third-party patch for a commercial product, for exampleyou can use the patch command rather than the special patch-kernel script that is normally used for kernel source updates. Here are some quick steps and an alternative method of creating patched code and leaving the original code alone.

1. Create a directory in your home directory and name it something meaningful, like mylinux.

2. Copy the pristine Linux source code there with cp -ravd /usr/src/linux-2.6/* ~/mylinux

3. Copy the patch file to that same directory with cp patch_filename ~/mylinux

4. Change to the ~/mylinux directory with cd ~/mylinux

5. Apply the patch with patch -p1 < patch_filename > mypatch.log 2>&1

(This last bit of code saves the message output to a file so that you can look at it later.)

6. If the patch applies successfully, you are done and have not endangered any of the pristine source code. In case the newly patched code does not work, you will not have to reinstall the original, pristine source code.

7. Copy your new code to /usr/src and make that special symbolic link described elsewhere in the chapter.

4 PREV

Was this article helpful?

0 0

Post a comment