Ok, I realized that though the patch process was able to succeed for the first files and only fail for the last file, it decides not to apply any of the changes. So I went through and made all the changes manually. Then I could compile the optiboot_atmega164p.hex file successfully.
So I put it in the bootloaders folder, and changed the boards.txt to this :
############################################################
atmega164p.name=Sanguino W/ ATmega164P
atmega164p.upload.protocol=stk500
atmega164p.upload.maximum_size=15872
atmega164p.upload.speed=57600
atmega164p.bootloader.low_fuses=0xFF
atmega164p.bootloader.high_fuses=0x9A
atmega164p.bootloader.extended_fuses=0xFF
atmega164p.bootloader.path=atmega
atmega164p.bootloader.file=optiboot_atmega164p.hex
atmega164p.bootloader.unlock_bits=0x3F
atmega164p.bootloader.lock_bits=0x0F
atmega164p.build.mcu=atmega164p
atmega164p.build.f_cpu=16000000L
atmega164p.build.core=arduino
atmega164p.build.variant=standard
##############################################################
Does that seem about right? Perhaps since the previous entry was for the old-style bootloader rather than optiboot there are some more changes required there.
Then using arduino-as-ISP I was able to successfully upload the bootloader to the atmega164p! Unfortunately it still doesn't work yet - I get the 'avrdude: stk500_recv(): programmer is not responding' message when trying to upload a blink sketch via the serial port (both UARTs).
Any ideas of where to proceed from here?
Thanks a lot