[Galaxy Note GT-N7000 Android Development] ThaiDai:
Tutorial Stock to Custom Rom for Galaxy Note (updated 2013/05/30)

Tutorial "Stock2CustomRom": How I made this Custom Rom

Changelog

30.05.2013: Added line to change the API-Level before deodexing from 17 (for 4.2) to 16 (for 4.1.x). In v0.220 API level 16 was the default, 0.223 aims at 4.2 Roms with the default 17.

25.05.2013: Updated, removed "dump" chapters because there are no dumps anymore, switched to explaining using an official release (JB right now), corrected errors.

14.02.2013: Adding updates to tutorial while using it with ZSLM5

09.02.2013: Updated top last version of kitchen, testing with ZCLSD

02.12.2012: Finished first "Release" v1. Waiting for replies and will search for mistakes. But not now.

Introduction

When I got the OTA update to XXSLC I had the idea (no wonder) to make a usable Custom Rom (from now abbreviated to CR) out of it.

But how to do this?

I could've asked for help and a step by step tutorial - PM to some developers or cookers are great - or I could search XDA and try one of the many solutions written down somewhere.

In the IT world I prefer the last one, but I wanted an easy way: a kitchen. Why should I reinvent everything from scratch? Good for my ego, bad for my family.

With the XXLC dump this changed again and with the information that dsixda's Android Kitchen (I call it dAK from here) now will work with the N7000 I was curious again.

And after that I used the tutorial for cooking my Custom Roms from the official JB releases.

Limitations

No branches and options how to do something in different ways will be here - only the one-way-street I use. If you want other options you have to do it yourself and read the original threads with detailed descriptions.

I will not make snapshots for every button press or action - in the beginning I will not make even one of it. Later may be where really necessary.

I try to speak "plain english" - normally I speak "Thai english" - so please do not wonder if I use very simple language - I'm used to it and I didn't study in Oxford or Cambridge.

All steps and explanations are written in detail in the originals or on the web sites. Here you see only what you really need, without telling every "interesting" detail.

Working in Cygwin means you are using Linux, I will not explain all commands I use (like cd, ls, pwd etc.). It's not important here (it's fine to know), only using the kitchen is relevant.

What do we need? Downloads first

Windows 7 or 8: I did it on the new Windows 8, so 7 should be ok. No Linux, no XP, no Vista, no Apple

dsixda's Android Kitchen - download latest version (0.223_rev9)

Latest JDK from Oracle - important: not only the runtime but the "Java SE Development Kit 7" for Windows 86. It is the 32 bit version - I have a 64 Bit Win but using Java with 64 makes you crazy.

Customized version of Cygwin - dsixda made this, so no need to really work with the cygwin configuration from scratch.

DiskInternal's Linux Reader (as a tool included in the kitchen. But you have to install it anyway - and it's not nice when you discover this while in the script. So I used the latest version 1.6.4.0 and place it here.

A good editor: I use Notepad++. Latest Version (v6.2.2)

And: the zip with the official Android release from Samsung (JB at the moment)

latest Philz Kernel for your release (or your Custom Rom will not boot). Get the zImage from the zip.

How to prepare everything? Installation instructions

Do not change the order please, especially: JDK first, Cygwin after!

Install the JDK, Defaults ok, no more to explain

Install the Custom Cygwin from dsixda

Unzip to a temporary installation directory (e.g. c:\dsixda_cygwin_install)

Run Setup.exe

Select "Install from Local Directory"!

Use "C:\Cygwin" or any other folder, but NO SPACES in the name!

In window "Select Local Package Directory" change path so that it ends with: "\cygwin_packages"

In window "Select Packages" you have to change the first line in the list by clicking the arrows. It will change to "All <-> Install"

Click on "Next", installation runs and you should make a desktop shortcut.

After finishing the installation, start it (desktop shortcut) - this initializes the Cygwin environment

Install the Kitchen

In the Cygwin directory go to folder "home/[your home directory] - in my case it would be "ThaiDai". Create a folder "kitchen". Result should be: "C:\Cygwin\home\[your home directory]\kitchen

From the kitchen zip extract the content of folder "Android-Kitchen-0.223-rev9" into the folder "kitchen". In kitchen folder you will find a file "menu".

Start Cygwin (desktop icon).

type "cd kitchen"

type "./menu". The kitchen should start and you will see the "MAIN MENU".

type "x" to exit the kitchen and then "exit" to close Cygwin.

Reading and unpacking the Images

Unzip the downloaded JB release. Inside you will find a "tar"-file (this is a linux archive). You have to unpack this one too. Inside there are (for the Note): zImage, cache.img, factoryfs.img, hidden.img and modem.bin.

factoryfs.img - this /system

cache.img - containing CSCs (for your country specific settings, providers, apps, languages etc.)

hidden.img - the /preload partition with more apps, important now because a nice way to save space in /system

modem.bin - radio

zImage - not the kernel from the dump but Philz Kernel for your release (or your Custom Rom will not boot). Get the zImage from the zip.

Start the kitchen (Cygwin Icon, cd kitchen, ./menu) as Administrator (then you won't get warnings/errors later in the process)

Type "1", "Enter", "Enter". dAK should show you the "Available ROMs"

Type "1", "Enter" and select the dumped files. You'll see a Note telling you why a rooted kernel is important (we have Philz)

I want to change the name of the "working folder", so I press "y", "Enter" and change the name to "WORKING_THAIDAI". Choose your own folder name or don't change (not change the WORKING_ part, only the part after this!)

dAK will copy zImage and then compiles "simg2img" which it will use for converting the .img-files in a usable format

External Tool "Ext2explore" opens and in the Terminal you get infos what to do. So slowly now and read.

In the "Ext2Explore" choose menu entry "File"-"Open Image". Go to your working directory ("Working_...") and open folder "system". Select "ext4_factoryfs.img" (maybe you do not see the extension) and open it.

Right-Click the first entry in the left window and press "Save". Important: in the dialog switch and select folder "system" again. After pressing "OK", wait until the copy-process is finished. Close "Ext2Explore" and switch back to the terminal window. If you read there you can control again if you did what I wrote here.

Press "Enter"

Now the same as before for hidden.img. Tool "Ext2explore" opens, select "ext4_hidden.img" in folder "hidden", right-click and "Save" it to "hidden" folder (not to "system"!), wait until copy finishes and close "Ext2Explore".

Press "Enter"

You'll get some information about the /preload and that the kitchen will handle this automatically.

Press "Enter"

Now you get the offer to extract the Customer Software Customization (CSC) from cache.img. Press "Enter" (default is y)

And again you'll have to use an external tool - how to use is written down exactly. So please read it and follow the 7 steps (explained here of course)

Start Linux Reader and select in menu "Drives" - "Mount Image".

If not selected please choose "Raw Disk Images" and press "Next".

There you have to switch to your working folder in the kitchen until "system". Select "ext4_cache.img". Open it.

Marked in red you'll see a Hard disk drive called "Linux Ext Volume 1" (or "Linux native Volume 1). Double click it (open it). And again double click on the folder "recovery". You see the "sec_csc-zip".

Mark it and right click the "sec_csc.zip" and select "Save Files" and press "Next".

Uncheck "Save directory structure" and change "Output folder" to the "system"-folder in your working directory. ATTENTION: Linux Reader remembers old entries, so there might be the system folder of an old working directory with another name. Please always check the correct folder or the CSC isn't extracted into your actual working directory (I hate this part, because this happened right now when I wrote these lines).

After you selected the system folder press "Next" two times and close the Linux Reader program.

Switch back to your kitchen window and press "Enter". The kitchen will extract the content of sec_csc.zip

When asking to copy the apps to your working folder do NOT choose the default. Switch to "y" and "Enter" because we want to use CSC.

In the line "Add boot.img (y/n)?. Choose "y", "Enter"

After that dAK takes care of symbolic links, update-script etc. and ends with the information "Finished setting up working folder!"

Type "y", "Enter" to view the Rom infos. After a while you get a list of information. Entries will change with the next steps

Press "Enter"

Rooting and deodexing

Use menu options "2 - Add root permissions" and choose option "c" for "Chainfire's SuperSU" there. Press "Enter" until you see the menu again.

Use "3" for "BusyBox". Confirm with the default "y". Press "Enter" two times.

Very important now for your ego: change the name of the Rom after typing "7", "Enter". I will do this for example like: "Pristine ThaiDai bla bla". After changing press "Enter" two times.

If you want to change your radio you have to copy "modem.bin" from the folder "original_update" to the folder "system" in your working directory (of course outside of the kitchen).

ATTENTION: this isn't normally necessary. A user should choose the modem for his region, so it isn't a good idea to add a specific modem to your Custom Rom (I made that mistake in my first Roms).

Again type "8" for updated working folder information. It changed because you choose different options. Press "Enter" to go back to the main menu.

Type "0", "Enter" for the advanced options.11

Type "11", "Enter" and read the informations and how many odexed files are found

WARNING: You have to change the default API Level from 17 to 16 for building a 4.1.2 Custom Rom. So press "v", "Enter" and change API Level to 16.

The kitchen offers to temporarily move the apps from /preload to /system, so it can deodex them. So please choose the default "y". "Enter". The kitchen will move them back later.

WARNING: Some folder inside of "csc" contain apps with a size of exactly zero bytes (0 bytes). You have to delete them first or you'll get errors when deodexing. If this happens no problem: delete the "0"-byte-files and deodex with again. This error can happen later again when zipaligning the apk (0 bytes are already zipaligned perfectly).

Type "b", "Enter" and start deodexing all apks (now time for a good coffee), accept logging default with "y".

After deodexing 44+137 (in my case) you press "Enter" and can read the results in the generated log

Building your Rom

Optional: Select "13" and/or "14" if you want to add /data/app or /etc-init.d functionality/script support to your Custom Rom - I don't need it.

in ADVANCED OPTIONS type "0", "Enter" and go back to Main Menu

Choose "99" for building your Custom Rom

Confirm default "1" with pressing "Enter". It is an interactive mode and guided. It gives you the opportunity to add your own "updater-script" (I always do) to the Custom Rom .

Confirm question to optimize and zipalign the APKs with "Enter".

After zipaligning the "updater-script" is generated. dAK ask if it should "Proceed with the change (y/n)". Here you can copy your own "updater-script" to the folder "^META-INF/com/google/android".

The kitchen continues with building the "update.zip". Wait a while and it wants to sign your Rom. Of course use the default "y" and press "Enter".

And finally rename your Custom Rom if you want, should be easy to do.

Your new Custom Rom will be in the folder "OUTPUT_ZIP" and you can install it on your Note.

--- If this doesn't work: maybe you made a mistake or I made one here. Please add your comment in the thread. Do not send me PM please ---

Glossary/Abbreviations

Custom Rom (CR): A Rom that is changed from the maker's original by adding functionality like root access, modifications, bug fixes etc.

dsixda's Android Kitchen (dAK): A Rom making factory with "endless" scripts and collected tools bundled together. Now usable for N7000. Complete thread here - please read if you really want to understand everything

Credits

XDA: for all the help, documents, tutorials ...

dsixda: for his wonderful kitchen

Phil3759 for his patched stock Kernels

...