I suggest using flashtool, it will create the file for you. It may need modifications, but probably the best starting point.