How to make your own Android ROM

How to make your own Android ROM

 

APC's custom Galaxy S3 Android ROm

Our special APC magazine Galaxy S3 ROM build.

You’ll need this:

You know you’re a hardcore Android user when you buy a new smartphone and your first thought is to see if there’s a CyanogenMod ROM available for it yet. Custom ROMs have become a bit of an underground industry as users worldwide look to try and ditch the corporate bloatware and create a lean phone experience.

CyanogenMod would easily be the most well-known community ROM maker and it has a brilliant track record of being able to create incredibly lean ROMs at a fraction in size of their stock corporate counterparts. But as good as CyanogenMod is for shrinking ROMs sometimes the cost can be a bit high.

CyanogenMod is based on the Android Open Source Project (AOSP) – if you like a vanilla version of the latest available Android release. However it means the CyanogenMod team has to build a custom version for each phone baking in the device drivers for each phone’s functionality and it doesn’t always include everything. For example a recent CM10.1 ROM I loaded into my Galaxy S III didn’t support MHL (Mobile High-definition Link) so I lost the ability to watch Netflix on my big-screen TV from my phone. As much as I wanted to use CyanogenMod losing my big-screen video streaming was a bit of a deal-breaker.

Generally there are two ways you can create a custom ROM for your phone: you can start from scratch with AOSP or you can build on an official stock ROM and customise it yourself. AOSP is a lot of work so props to CyanogenMod for the work it does but we’re going to look at how to create a custom ROM from a stock release and at the same time introduce you to the Kitchen.

Getting into the Kitchen

Customising a ROM is a complicated process on one level but on another it’s like working on a multi-layer ZIP file. In a nutshell you extract a ROM’s contents out of its archive into a working folder remove the ROM parts you don’t want (the bloatware) and make any other changes you want (root access for example) stitch the ROM back up and archive it.

We’re grossly simplifying it but that’s roughly what you do. You can choose to do all of this by hand although in the Aladdin’s cave that is the XDA Developers forum (xda-developers.com) you’ll find a very convenient tool to help simplify the process. It’s called Android Kitchen.

Android Kitchen isn’t going to turn you into a ROM god overnight but even if you never actually flash your phone with your own customised ROM it’ll still open up the world of ROM development and give you a taste of how Android works underneath. That said I’ve now used it to create custom ROMs for a number of devices – my now-deceased HTC Desire (deceased because I dropped it) and my Galaxy S II and S III. So if I can do it how hard can it be?

Phone support

There are a few ‘kitchen’ tools available but Android Kitchen is one of the best around and has a surprisingly good list of supported phones including (but not limited to):

  • Samsung Galaxy S4 S3 S2
  • Samsung Galaxy Note/Note 2
  • HTC One/S/X/XL/V

For the full list of supported phones check out the XDA developers Android Kitchen thread and search out the device support in the first post. Android Kitchen is now under part-time development yet it still covers most of the popular phones released over the last couple of years.

There’s a way to add other phones not listed in the compatibility list but that’s beyond the scope of this series for now. Still if you have one of these supported phones you have the potential to create your own custom ROMs with Android Kitchen.

Galaxy S3

Samsung’s Galaxy S III is one of a number of phones supported by Android Kitchen.

Building the platform

Before we start the first thing we need is a development platform – Android Kitchen is a Java-based Linux console app that works in Mac OS X Linux or Windows. To use Windows you need to create a Cygwin environment first. Cygwin is a set of tools that creates something of a Linux environment and includes a Linux API (application programming interface) to allow some low-level Linux code to run under Windows. As Cygwin itself is keen to point out it’s not a way to make Windows aware of Linux’s peculiar ways or to run Linux apps natively on Windows.

The problem with Cygwin however is that it can have problems with symbolic file links that often exist within ROMs and can occasionally muck up which is a bit disastrous for you if you’re trying to make a ROM to run your phone. The last thing you want is a flaky ROM. Android Kitchen app developer [dsixda] has done plenty to make the app work as well as it can under Cygwin although we think the safer option and the one we’ll go with is to use a native Linux system. [dsixda] recommends Ubuntu and we’re using Xubuntu which is almost the same thing just a bit smaller and uses the old school Xfce desktop which is a little more Windows-like.

Creating a virtual machine

If you already have a Linux computer ready to go that’s great. If not rather than build a separate Linux box we’ll recommend you cheat and go with virtualisation. Using VMware Player 5.0.2 we’ll build an Xubuntu 13.04 virtual machine (VM) that runs as an app on your existing Windows computer. You’ll need your computer running at least Windows XP SP3 or later then grab the latest version of VMware Player 5 from filehippo.com and follow the instructions to install it. Don’t do anything else with it for now.

VMware Player virtual machine

Create a VMware Player virtual machine from an ISO image or Live CD.

Next you need a Linux distro. We’ve had a couple of these over the last year or so on our APC cover discs but really any Ubuntu-based distro will be fine – it doesn’t have to be the latest release. If you don’t have anything grab the 32-bit Xubuntu 13.04 ISO image from tinyurl.com/l4o5ron. It’s 827MB and we’ll use this to build a complete Xubuntu Linux VM that you can use to run almost any Linux software. (You can use the 64-bit version but for our needs the 32-bit option will be simpler and we’ll use this instead.)

VM requirements

VMs run in software but they need real hardware to work – you’ll need a PC with at least 3GB of memory (preferably 4GB) and a minimum of 40GB of drive space free. Using VMware Player we’re now ready to build a VM with 1GB of RAM and 20GB of hard drive space. That’s enough room to install Ubuntu Linux the Android Kitchen and make a couple of ROMs. It’s also enough RAM to ensure Ubuntu (known in this virtualisation setup as the guest operating system) runs well enough without compromising Windows (the host).

Creating an Xubuntu VM

To begin fire up VMware Player and click on ‘Create a New Virtual Machine’. This will launch the setup wizard that will guide you through the process.

The first step is to point VMware Player to your Linux distro – it can either be an ISO image you’ve downloaded or grabbed from a cover disc or a Live CD/DVD if you’ve already burned it to disc. Choose your option set the location to the distro and click ‘Next’. On the next screen add details to create a local account with a username and password – these will be used automatically during the installation process. Make sure you write down the username and password as you’ll need them later. When you’re done click ‘Next’.

On the ‘Name your Virtual Machine’ screen call it whatever you want but the more important setting to take note of is to decide the folder location you want to store the VM files in. The Ubuntu OS files are installed into what’s best described as a self-expanding ZIP file – it sits on your computer as a single file that expands as required. The important thing is the installation is separate from your Windows install. It obviously loads onto the hard drive but to Windows it just looks like a big compressed archive file. So choose the location you want to use to store the files wisely (it should have about 30GB free) and hit the ‘Next’ button.

Now choose the disk space you want to allocate to the VM – we recommend 20GB. Also set the virtual storage as a single file not split files. When you’re done click ‘Next’ again.

On the final ‘Ready to Create Virtual Machine’ screen you’ll get an overview of the settings to be used. You can even change them if you click the ‘Customise Hardware’ button although there shouldn’t be any need to. When you’re done click’ the ‘Finish’ button.

Installing Xubuntu

The VM will then launch and automatically begin installing your chosen Linux distro. The installation will take around 20 minutes depending on your system and how many updates it needs (or you choose) to download. When it’s completed you’ll not only be ready for Android Kitchen you’ll have a Linux computer on your Windows desktop that you can fire up and run both at the same time.

Xubuntu 13.04 installing as an app on a Windows 8 PC.

One tip: make sure you select to download and install the VMware Tools for Linux app when the pop-up box appears. Ubuntu won’t start correctly until it’s installed. Once it’s in restart the VM (in the top menu go to ‘Player > Power > Reset’) and the VMware Tools app should automatically install. Eventually your Ubuntu install should kick up ask for your password and load up the desktop. When you see that your VM is up and running.

Before we go any further if you’ve not used Linux before have a play around and get used to the controls. Launch the web browser (Firefox) and you should be able to head to your favourite web site and browse. Load up Thunar – Xubuntu’s Windows Explorer equivalent – and get used to folder navigating. Take your time here as it’s better to learn how to navigate your way around at leisure than try to find something in a panic later on.

Installing Android Kitchen

When you’re ready the next step is to install the Android Kitchen and we’ll be working exclusively within the VM from now on.

The first step is to launch the ‘Ubuntu Software Center’ and in the search box on the top-right type Java . Select the latest ‘OpenJDK Java Runtime’ option and install it. When it’s done launch a Terminal box (‘Menu > Accessories > Terminal Emulator’) and type java –version to ensure it’s installed. Launch your Linux browser and head over to Android Kitchen on GitHub to download the latest version of the ROM Kitchen (at the time of writing this was version 0.224). Click on the zip icon and download it – it’ll be about 27MB and should make its way to your /home/<username>/download/ folder.

install java

Android Kitchen needs Java; you’ll find it in the ‘Ubuntu Software Center’.

Once it’s downloaded extract the files and you should end up with an Android-Kitchen-0.224 folder or similar for your version. Now in your user folder create a new folder called ‘kitchen’ and copy the contents of the ‘Android-Kitchen-0.224′ folder into that new folder. You should end up with a /home/<username>/kitchen folder and inside you should see subfolders ‘original_update’ ‘scripts’ ‘tools’ and a ‘menu’ file.

Another tip: it’s important that the full path of the Kitchen folder has no spaces – ‘darren yates’ is bad; ‘darrenyates’ is good – otherwise the Kitchen won’t work properly. If your username has spaces create the ‘kitchen’ folder in the ‘home’ folder and copy the contents there.

The Android Kitchen menu: everything you need to customise a ROM.

Running the kitchen

If you’re using Xubuntu right-click the ‘kitchen’ folder in the Thunar file manager and select ‘Open Terminal Here’. This is a quick way to launch a Terminal screen that automatically opens in the ‘kitchen’ folder. Type ./menu and press Enter. You should then see the Android Kitchen menu appear on the screen. If so congratulations – you’re just about there.

Finding ROMs

Before we can start cooking ROMs we need a ROM to start with. Just for this example we’ll use the latest Android Jelly Bean (4.1.2) ROM for the Galaxy S II I9100 smartphone. If you have a Samsung phone Sammobile is about the best place to grab stock ROMs. The sample ROM file we’re using as it was downloaded is ‘i9100xwlsh_i9100opslsb_ops.zip’. Copy that file to your /home/<username>/downloads/ folder.

Now we get to a slight bump in the road. There are a number of ways phone ROM archives can turn up and you have to treat each one differently. Most Samsung ROMs come as ZIP files with a ‘.TAR.MD5′ archive inside. Grab this file and copy it to the Kitchen’s ‘original_update’ subfolder. Use the Thunar file manager to rename the file and drop the ‘.MD5′ extension so it just becomes a TAR file.

Head back to the Terminal with the Kitchen app running and select ‘Option 1′ – we need to create a working folder for our customised ROM. Use the default working folder option provided and press the Enter key to continue. Android Kitchen should then show your ROM file in its list of ‘Available ROMs’. Select the ROM number and press Enter. Android Kitchen will begin expanding the ROM into the working folder ready for us to start customising.

When it’s done you’ll have the option to see an information panel about the ROM including whether it already has root access and other useful extras.

Next time

We now have the Android Kitchen up and running and our stock ROM expanded laid out and ready for customising. Next time we’ll start looking at the various options such as how to root the ROM enable installation of apps to the SD card and even add the option of customised boot animation. And not to mention how to ditch some of that pesky bloatware!

In the meantime get familiar with your new Linux VM. With the VMware Tools app installed you should now be able to copy and paste files from Windows to Linux with a simple Ctrl-C/Ctrl-V flick.

 

WARNING!

Customising your own ROMs can be potentially hazardous to the health of your smartphone. Be warned: an incorrectly built ROM may brick your phone. We present this information having tested it ourselves but offer no warranty on its fitness for use. Use it at your own risk.

 

See also:

How to make your own Android ROM – Part 2

How to make your own Android ROM – Part 3: Boot animation

How to make your own Android ROM – Part 4: Adding custom scripts

 

 

  • Danjovi .sagat

    Great guide! I cannot wait to get started, this motivates me thurther with my coding thank you for sharing.

  • Just making a custom rom

    Big thanks