sgfxi :: patch rules and samples
In vain hopes that I actually start getting some meaningful help with sgfxi patches, especially fglrx patches, here's a brief list of patch requirements:
For more complete how to on how to use sgfxi itself to do most of these steps, read sgfxi: set test data as well. Keep in mind, for advanced testing, you can also use http://localhost with Apache webserver to test patches and so on.
Basic patching requirements for any potential patch
- provide the download, original source, url for the patch, unless you made it yourself.
- download the ati installer package to some directory of your choice. Here are some typical file name and urls for fglrx / nvidia:
# run file name sample, ati: ati-driver-installer-8-7-x86.x86_64.run # run file name sample, nvidia (NOTE: sgfxi always uses # the pkg0 versions, so make sure to use those too when testing) NVIDIA-Linux-x86-173.14.09-pkg0.run # url, ati: http://www2.ati.com/drivers/linux/ # url, nvidia: http://us.download.nvidia.com/XFree86/Linux-x86/173.14.09/ # full download url, for wget, fglrx: wget -Nc http://www2.ati.com/drivers/linux/ati-driver-installer-8-7-x86.x86_64.run # full download url, for wget, nvidia: wget -Nc http://us.download.nvidia.com/XFree86/Linux-x86/173.14.09/NVIDIA-Linux-x86-173.14.09-pkg0.run
- extract the driver run install package, like so:
# for ati/fglrx bash ./ati-driver-installer-8-7-x86.x86_64.run --extract # for nvidia bash ./NVDIA-Linux-x86-173.14.09-pkg0.run --extract-only
- this will create an install directory, named something like this:
# for fglrx fglrx-install.YzbheK # for nvidia NVDIA-Linux-x86-173.14.09-pkg0
- move into that directory. The last part is random, so it will always be different, but it will always be fglrx-install.....
# for fglrx cd fglrx-install.YzbheK # for nvidia cd NVDIA-Linux-x86-173.14.09-pkg0
- now, get your patch, let's say it's called fglrx-8-7-2.6.26.patch, copy it into that directory, and execute it:
patch -p0 < fglrx-8-7-2.6.26.patch
- And of course, the final step, the patch actually fixes the issue, and the driver works, X starts, things work as expected.
Bad patches, errors, bad hunks, etc
The patch should execute with no errors, no bad hunks, and ideally, no offset lines. When patch runs, a successful patch looks like this:
patching file common/lib/modules/fglrx/build_mod/firegl_public.c patching file common/lib/modules/fglrx/build_mod/firegl_public.h
while a bad patch will have offsets, hunk failed messages, and so on, or:
can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: --------------------------
which means you didn't use the correct path in the patch itself.
Correctly done patches for sgfxi should be able to be run from inside the directory, which means they have a relative full path to the file in question, like so:
# for an fglrx patch, for instance: --- common/lib/modules/fglrx/build_mod/firegl_public.c 2008-07-21 14:32:08.000000000 -0400 +++ common/lib/modules/fglrx/build_mod/firegl_public.c 2008-07-21 14:31:48.000000000 -0400 @@ -24,13 +24,13 @@ # or you can use something like this: diff -ru common/lib/modules/fglrx/build_mod/firegl_public.c common/lib/modules/fglrx/build_mod.2.6.26-8-6/firegl_public.c --- common/lib/modules/fglrx/build_mod/firegl_public.c +++ common/lib/modules/fglrx/build_mod.2.6.26-8-6/firegl_public.c @@ -24,13 +24,13 @@ # nvidia patches, done usually by nvidia programmers, usually look like this: diff -ru usr/src/nv/nv-linux.h usr/src/nv.2404825/nv-linux.h --- usr/src/nv/nv-linux.h 2008-04-02 01:17:56.000000000 -0700 +++ usr/src/nv.2404825/nv-linux.h 2008-05-06 16:22:16.603101044 -0700 @@ -145,16 +145,19 @@
And that's about it. If the patch works, it will pass these tests, and I should be able to drop it into sgfxi without any further modifications.
Anyone can do these tests, but only people with ATI cards can test the actual driver, if it works, etc.