Patching binutil/gcc with WinAVR

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What's the best/fastest way to apply the patches in C:\WinAVR-20080610\source?
What am I doing wrong?
I've tried...

$ *.patch > patch --dry-run

but I get errors when the patch files are parsed.

./00-binutils-2.18-version-WinAVR.patch: WinAVR: command not found
./00-binutils-2.18-version-WinAVR.patch: Need: command not found
./00-binutils-2.18-version-WinAVR.patch: ---------------------------------------
-----------------------------------------: command not found
diff: ../binutils-2.18.orig/bfd/Makefile.am: No such file or directory
diff: ./bfd/Makefile.am: No such file or directory
./00-binutils-2.18-version-WinAVR.patch: ---: command not found
./00-binutils-2.18-version-WinAVR.patch: +++: command not found
./00-binutils-2.18-version-WinAVR.patch: @@: command not found
./00-binutils-2.18-version-WinAVR.patch: srcdir: command not found
./00-binutils-2.18-version-WinAVR.patch: srcdir: command not found
./00-binutils-2.18-version-WinAVR.patch: bfdver.h:: command not found
./00-binutils-2.18-version-WinAVR.patch: @echo: command not found
./00-binutils-2.18-version-WinAVR.patch: line 23: syntax error: unexpected end of file
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What are you trying to accomplish?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try something like

$ patch --dry-run < fixbug.patch

instead. Normally you also need option -p0 or -p1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
What are you trying to accomplish?

I want to patch the source for binutil and gcc with the patch files in WinAVR but I don't know what command line switches I need to use or what I'm doing wrong.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well presumably the thing it's complaining about in 00-binutils-2.18-version-WinAVR.patch is the fact that the first lines say:

Quote:
WinAVR specific only
Need configure options like GCC.
--------------------------------------------------------------------------------

And if you look at what it's doing it appears to be trying to hard code the text " (WinAVR 20080610)" onto the version string - not sure why you'd want to do this on a variant of binutils that wasn't for use in WinAVR 20080610 though?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It doesn't like parsing more then one file for some reason.

This did not work.

Quote:
patch -p0 < *.patch

I can do one at a time...

Quote:
patch -p0 -i 00-binutils-2.18-version-WinAVR.patch

I got version binutils-2.18.50 somewhere on the net but it's the wrong version (doesn't patch properly) I re-downloaded binutils-2.18 which seems to patch fine.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you read the README file in the WinAVR CVS repository regarding the patches?

Why do you want to recreate WinAVR anyway? What problem are you trying to solve?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

EW wrote:
...
Why do you want to recreate WinAVR anyway? What problem are you trying to solve?

No problems, I want to learn how the gcc compiler works.
Then when I do have a problem I'll have a better understanding of what might be the cause (and maybe even try to fix it :)).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah, ok! :-)

And, my apologies. The README file did not contain information about the best way to apply these patches. For some reason I thought it had.

I use this in my build script:

            for i in $startdir/patches/$project/$version/*.patch ; do
                echo "********************************************************************************" | tee -a patch.log
                echo "$i" | tee -a patch.log
                patch -b --verbose --strip=0 --input="$i" 2>&1 | tee -a patch.log
                grep "FAIL" patch.log && abort "Patching failed."
            done

Where:
$startdir = Some directory that contains those specified subdirectories
$project = software project, such as binutils, gcc, avr-libc, insight, etc.
$version = version of the $project, such as 2.18 for binutils

Note that the 'patches' subdirectory in the script snippet above matches the 'patches' module in the WinAVR CVS repository.

The main point is the 'patch' command. The switches that I use are:
-b = Create backup
--verbose = Enable verbose output
-strip=0 = Do not strip any leading directories. This means that you should be at the top level of each project's directory tree when patching. All WinAVR patches are generated to use --strip=0.
--input= = The actual patch filename that is used for input.

HTH
Eric Weddington