atmega1284 programming from a 328 chip

Having investigated this a bit, it seems that the problem is because the Optiboot loader resets the ATMega328 when the serial port is opened. When avrdude is started up to program the slave chip it firsts opens the serial port then tries immediately to write to it. The initial comms fail because the chip has reset and, whilst in the bootloader, isn’t actually responding to the STK500 protocol.

This doesn't make much sense, because practically every 328 chip anymore uses optiboot, and they don't
fail. Unless there is some issue between uploading using the Arduino IDE via the comport, versus using a
separate programmer.

Also, as mentioned in the other recent 1284 threads, I and others have been using optiboot on the 1284
and uploading using the Arduino IDE, and it works [although a lot of people are having a 1284P problem,
still unresolved]. In my case, it always works for 328, 1284, 1284P, optiboot, 84 KByte uploads, and
the Arduino IDE in all versions.