I needed to customize the system.img for a generic build (emulator) of an Android 2.3.7b1 ROM. I wanted to add Google Maps to it (as well as Market, etc) and run it in the emulator for a school project of a custom ROM.
I tried adding the necessary files to a running ROM, but the system.img file is reset each time you restart the emulator. There was a temporary copy of the modified in-memory version in my account profile temp folder, but copying it just gave an unbootable image. In the end I found doing a ROM build on my Linux machine and extracting the system.img from the build, adding the files, and repackaging worked.
- system.img to modify (.\android-sdk-windows\platforms\android-10\images is one place to look)
- GoogleServicesFramework.apk and whatever Google apps you want (like Vendor.apk, etc).
- Copy from your existing phone or check out Google Apps download section for CyanogenMod
- Linux (I used Ubuntu 11.04 64-bit)
- unyaffs - (I used the precompiled binary without issue)
- mkyaffs2image - (You also get it if you are building a ROM)
- mkdir EXTRACTED
- cd EXTRACTED
- ~/unyaffs ~/system.img
- Copy whatever you need into the extracted content
- Example: cp ~/GoogleServicesFramework.apk ~/EXTRACTED/app/
- mkyaffs2image EXTRACTED newsystem.img