How to build a simple ROM from Stock Moto ROM
by: frostincredible
-Prerequisites:
---OS's this works on:
-------Ubuntu (recommended)
-------Windows 7
-------Mac OS X
---Minimal Knowledge of Terminal/CMD recommended
1. Find a ROM.zip to start with (must be deodexed if planning to theme ANYTHING). For just plain stock deodexed, use Kejar31's here: http://rootzwiki.com/topic/5061-romcwm-deodexed-debloated-bionic/ (if you release the ROM, be sure to ask if it's alright with him you are using it, and give him credit for the base in the OP of your thread).
2. Install dsixda's Android Kitchen (newest version v0.188). Download and follow install instructions on this page in post 2, (easiest on Ubuntu in my opinion) http://forum.xda-developers.com/showthread.php?t=633246. (I know it says retired, but I have used this on my BIONIC and it works perfect!).
3. Open the folder that you put the Kitchen files in from the instructions in the XDA post. Open your "original_update" folder, and put your ROM.zip from step 1 into this folder.
4. Open Terminal and cd into the folder of your Kitchen, for example, if it was in your home folder you would type:
cd ~/*your username*/Kitchen(if you named the Kitchen folder something else than type that where it says "Kitchen")
5. Run the Kitchen menu by typing this in Terminal:
./menu
6. Choose option 1 "Set up working folder from ROM"
6a. Choose your ROM.zip (should be the only option if you only put in one).
6b. Wait for it to set up working folder. (When asked whether to convert updater-script to update-script choose NOT to do this, leave it as is).
Note: It will tell you that it needs a boot.img to proceed, and whether it should create a fake one, choose yes to make fake one, as it removes it when building the ROM. The reason our ROMs do not contain boot.img’s is because our bootloader is locked, that is where the boot.img is stored. The boot.img on the BIONIC is encrypted, and if the bootloader sees that it is not, it simply does not boot.
7. Use any of the other options available in the kitchen menu that you wish to include (however, recommended to not use the following options: 2, 5, 7, 9, 10, 11, 12, 19, 20, 21, 22, 23, 24. This is because they either will not work with the ROM, are already implemented in Gingerbread (which the BIONIC ships with), can hurt the phone, or are just unnecessary for the current project).
Don’t run option 99 (Build ROM from working directory) yet! And don’t close Terminal!
8. Go to your Kitchen folder and open your WORKING_DIRECTORY_*date here* folder, and open the "system" folder. (Do NOT edit anything in the META-INF folder, unless you are taking "Liberty" out of the updater-script [see Final Note]).
9a. In this folder, you will find all of your ROM's folders, from the apps, to the libs, to the frameworks, to everything. This folder IS the ROM. If you are looking to add a theme to it, you are going to want to edit the following APKs: /system/app/SystemUI.apk, /system/framework/framework-res.apk, /system/framework/moto-res.apk, /system/framework/blur-res.apk.
To edit these files, you will need apktool (again, recommended Ubuntu). To learn how to use and how to install apktool, go here: http://code.google.com/p/android-apktool/
The only real commands you will need to know to use it after you install it (how to install is on the Google Code page linked above) is:
apktool d APK.apk - This will decompile the APK
apktool b APK.apk - This will build the APK.
9b. You can also replace the APKs if you want to do something such as replace the Launcher for expample. To do so, simply delete Blur-Launcher.apk from the /system/app folder, and put in something such as ADWLauncher.apk. MAKE SURE YOU ALWAYS HAVE A LAUNCHER, otherwise you won’t have a home to work the phone from after you install it!!
10. After you are done with any and all modifications you want to make to the ROM, open the Terminal window that you have the Kitchen menu running in. Choose option 99 “Build ROM from working directory” and choose option 1 “Interactive Mode,” choose Y to zipalign, it will build the update.zip, and choose Y when it asks to SIGN the ROM!
Your are completed! Put the completed ROM onto your SDCARD and flash in CWM! Be sure to back up! Be sure you didn’t leave out any important parts! And have fun with your new custom ROM!
Final Note: Before releasing, because you used (assuming you used) Kejar31's base ROM, you will need to take out the "Liberty" banner from the updater-script. To do so, go to your WORKING_DIRECTORY and go to META-INF/com/google/android and open the updater-script in a text editor. Then simply delete all the lines at the beginning of the file that start with "ui_print" and save and you are done. Do this edit BEFORE you build the ROM. After this, it will no longer say "Liberty" while installing.
Edited by frostincredible, 03 March 2012 - 08:14 PM.





