Optiloader Mega2560 support

IIRC, that was added in the 1.0 Arduino SDK. I assume you're running an older version?

As a work around, change the line to:

Serial.println ("Entered programming mode OK.");