PwnageTool allows you to restore to a custom IPSW file. For instance, you can restore to a pre-jailbroken firmware while simultaneously maintaining your current baseband (and thus your ultrasn0w carrier unlock). You can also add whatever packages you want in the “Expert” mode of PwnageTool, if you wish to pre-install Cydia packages.
[Updated for iOS 5.1.1]
The iPhone Dev Team has updated PwnageTool to version 5.0.1 to support untethered jailbreak on iOS 5.0.1 using Pod2g exploit. All devices (except iPad 2 and iPhne 4s ) are supported. This includes iPhone 4, 3GS, iPad 1, iPod touch 4G/3G and Apple TV.