program an atmega328 with a mega

Im planning on putting an atmega 328 onto a shield im making for a mega2560, what would I need to program it on the shield? I imagine I would have to have the serial connected between the two, like miso, mosi, ss, cs but is that it? I have an uno I can just pop it in to reprogram and I probably wont need to but id like to add the capability to the shield in case I want to in the future, I've never even used it as a programmer so I don't know what connections need to be made

You mean load a sketch? TX,RX,RST,5V,G I'm trying to do something similar but it's not working.

how are you trying to do it? I imagine something like setting the option using arduino as isp, then it just working lol I hope its that simple, it makes sense if its just reset, rx,tx,5v,gnd I was just thinking is there a way to tap into the rx,tx pins of a mega and have it go to the other board? I think those lines are from the atmega 8u2 which does the usb to serial, so technically if there was a way to make the mega ignore the transmission the other atmega can use that comm directly? would having like a 3way switch on the autoreset pads work? That should allow the data to pass to the atmega328 with the mega bypassed, or viceversa so long as the new program has the tx/rx lines set as input right?

I'm not sure what the autoreset pads are but I think you are probably suggesting what I was thinking - if you ground the reset pin of the Mega (but obviously not that of the '328) then it will not be able to respond to the serial signals. Therefore, if you connect your shield to the reset, tx and rx pins, you could have something like DIP-switches to ground the Mega's reset pin and connect your '328 to the tx & rx lines. Sounds like it would work to me.

Ok tnat confirms the idea that all I need is rx,tx, rst,5v,gnd but the part im still assuming on is that the bootloader wont do anything unless reset at the proper time right? So if atmega328 is reset and code gets uploaded it will not affect the, mega

Can you use and Arduino Mega as an ISP? I thought that was available on '328 based boards only.

Im not sure, but I think with this way it doesn't mattter since technically the mega is just being bypassed, so the atmega328 still needs a bootloader and is acting as if the mega was never there