[Android Software Development] AndroidSword:
Firstly, by no means, I am a great developer or an expert. I have been developing ROMS for Samsung Galaxy Note 5 lately. I was also a noob before making all this. But by reading various guides on XDA, learning from many many great developers/contributors on our Note 5 Forums and talking with various friends which I made on XDA, I know quite a bit about ROMS and MODDING in general. So, here I would like to share all which I have learnt so far, and will be updating this guide regularly.

WARNING!​

I am not all responsible for what you do to your device, whether you blow it up, or you got late to reach your office, coz alarm never sounded, or your girl friend dumps you for not picking her phone(boy friend never do that:-p).. Neither me nor XDA is responsible for that.

CREDITS​

My brother, my teacher, my great friend, [MENTION=6500580]andyaguilar94[/MENTION], who was the first I contacted ever via a PM and he was so kind to teach me stuffs and helped me learn whatever I have learnt today.... Thanks a lot bro...;)

@CrsMthw and [MENTION=5564860]Androidwizzard[/MENTION], for always helping me solving my issues with the ROM and being so so so and so humble to listen to all my crap and being a constant support to me...:o

@karan2012, [MENTION=4575505]pelpa87[/MENTION], [MENTION=494193]Ather[/MENTION], [MENTION=3809001]diegonn[/MENTION]ec for being my great friends, helping me out in various things, pointing out my silly mistakes and being there for me anytime I needed them...:o

@ASSAYYED and [MENTION=3975929]zxz0O0[/MENTION] for their Awesome tools (Kitchen and SamFirm)

If I forgot to mention anyone, I would love to add them to this list...:)

PRE-REQUISITES BEFORE GOING FURTHER​

TWRP or any other Recovery installed on a rooted Samsung device

NotePad++

WinRAR or 7-ZIP

A Good knowledge of Windows Explorer

A Samsung Device to test on

A bit of patience and a lot of time

Before beginning, I would like to tell you guys that this is not a guide to PORT some other device's ROM to your own device. This is just a guide to modify your own device's latest firmware available and making your own ROMS... Secondly, this should work on most Samsung Devices and most of the Android versions including Marshmallow (6.0.1) and Nougat (7.0) and could work on other versions as well :)

CONTENTS OF THE GUIDE​

Okay, now coming back to guide, this guide will be divided in 5 sections:-

Creating a very basic ROM using Kitchen

Adding Basic Mods to the ROM (using CSC and Kitchen)

Learning about updater-script syntax and adding external features to the ROM

Learning about adding AROMA and about aroma-config syntax

Last but not the least, some tips and tricks to make your ROM even awesome;)

CREATING A VERY BASIC ROM USING KITCHEN​

Okay so, there are two ways of developing a ROM:-

1)Without a kitchen

2)With a kitchen (RECOMMENDED)

I will cover the method using a kitchen as it is much more efficient and time saving. Futhermore, Without a kitchen method only works for already available flashable ROMS, whereas a kitchen allows making a ROM directly from the firmware zip file.

INSTALLING AND KNOWING ABOUT ASSAYYED KITCHEN

Okay so, kitchens are basically designed to make the life of ROM Developers a lot simplers. All the functions that a kitchen offers, can actually be accomplished using File Explorer as well. But, it would require whole lot of efforts and time. So, therefore, most of the devs out there, use one of many amazing kitchens available. For this guide, we will be using ASSAYYED KITCHEN (I know, that its development is stopped, but it has a great lot of features that are available in an easy to understand way...)

So, first things first, lets download and install ASSAYYED KITCHEN :)

Step 1:-

Download the ASSAYYED KITCHEN from this official thread, by clicking here.

Step 2:-

Once downloaded, then copy the 7zip file to whichever directory you want to install this kitchen on your PC.

Step 3:-

Then extract the zip file using 7zip of WinRAR.

Step 4:-

If you didnt change the name of the zip file, you should see a folder named "ASSAYYED_KITCHEN_V1.82_STABLE", once extraction is completed.

Step 5:-

Inside this folder, you should see a folder named "TOOLS" and an exe file named "ASSAYYED". Run this exe file. Once it is loaded, you should see a black screen with a prethora of options.

Step 6:-

Now go back to the ASSAYYED Directory, where you had the "TOOLS" and this exe file, and you will be surprised to see three new folders:- "PLACE", "READY" and "WORK".

Okay so, we are done setting up the kitchen, now before we begin our actual ROM Development/Modification, let me explain you what are these folders and what do they do.

"PLACE" folder contains the base ROM zip files or your firmware zip files. This folder essentially contains the base ROM/FIRMWARE, that you are going to work upon. You will need to put the firmware zip (which I will tell you where to get) in this folder. This firmware will act as the base, on which you will make modifications and make your own ROM

"READY" folder will contain your ROM zip files. This essentially has your ROM zips that you will make and flash on your device

"WORK" folder contains the ROM files. As the name suggests, this folder is the one, we will be working on. This contains the entire ROM files (which I will explain later)

"TOOLS" folder is nothing we have to worry about for now. It essentially contains some important files and applications we might need.

As you must have seen, the kitchen has various options, and I can't explain all of them in one go, so I will explain them as we proceed through the guide.

So, finally we are done with the kitchen and stuffs, now lets download the firmware for your latest device. Well, let me share with you, how I download firmware files...

Firstly, download SamFirm Tool, by clicking here and selecting the latest zip from Post #1. Again, this is a depreciated tool, but it is important for downloading firmwares at high speed, because otherwise, if you download it from any website, they might charge you, or make the zip file available at slower speeds.

Secondly, head to this website, and in the dropdown menu, select your device and check (dont download) for the latest firmware available for your Model Number and note the "Model" and "Region".

USING SAMFIRMTOOL TO DOWNLOAD FIRMWARE

Step 1:-

Once downloaded, extract the SamFirm_v0.3.1.zip file (I told you to download above) in your desired directory.

Step 2:-

In the extracted folder (which should be "SamFirm_v0.3.1"), you should see a few files, but dont touch any of them, just launch the "SamFirm.exe".

Step 3:-

A new window will open and in that window, you should see two columns namely, "Firmware Info" and "Download".

Step 4:-

Put the "Model" and "Region" (which I told you to make a note of) in their respective sections inside "Firmware Info". Tick on "Auto"(If it is unchecked)

Step 5:-

Click on "Check Update". After this, it will process about the latest firmware and will eventually fill the details in the "Download" column.

Step 6:-

After this, you know the obvious step, click on "Download". Now sit back and relax, till the firmware is downloaded

Step 7:-

Once the firmware is downloaded, you should click on "Decrypt".

Step 8:-

After this, get to the "SamFirm_v0.3.1" directory (which contained the "SamFirm.exe"), and you should see a zip file.

Step 9:-

Copy and paste this zip file in "PLACE" folder of ASSAYYED kitchen (that we talked about earlier).

Now finally, we have our firmware and kitchen in place, Now lets begin ROM DEVELOPMENT

CREATING YOUR OWN VERY FIRST BOOTABLE ROM

Step 1:-

Launch "ASSAYYED.exe" from your kitchen directory.

Step 2:-

As you can see, from various options, we need to begin with the very first option that is, "START CREATING PROJECT". In ASSAYYED, we select options, by typing the number next to the option we want, and pressing Enter. So, for example, we need to select "START CREATING PROJECT", we know the number corresponding to it is "1", so we press 1 and then ENTER.

Step 3:-

After this, it basically asks Where to Get the Firmware, now, we know it is in "PLACE" folder and we see that the corresponding to "PLACE_FOLDER" is default. Now, I would like you to remember that specifically for this guide, wherever you see the word "default" in the kitchen, you just need to press Enter keeping it blank. So, I hope you got this.

Step 4:-

Now the kitchen will search in the "PLACE" folder for the necessary zip. Select the required firmware by pressing the number corresponding to it and then enter. For example, for your very first project, it will be "1", then enter.

Step 5:-

Now type the NAME of your Project. You can keep it anything or even leave it blank by pressing enter. Now sit back, relax, take a break and let the kitchen do its work.

Step 6:-

Once Extraction is complete, you should see something like "PRESS ENTER TO CONTINUE". So Press Enter and now minimise the kitchen and head to the "WORK" Folder.

Now, explanation time ;), once you open the "WORK" folder, you should be greeted with 2 folders and a file.

First would be a "META-INF" folder. This is the directory which TWRP or any other recovery looks for when you intend to flash anything. This folder is a MUST, without which no matter how good a ROM is, you will never be able to flash it using a recovery...

Next would be a "system" folder. This is the directory which contains the main ROM, this will be the folder where we will be making small edits in various files to get various mods. Essentially, you can consider this folder as the full ROM itself.

Lastly, there would a file by the name of "boot" or "boot.img". This file is essentially the stock kernel of your ROM. This is also an essential part of your ROM zip and you must tamper with this file unless you know what you are doing

Now navigate inside the system folder. Here you will see loads of subfolders.

Let me explain you about the contents of "system" folder:

"app" folder, as the name suggests, contains various apps and services which will run on your ROM. If you navigate to this app folder, you will see another a huge list of subfolders. These subfolders contains apks for the apps.

"cameradata" folder contains various files which are essential for the camera to work.

"csc" folder is a folder which would be gem for modders. Most of the mods that you want in the ROM could be just be added with a single line, by modifying a file or two in this folder.

"fonts" contains the various fonts which will be used in the ROM.

"framework" folder is a very essential part of the ROM. It includes various jars and a few apks which are very essential for a ROM to function well.

"lib" folder contains various lib files for the ROM. And one thing to keep in mind would be to NEVER tamper with "lib64" folder, because, if you do so, your ROM might never boot, however "lib" folder can be modified to some extent like deknoxing (which I will tell you about in future posts)

"media" folder contains audio files including ringtones, notification tones, alarm tones and other System sounds

"priv-app" folder contains another set of "privilaged apps". Privilaged, because, they require some special permissions to work

"build.prop" is the most important file in your ROM. Without this file, your ROM will NEVER-EVER boot.

Step 7:-

Lets first start by changing your ROM NAME. Inside the system folder, head to build.prop file and open it with NotePad++. (A tip, we usually refer adresses instead of putting them in words like I just did, so from now on, I will say, for example, head to system/build.prop)

Step 8:-

Find this "ro.build.display.id" in build.prop (It should be in first few lines). Then after "=", there will be a string of alpha-numeric characters. For eg, in my case, it is "N920CXXU3CQD1". You might be having something different depending on your device. You can change this string to anything you want, for example in my N-FUEL Rom, I have put it as "N-FUEL-XL1-N920CXXU3CQD1". Hope, you got the idea.

Step 9:-

Now its time to flash your ROM. But hey, before flashing, you need a ROM zip, right. So head to the ASSAYYED kitchen and Look for "BUILD ROM FOR FLASHING"(Hint:- It is the 7th option). So as you know, we will type "7", then press Enter.

Step 10:-

Now since, we want a zip, and the number corresponding to a "ZIP" is "3". So type 3 and then enter. After this, it will ask you to review updater-script (I will tell you about updater-script and its syntax later in the guide), for now, leave it "N0", that is "default" (You know what to do when you see default). After this, it might ask you to zipalign apks. You can select this as "YES".

Step 11:-

Then, you should always keep the compress level to "5"(which is "default", as you can see). Then you will see that it is making the zip file. Then it will ask you to name your ROM zip. Once done

Step 12:-

Once completed, it will ask you to sign the zip, it is optional, however, I never signed my ROM zips though.

Step 13:-

Okay so, finally!! You have gone through the tough journey and are now on the verge of testing your own ROM. So, go ahead and go to the "READY" directory. You will see your very first build there.

Step 14:-

Now go ahead and put this zip in your Internal Storage and go to your recovery. First backup your current ROM or data. Then wipe system, cache, dalvik and data from your Recovery and finally FLASH YOUR ROM!!!

In the next post, I will be talking about Odexed and Deodexed ROMS, Debloating stuffs and few other things... so stay tuned ;)