There you go 🙂 the download links for the official firmware files of the Apple iPhone 3G. This files are in .ipsw format. These files can be loaded on the iPhone via iTunes.
firmware 3.1.3
firmware 3.1.2
firmware 3.1
firmware v3.01 {iPhone 3G (3.0.1/7A400)}
firmware v3.0 {iPhone 3G (3.0/7A341)}
firmware v2.2.1 {iPhone 3G (2.2.1/5H11)}
firmware v2.2 {iPhone 3G (2.2/5G77)}
firmware v2.1 {iPhone 3G (2.1/5F136)}
firmware v2.0.2 {iPhone 3G (2.0.2/5C1)}
firmware v2.0.1 {iPhone 3G (2.0.1/5B108)}
firmware v2.0 {iPhone 3G (2.0/5A347)}