getting the bootloader source to compile

I want to re-compile the Arduino mega2560 bootloader.

I have the files from the Arduino IDE folder C:\arduino\1.5.5\hardware\arduino\avr\bootloaders\stk500v2

which includes a makefile.

If I run ‘make all’ in a command prompt window I get

C:\boot>make all
The system cannot find the path specified.
ECHO is off.
-------- begin --------
avr-gcc (AVR_8_bit_GNU_Toolchain_3.3.1_466) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-f was unexpected at this time.
make: *** [sizebefore] Error 255

I am guessing that make can’t find something?

It’s having problems with this line in the makefile:

sizebefore:
@if test -f (TARGET).elf; then echo; echo (MSG_SIZE_BEFORE); $(ELFSIZE);
2>/dev/null; echo; fi

Sorted now.

Needed to add the paths to winavr to the command prompt environment variables.

Not quite out of the woods as the rebuilt hex file has one slight difference!

:10E1B000652020203D20004D617220323520323014 new
:10E1B000652020203D20004D617220203720323024 old

:10E1C000313500312E362E3700342E332E330056A3 new
:10E1C000313300312E362E3800342E332E350056A2 old

A minor difference, question is will it be a problem…?

Sort of thing that crashes the lander 2000 miles from where it’s supposed to be…