I got a second-hand Samsung Galaxy S5 for my mum yesterday (a G900I model, from Telstra), and I spent some time getting it ready.
Firstly, I downloaded the most-recent Telstra firmware image. At time of writing, that's G900IDVU1CQJ2. Telstra appears to be the only carrier still releasing stock firmware for this phone, so I downloaded the Telstra version even though we're connecting to Spark New Zealand. This means the phone will at least be running the most up-to-date baseband and modem firmware.
Note - if you try this, and find that …