# Sticky  [HOW-TO] Build a simple ROM with stock Moto base.



## frostincredible

*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:



Code:


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:



Code:


./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.


----------



## bionicmonkey

Awesome always wanted to try building a ROM can't wait to try


----------



## _matt

Thanks for this


----------



## belatukadro

frost, thank you soooooo much for this. I have been searching for something like this to try and get a toe dipped into dev, as its something I really want to do.
I think i'll give it a try tomorrow after I get linux up on my lappy :-D.


----------



## darkrom

Thank you!!!

Tomorrow @ work = adderall + vm ubuntu and an attempt at a rom of my own.


----------



## sjflowerhorn

Nice post.


----------



## terryrook

You are the fuc#ing man! This is the clearest, most well and most needed thread in our section imho. Watch and see what people do with this. Ive already started. Seriously my wife is hot,ill send you pics if you want. I owe you big time. Thank you for sharing your knowledge with the rest of us. For those that cant tell I AM TOTALLY JOCKING RIGHT NOW. Not to be confused with joking.


----------



## darkrom

Will safestrap work with a rom created using the De-bloat linked here or will we have to change anything to make it work?

Also, could I use the same guide and use Theoryrom or eclipse or something? Just curious. Due to my lack of experience I'll start with the de-bloat, but the safestrap question is kind of important.


----------



## frostincredible

darkrom said:


> Will safestrap work with a rom created using the De-bloat linked here or will we have to change anything to make it work?
> 
> Also, could I use the same guide and use Theoryrom or eclipse or something? Just curious. Due to my lack of experience I'll start with the de-bloat, but the safestrap question is kind of important.


I haven't tried it with Safestrap, so I can't speak from that perspective. I don't really know if there's a difference in the way updater scripts are written for Safestrap or if they're the same...but to the Th3oryRom or Eclipse question, yes, you can use them too, but don't release without getting permission from DT or nitro, always give credit.


----------



## runandhide05

Correct me if i an wrong but u can use a backup of stock ROM to use as your base, at least I was with the gs2, captivste, and the dx


----------



## darkrom

frostincredible said:


> I haven't tried it with Safestrap, so I can't speak from that perspective. I don't really know if there's a difference in the way updater scripts are written for Safestrap or if they're the same...but to the Th3oryRom or Eclipse question, yes, you can use them too, but don't release without getting permission from DT or nitro, always give credit.


Always would give credit. I'm at no skill level to release shit lol.


----------



## xkape

terryrook said:


> You are the fuc#ing man! This is the clearest, most well and most needed thread in our section imho. Watch and see what people do with this. Ive already started. Seriously my wife is hot,ill send you pics if you want. I owe you big time. Thank you for sharing your knowledge with the rest of us. For those that cant tell I AM TOTALLY JOCKING RIGHT NOW. Not to be confused with joking.


I will take you up on this offer..lol ... yes i will.


----------



## darkrom

Woot. Darkrom Alpha 1 booted lol.

I added a random APK for adw launcher and it didn't seem to do anything. Still uses blur launcher, but I didn't see the blur launcher APK anywhere to remove. Would have thought it would have made me pick one or the other.

This is really cool, but without any thememing skills am I really just adding or removing APKs? Is there more I can do with the kitchen?


----------



## frostincredible

darkrom said:


> Woot. Darkrom Alpha 1 booted lol.
> 
> I added a random APK for adw launcher and it didn't seem to do anything. Still uses blur launcher, but I didn't see the blur launcher APK anywhere to remove. Would have thought it would have made me pick one or the other.
> 
> This is really cool, but without any thememing skills am I really just adding or removing APKs? Is there more I can do with the kitchen?


Are you using Kejar's or a different base?

And yes, there's not much else to do than that if you aren't editing APKs.


----------



## fightinillini94

frostincredible said:


> Are you using Kejar's or a different base?
> 
> And yes, there's not much else to do than that if you aren't editing APKs.


Thanks for the tutorial. It is greatly appreciated. Do you know how to compile roms from source like cyanogemmod? I would love to get into it.


----------



## frostincredible

fightinillini94 said:


> Thanks for the tutorial. It is greatly appreciated. Do you know how to compile roms from source like cyanogemmod? I would love to get into it.


I kind of sort of do...if you follow Googles instructions at http://source.android.com/ it helps a lot. But where it gives you the AOSP repo, just put in CMs instead (or dhackers if you want the ICS4DB files).


----------



## fightinillini94

frostincredible said:


> I kind of sort of do...if you follow Googles instructions at http://source.android.com/ it helps a lot. But where it gives you the AOSP repo, just put in CMs instead (or dhackers if you want the ICS4DB files).


Ok thanks for the link!


----------



## darkrom

Thanks. This is really interesting stuff. Maybe ill learn me some things.


----------



## terryrook

this is helping me so much its gross, I'm getting good at some of it, still bad at others, but im creating something, just not sure what it is, I am now a master at restores, well honestly I've always been a master at restores but its not something I like to brag about"hey I'm so lame I bricked 6 times today! DDOOOIIIII DUHHH. I like to eat paste too"


----------



## frostincredible

terryrook said:


> this is helping me so much its gross, I'm getting good at some of it, still bad at others, but im creating something, just not sure what it is, I am now a master at restores, well honestly I've always been a master at restores but its not something I like to brag about"hey I'm so lame I bricked 6 times today! DDOOOIIIII DUHHH. I like to eat paste too"


You're posts make me lol








And glad it's helping, looking forward to what you make!!


----------



## terryrook

frostincredible said:


> You're posts make me lol
> 
> 
> 
> 
> 
> 
> 
> 
> And glad it's helping, looking forward to what you make!!


Question, im trying to add the theme Chooser (well my horrible version but it's slowly yelling at me to give up) but 1 thing i will never give up on is the volume button music controls from cm. Again im missing something, everything i try i get fc's on 1 thing or another, does anyone know if its linked to cm lockscreen music control? I. Would think it would have to be, wow i need to sleep. Working nights right now and it just occurred to me that I should just google it.... Sorry guys. Im tired. At& t sucks and they want this LTE site complete by Wednesday. I haven't told my guy's yet so keep that shit on the hhdl.


----------



## darkrom

All I've managed to do is remove shit I don't personally like from the eclipse 1.1.2 to make it a little leaner than it already is.

How do you do the stuff that has been done by liberty theory and eclipse? They didn't just add apks lol. Are those "big" changes in the frameworks? Im really interested in rom creation. I plan on sticking with android as long as I can, so learning to create my own roms would be great fun.


----------



## frostincredible

terryrook said:


> All I've managed to do is remove shit I don't personally like from the eclipse 1.1.2 to make it a little leaner than it already is.
> 
> How do you do the stuff that has been done by liberty theory and eclipse? They didn't just add apks lol. Are those "big" changes in the frameworks? Im really interested in rom creation. I plan on sticking with android as long as I can, so learning to create my own roms would be great fun.


Yeah, those are major edits...Liberty actually compiles application from CM source and modifies them to use the services in the phone, so that part is a little beyond me. Theory I believe is mostly going to be Framework/APK/Jar editing. A lot of it. Same with Eclipse. I'm sure you could ask either of them and they would be happy to throw you some tips on how to do things like the Power Menu and Pulldown Toggles.


----------



## darkrom

Thanks. This is pretty difficult stuff with framework mods but I am really interested. Hopefully I don't give up.


----------



## terryrook

darkrom said:


> Thanks. This is pretty difficult stuff with framework mods but I am really interested. Hopefully I don't give up.


Dont give up, we need you. I'm ready to throw my lappy in the pool but I'm not gonna, I'm just gonna reboot and start over, we can do this shite.


----------



## darkrom

terryrook said:


> Dont give up, we need you. I'm ready to throw my lappy in the pool but I'm not gonna, I'm just gonna reboot and start over, we can do this shite.


I can remove apks and stuff like swype so far and that us pretty much it. Universal inbox, webtop, whatever. I tried adding ADW launcher into the debloated stock. Put it with the rest of the apks. Didn't do anything when I pressed home button and wasn't in the app drawer. I also couldn't find blur launcher apk. Where is that located for future reference?

If I can find a full copy of the update to download and work on I can make a debloat. To be honest I uses cheesecake a long time ago, forgot what update I took (one of the. 893s) and then had to use fastboot to restore my phone. Id like to figure out what the hell I am running so I can start looking more into this ota. If I get the ota ill release a "heavily debloated" stock rom.


----------



## ro6666lt

this is a great How-to, but the dev subforum is reserved for releases. moved to bionic general and pinned.


----------



## terryrook

No offense is intended toward you sir and moving this isn't why I say the mods around here are a little ocd about where everything is and this being moved to general is confusing. Its the moving of other things that motivated this post, if its organization your going for, moving this to general is definately not "keeping your section tidy" it is in fact confusing to a lot of us, its about development, true is not a release but I think it would be best for all if a sub forum were created within development for things such as this, the theme instructions, anything else that pertains to do it yourself which is what we are trying to do. Pinning it is wonderful but* please consider my request for a sub forum to development called do it yourself* or terry rook's whining section, or even "this guy cried so much we had to almost give him a bro hug" as this is not your every day "General thread". Thanks for listening (or ignoring, ultimately its up to you) ro6666lt!


----------



## frostincredible

ro6666lt said:


> No offense is intended toward you sir and moving this isn't why I say the mods around here are a little ocd about where everything is and this being moved to general is confusing. Its the moving of other things that motivated this post, if its organization your going for, moving this to general is definately not "keeping your section tidy" it is in fact confusing to a lot of us, its about development, true is not a release but I think it would be best for all if a sub forum were created within development for things such as this, the theme instructions, anything else that pertains to do it yourself which is what we are trying to do. Pinning it is wonderful but* please consider my request for a sub forum to development called do it yourself* or terry rook's whining section, or even "this guy cried so much we had to almost give him a bro hug" as this is not your every day "General thread". Thanks for listening (or ignoring, ultimately its up to you) ro6666lt!


I agree with the "Do-It-Yourself" sub forums, but I understand why he moved it. I would second having the DIY sub forum.


----------



## terryrook

I've been scouring forums and cm githubs (I have no clue how to get them) looking for any trace of how to impliment lockscreen volume music control and whether or not its tied to the kernel. Can someone that knows more than me (anyone) point me in the right direction?


----------



## darkrom

Thread activity has stopped since this was moved


----------



## terryrook

darkrom said:


> Thread activity has stopped since this was moved


Thats cause no one can find it unless they're on their pcs. PLEASE move it to a subforum. I had to look for it this morning. I. Thought it had been deleted.


----------



## darkrom

If I had not subscribed I would have thought it was deleted too. Not trying to piss off the mods, but if anything I really think this should be an exception to the "dev section for releases only" rule.

I just don't want it to become a ghost town in here. This is one of the most useful threads ever and has sparked interest in rom creation with me.


----------



## frostincredible

darkrom said:


> *This is one of the most useful threads ever* and has sparked interest in rom creation with me.


----------



## frostincredible

And I couldn't find it on my phone earlier either...because I forgot it had been pinned...lol....


----------



## willbur73

This thread has unlocked an newfound passion! I literally have learned more in the last 48 hours about the true underside of Android. It is fascinating. I just wish I had started earlier so that I could be farther now!

Thanks for the tools to get started. I figure in the long run, the best route would be that of kjar and jrummy by building things from source. Props to them! I never quite understood how involved even small changes can be.


----------



## darkrom

willbur73 said:


> This thread has unlocked an newfound passion! I literally have learned more in the last 48 hours about the true underside of Android. It is fascinating. I just wish I had started earlier so that I could be farther now!
> 
> Thanks for the tools to get started. I figure in the long run, the best route would be that of kjar and jrummy by building things from source. Props to them! I never quite understood how involved even small changes can be.


Yes this thread is a game changer. I love it!


----------



## frostincredible

Woo! Check who got Dev status. Lol, this guy!








And thanks for the compliments on the thread. Just trying to help get more knowledge out there.


----------



## fxmech

Bionic is my first Android phone (and one with the potential to run full linux, who knew?) -- I am excited. After a few months I've run all the major ROM distributions available, not to mention many subversions! It turns out I learned a little about what my preference really is when it comes to my phone, and none of them *quite* get down to how I like.

A few years of coding and various studies have me up and running with the basics in a reasonable amount of time. I consider myself to be pro Recovery already as well. Tomorrow I will put it to the test and start dabbling in the ROM arena!!

Self-satisfaction here I am.

_P.S. Long time lurker, first time poster. Greetings._


----------



## darkrom

fxmech said:


> Bionic is my first Android phone (and one with the potential to run full linux, who knew?) -- I am excited. After a few months I've run all the major ROM distributions available, not to mention many subversions! It turns out I learned a little about what my preference really is when it comes to my phone, and none of them *quite* get down to how I like.
> 
> A few years of coding and various studies have me up and running with the basics in a reasonable amount of time. I consider myself to be pro Recovery already as well. Tomorrow I will put it to the test and start dabbling in the ROM arena!!
> 
> Self-satisfaction here I am.
> 
> P.S. Long time lurker, first time poster. Greetings.


Good luck. No point in a gingerbread rom IMO with ics so close!


----------



## fxmech

Good point, with that being the case I will just familiarize myself with the tools.


----------



## terryrook

frostincredible said:


> Woo! Check who got Dev status. Lol, this guy!
> 
> 
> 
> 
> 
> 
> 
> 
> And thanks for the compliments on the thread. Just trying to help get more knowledge out there.


Hell ya! Congrats man, I have a feeling in my pants that YOUR gonna be the one to teach me how to port a froyo theme to gingerbread, or maybe I just need a shower...who knows, seriously though you earned that badge!


----------



## heavyMGS

I might give this a go and see what I can do. Seems like an excellent starting point for learning.

Thanks.


----------



## skatastic

Can this be used to add "screenshot" to the long press power button menu like liberty has to other roms?


----------



## freddy0872

Does anyone have the ability to upload a gingerbread rom for use in this? My understanding you need to have some what stock rom. Or can you some how pull it from the fxz? Even better is there a way to get access to an ics rom for use in this? Id love to crack at this.  any help on how to now get source files would be of great help!  thanks guys

Also what is up with the mobile app? It keeps erroring out on me. Can not use it at all???


----------



## darkrom

You can use any rom as your base for this I believe. I used Eclipse 2.0 for my own personal rom.


----------



## lpmboss

*QUESTION: When flashing my ROM I get the error "mount expects 4 args got 3" or similar.*

This refers to the fact your mount command takes 4 parameters (e.g. ext4, EMMC, /dev/block/.., /system) and your update-binary file only checks for 3 parameters. You'll have to change the update-binary file to a compatible one, found under the /tools/update_files folder. Just copy the appropriate file and rename to update-binary. e.g. If you're going to be using MTD partitions, copy 'mtd-update-binary' to /META-INF/com/google/android as "update-binary".
....
this isnt seeming to work for me .. any help??


----------



## lpmboss

nevermind the previous post... ima noob for not reading .., it works.. woohooo


----------



## Lockett

Sorry for the n00b question but I cannot get the menu to open. I've tried using every variation I could think of: ./menu, menu, .menu, /menu, etc. and nothing seems to work. I'm running windows 7. Any idea what's going on here? I opened the terminal in the Kitchen folder.


----------



## frostincredible

Lockett said:


> Sorry for the n00b question but I cannot get the menu to open. I've tried using every variation I could think of: ./menu, menu, .menu, /menu, etc. and nothing seems to work. I'm running windows 7. Any idea what's going on here? I opened the terminal in the Kitchen folder.


If you're in Windows you need to use Cygwin. Do you have that set up? If not check the page where the Kitchen was downloaded and follow the instructions on that page.


----------



## frostincredible

freddy0872 said:


> Does anyone have the ability to upload a gingerbread rom for use in this? My understanding you need to have some what stock rom. Or can you some how pull it from the fxz? Even better is there a way to get access to an ics rom for use in this? Id love to crack at this.  any help on how to now get source files would be of great help!  thanks guys
> 
> Also what is up with the mobile app? It keeps erroring out on me. Can not use it at all???


The app is giving me an error as well, you have to get the new tapatalk (or something like that) version. And you can use the FXZ if you untar and put the system.img in the Kitchen "original_update" folder. As for Ice Cream Sandwich, if you want a pure AOSP ROM, this is not the method to use. You would need to download the AOSP source and build it from there (I am having trouble doing that with this device, but some have figured it out, e.g. dhacker).


----------



## Lockett

Nope, don't have that. I'll give that a shot and see how I make out. Maybe the OP should add that in there so new guys don't sit there scratching their heads while screaming at their computers lol.


----------



## frostincredible

frostincredible said:


> 2. Install dsixda's Android Kitchen (newest version v0.180). *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!).


I do have that in the OP, it says to follow instructions on that page.


----------



## ossicle

i'm having a ridiculous time trying to make simple edits to xml files using apktool. I've installed apktool and i've done apktool if framework-res.apk/moto-res.apk/blur-res.apk but the apps never work anymore after i recompile them with the edits, even though apktool doesn't give any errors. if anyone is able to modify xml files and recompile working apks i'd really like to see which version of apktool they're using and whether i am missing any steps.


----------



## frostincredible

ossicle said:


> i'm having a ridiculous time trying to make simple edits to xml files using apktool. I've installed apktool and i've done apktool if framework-res.apk/moto-res.apk/blur-res.apk but the apps never work anymore after i recompile them with the edits, even though apktool doesn't give any errors. if anyone is able to modify xml files and recompile working apks i'd really like to see which version of apktool they're using and whether i am missing any steps.


I would definitely try asking a themer such as Mastur_Mynd that question, I'm pretty sure he would know. I haven't done XML edits yet.


----------



## willbur73

ossicle said:


> i'm having a ridiculous time trying to make simple edits to xml files using apktool. I've installed apktool and i've done apktool if framework-res.apk/moto-res.apk/blur-res.apk but the apps never work anymore after i recompile them with the edits, even though apktool doesn't give any errors. if anyone is able to modify xml files and recompile working apks i'd really like to see which version of apktool they're using and whether i am missing any steps.


Use Apk Multi Tool. The issue with apktool is that after messing with the app, you would have to re sign it. Apk multi tool has easy options to decompile, recompile, then sign the apk file.

easy as pie.


----------



## klick37

Is it possible to build on a 901 base?


----------



## frostincredible

klick37 said:


> Is it possible to build on a 901 base?


If you can find a system.img for it.


----------



## jpnestel

frostincredible said:


> If you can find a system.img for it.


I have a system dump of .901 in my drop box if that helps anyone... I don't know anything about developing but id be happy to contribute anything I can to anyone who does

Sent from my DROID BIONIC using Tapatalk


----------



## frostincredible

jpnestel said:


> I have a system dump of .901 in my drop box if that helps anyone... I don't know anything about developing but id be happy to contribute anything I can to anyone who does
> 
> Sent from my DROID BIONIC using Tapatalk


If you could zip that system dump and post a link that'd help


----------



## jwest06

Thanks a ton for this! Works great.


----------



## Lockett

frostincredible said:


> I do have that in the OP, it says to follow instructions on that page.


Good call. That's what I get for not reading. I'm now getting an error saying that "clear" isn't installed.


----------



## lownignitus

So my understanding is that using this you can make a flashable STOCK bionic rom? Cause Ive been looking everywhere for a copy to flash on the unsfae side of SafeStrap to mess with.


----------



## xlightwaverx

I hear if you're smart you can make this work for the Razr  Anyone up for some schooling? 

X


----------



## Jmath679

I am considering learning to cook and I was wondering if the kitchen listed here works with jb on the bionic.

Sent from my DROID BIONIC using Tapatalk 2


----------



## Jmath679

I guess I will look elsewhere for answers.

Sent from my DROID BIONIC using Tapatalk 2


----------

