Is there any way to store information into the atmega128/328's EEPROM during programming? I want to store serial numbers that should be checked during the execution of the program.
The question came up before: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1289908793 and http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1289849174
Depending on your bootloader you can do it with avrdude.
As an alternative you might be able to store it in Flash when programming the Arduino and access the variables as PROGMEM in your code.
I want to store serial numbers that should be checked during the execution of the program.
The usual way is to write a sketch to do just that. Then, upload the sketch that cares about the serial number.
For a serial number you could always connect up a DS18B20 (1-Wire Digital Thermometer) between ground and a digital pin (and use a pull-up resistor). Then with the 1-wire library just query its serial number. As each one is manufactured with a unique serial number burnt into the chip it would be very very hard for someone to fool your code by making a duplicate (if that is what your concern is).
having removed many kinds of copy-protection in my youth let me tell you, those schemes break at their weakest point. If the serial number can't be changed, then change the program that checks for it. So in the end, not much is gained by off-loading the serial number into the thermometer if the Arduino can be reprogrammed.
Yes, I know copy protection is not only useless but very annoying for the genuine purchaser. I've lost track of the number of times that genuine software that I have paid good money for becomes useless after a PC upgrade, unless I track down my receipt, ring the vendor (if they are still in business) and try to get my original copy "unlocked" again.
Still, the "serial number on a chip" could be used to simply track production models, without having to individually program each one's EEPROM. Probably not much point, as programming the EEPROM would probably only take a second.
BTW, probably even more annoying than copy protection are the insulting messages you see every time you pop a DVD player in to watch a movie (again, one you purchased). YOU WOULDN'T STEAL A CAR, it screams at you. SO DON'T STEAL THIS DVD. "But, I purchased it" I think to myself. It's like the signs in store windows: "stealing is a crime". Well, der, I think thieves know that. But they steal stuff anyway.