[GUIDE][COMPLETE] Android ROM Development From Source To End

Search This thread

neonkat

Senior Member
Aug 15, 2014
4,408
2,936
0
lost
***when i use breakfast mido command *****

#### errors i got

Looking for dependencies in device/xiaomi/mido
Looking for dependencies in device/qcom/common
Dependencies file not found, bailing out.

============================================
PLATFORM_VERSION=7.1.2
RR_VERSION=RR-N-v5.8.3-20170716-mido-Unofficial
RR_BUILDTYPE=Unofficial
DEVICE=mido
WITH_ROOT_METHOD=rootless
TARGET_BUILD_VARIANT=userdebug
TARGET_ARCH=arm64
BUILD_ID=NJH47D
OUT_DIR=/home/sainaveen/RR/out
============================================
****After i use these commands*****

export USE_CCACHE=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
croot

*********when i use brunch mido command*********

## errors i got

including vendor/cm/vendorsetup.sh
Looking for dependencies in device/xiaomi/mido
Looking for dependencies in device/qcom/common
Dependencies file not found, bailing out.

============================================
PLATFORM_VERSION=7.1.2
RR_VERSION=RR-N-v5.8.3-20170716-mido-Unofficial
RR_BUILDTYPE=Unofficial
DEVICE=mido
WITH_ROOT_METHOD=rootless
TARGET_BUILD_VARIANT=userdebug
TARGET_ARCH=arm64
BUILD_ID=NJH47D
OUT_DIR=/home/sainaveen/RR/out
============================================
make: Entering directory '/home/sainaveen/RR'
============================================
PLATFORM_VERSION=7.1.2
RR_VERSION=RR-N-v5.8.3-20170716-mido-Unofficial
RR_BUILDTYPE=Unofficial
DEVICE=mido
WITH_ROOT_METHOD=rootless
TARGET_BUILD_VARIANT=userdebug
TARGET_ARCH=arm64
BUILD_ID=NJH47D
OUT_DIR=/home/sainaveen/RR/out
============================================
Running kati to generate build-lineage_mido.ninja...
Environment variable BUILD_NUMBER was modified (956d223362 => a5f65731ba), regenerating...
============================================
PLATFORM_VERSION=7.1.2
RR_VERSION=RR-N-v5.8.3-20170716-mido-Unofficial
RR_BUILDTYPE=Unofficial
DEVICE=mido
WITH_ROOT_METHOD=rootless
TARGET_BUILD_VARIANT=userdebug
TARGET_ARCH=arm64
BUILD_ID=NJH47D
OUT_DIR=/home/sainaveen/RR/out
============================================
build/core/binary.mk:37: hal3-test-app uses kernel headers, but does not depend on them!
build/core/binary.mk:1253: external/deqp/Android.mk: libdeqp: Unused source files: \
build/core/binary.mk:1253: external/deqp/Android.mk: libdeqp: Unused source files: \
build/core/binary.mk:1253: external/pdfium/third_party/pdfiumbigint.mk: libpdfiumbigint: Unused source files: bigint/BigInteger.cc bigint/BigIntegerUtils.cc bigint/BigUnsigned.cc bigint/BigUnsignedInABase.cc
build/core/binary.mk:1253: external/pdfium/third_party/pdfiumbigint.mk: libpdfiumbigint: Unused source files: bigint/BigInteger.cc bigint/BigIntegerUtils.cc bigint/BigUnsigned.cc bigint/BigUnsignedInABase.cc
./external/speex/Android.mk:56: TODOArm64: enable neon in libspeex
build/core/package_internal.mk:143: Empty argument supplied to find-subdir-assets
find: ‘/home/sainaveen/RR/out/target/common/obj/SHARED_LIBRARIES/libwifi-hal-mock_intermediates’: No such file or directory
build/core/package_internal.mk:143: Empty argument supplied to find-subdir-assets
cp: cannot stat '/home/sainaveen/RR/ota_conf': No such file or directory
Prebuilt apk found in PRODUCT_COPY_FILES: vendor/cm/prebuilt/NexusLauncher/NexusLauncher.apk:system/app/NexusLauncher/NexusLauncher.apk, use BUILD_PREBUILT instead!

ninja: Entering directory `.'
ninja: error: '/home/sainaveen/RR/out/target/product/mido/obj_arm/SHARED_LIBRARIES/libts_face_beautify_hal_intermediates/export_includes', needed by '/home/sainaveen/RR/out/target/product/mido/obj_arm/SHARED_LIBRARIES/camera.msm8953_intermediates/import_includes', missing and no known rule to make it
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/home/sainaveen/RR'

#### make failed to build some targets (02:46 (mm:ss)) ####

************sir please help :crying::crying::crying::crying::crying:***********

i believe you are using vendor_xiaomi from the muppets?it got oss canera hals merged so make sure you have those libs with you.

take the new mido tree from lineageos,it has all the libs.
 
  • Like
Reactions: sai2698

sai2698

Senior Member
Jan 6, 2016
59
3
28
i believe you are using vendor_xiaomi from the muppets?it got oss canera hals merged so make sure you have those libs with you.

take the new mido tree from lineageos,it has all the libs.

##kernel source:
https://github.com/MiCode/Xiaomi_Ker...ree/mido-m-oss
##Device tree:
https://github.com/LineageOS/android_device_xiaomi_mido
##vendor tree:
https://github.com/TheMuppets/proprietary_vendor_xiaomi

and i put device tree, vendor tree and kernel source in following
/device/xiaomi/mido -device tree
/vendor/xiaomi/mido -vendor tree
/kernel/xiaomi/msm8593 -kernel source

I posted the kernel source,device tree and vendor from where I have downloaded ...
Please help me sir
 

neonkat

Senior Member
Aug 15, 2014
4,408
2,936
0
lost
##kernel source:
https://github.com/MiCode/Xiaomi_Ker...ree/mido-m-oss
##Device tree:
https://github.com/LineageOS/android_device_xiaomi_mido
##vendor tree:
[https://github.com/TheMuppets/proprietary_vendor_xiaomi

and i put device tree, vendor tree and kernel source in following
/device/xiaomi/mido -device tree
/vendor/xiaomi/mido -vendor tree
/kernel/xiaomi/msm8593 -kernel source

I posted the kernel source,device tree and vendor from where I have downloaded ...
Please help me sir

*device: in device/xiaomi/mido
*kernel: in kernel/xiaomi/msm8953
*vendor: in vendor/xiaomi and not in vendor/xiaomi/mido.

and please use hastebin to post your build logs.
 
Last edited:

sai2698

Senior Member
Jan 6, 2016
59
3
28
don't use "breakfast" here. if you have added the repo in local manifest(yourself),then just do a repo sync,lunch command then mka bacon.or use brunch.

thank you for helping me....
i am a beginner.i don't know :confused: how to edit local manifest..
can u eloborate on this please.......
 

neonkat

Senior Member
Aug 15, 2014
4,408
2,936
0
lost
thank you for helping me....
i am a beginner.i don't know :confused: how to edit local manifest..
can u eloborate on this please.......

you are at the right place.go through all the first few posts in this guide,there are steps given to understand how it works and make your own localmanifest.
 

MZO

Senior Member
Jan 5, 2015
1,883
2,192
0
thank you for helping me....
i am a beginner.i don't know :confused: how to edit local manifest..
can u eloborate on this please.......
Do you know how to write an xml file? Manifest is just like that. I wpuld also recommend you what @neonkat said. Go through and try learning yourself because that's the best thing to do. Otherwise you have this thread to fallback to if you run into errors
 
  • Like
Reactions: sai2698

psxda97

Senior Member
Nov 1, 2015
206
71
0
I'm trying to follow the OP but it's really old and I've had to replace a lot of the outdated commands, but I need some help. So I'm working with AOSPA https://github.com/AOSPA but I got stuck at the command: repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

There's not a https://github.com/AOSPA/android so in this case which repo would I use?

repo init -u https://github.com/AOSPA/manifest -b nougat-mr2

Read readme.md of AOSPA/manifest on github for more information.

Cheers!
 

Techie Android

Senior Member
Apr 28, 2015
204
92
0
so after a lot of hours waiting for repo sync -j4 to finish downloading, it stopped and I thought it was done but then I looked at my storage space and saw it maxed me out. :'( So I have 28GB worth of it already on my PC should I keep it or delete it and restart it when I have more space? is 50 GB enough for everything? This guide was really misleading because it said to have upto 15GB free. It really needs to be updated.
 

MZO

Senior Member
Jan 5, 2015
1,883
2,192
0
so after a lot of hours waiting for repo sync -j4 to finish downloading, it stopped and I thought it was done but then I looked at my storage space and saw it maxed me out. :'( So I have 28GB worth of it already on my PC should I keep it or delete it and restart it when I have more space? is 50 GB enough for everything? This guide was really misleading because it said to have upto 15GB free. It really needs to be updated.
Get it to 120GB and you're good then. No need to wipe old stuff you can carryitforward
 

Magoratogha

Member
Jan 7, 2014
35
28
0
Pereira
I'm trying to build AOSPA for the LG G3 D855, but in the compilation process I got the following error:

Ninja: error: 'out/target/product/d855/ramdisk-recovery.img', needed by 'out/target/product/d855/recovery.img', missing and no known rule to make it

I searched everywhere, but I do not know how to solve it. A little help please ?

---------- Post added at 11:27 PM ---------- Previous post was at 11:20 PM ----------

so after a lot of hours waiting for repo sync -j4 to finish downloading, it stopped and I thought it was done but then I looked at my storage space and saw it maxed me out. :'( So I have 28GB worth of it already on my PC should I keep it or delete it and restart it when I have more space? is 50 GB enough for everything? This guide was really misleading because it said to have upto 15GB free. It really needs to be updated.

Recently, I just synchronized the AOSPA sources, weighing around 31 GB. After decompressing and synchronizing the working tree, it occupies around 70 GB
 

DiamondJohn

Recognized Contributor
Aug 31, 2013
4,946
4,200
243
Sydney
Build ResurectionRemix from LineageOS Device & Vendor. failed...

I am attempting to build a ResurectionRemix Nougat ROM. It is a non suported device (xt897), however, the device IS a LineageOS supported device. I think I read on here somewhere that the Lineage Vendor and Device trees could be used to build RR ROMs, so i gave it a go. I CAN build LineageOS for the device, so I copied across the Device and Vendor trees from LineageOS, into the source for RR. It appeared to be working :highfive: up to about 87% of the build, but then failed :crying:

I get the following error. The full log is attached below. The final error appears to be:
Code:
[2017-07-18 17:31:15] [ 87% 30030/34216] Install: /home/ubuntu/android/RR/out/target/product/xt897/system/priv-app/MmsService/MmsService.apk
[2017-07-18 17:31:15] [ 87% 30031/34216] target R.java/Manifest.java: MotoDoze (/home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src/R.stamp)
[COLOR="Red"][2017-07-18 17:31:15] FAILED: /bin/bash -c "(rm -rf /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src/R.stamp && mkdir -p /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src/ ) && (mkdir -p /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src ) && (mkdir -p /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/ ) && (/home/ubuntu/android/RR/out/host/linux-x86/bin/aapt package --auto-add-overlay --auto-add-overlay -z --extra-packages android.support.v14.preference:android.support.v7.appcompat:android.support.v7.preference:android.support.v7.recyclerview:com.android.settingslib  --pseudo-localize -m  -J /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src -M device/motorola/qcom-common/doze/AndroidManifest.xml -P /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/public_resources.xml -S device/motorola/qcom-common/doze/res -S device/motorola/qcom-common/doze/../../../../packages/resources/devicesettings/res -S frameworks/support/v14/preference/res -S frameworks/support/v7/appcompat/res -S frameworks/support/v7/preference/res -S frameworks/support/v7/recyclerview/res -S frameworks/base/packages/SettingsLib/res  -I /home/ubuntu/android/RR/out/target/common/obj/APPS/framework-res_intermediates/package-export.apk -I /home/ubuntu/android/RR/out/target/common/obj/APPS/org.cyanogenmod.platform-res_intermediates/package-export.apk -G /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/proguard_options --min-sdk-version 25 --target-sdk-version 25 --version-code 25 --version-name 7.1.2   --skip-symbols-without-default-localization ) && (for GENERATED_MANIFEST_FILE in \`find /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src -name Manifest.java 2> /dev/null\`; do dir=\`awk '/package/{gsub(/\\./,"/",\$2);gsub(/;/,"",\$2);print \$2;exit}' \$GENERATED_MANIFEST_FILE\`; mkdir -p /home/ubuntu/android/RR/out/target/common/R/\$dir; /home/ubuntu/android/RR/out/host/linux-x86/bin/acp -fp \$GENERATED_MANIFEST_FILE /home/ubuntu/android/RR/out/target/common/R/\$dir; done ) && (for GENERATED_R_FILE in \`find /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src -name R.java 2> /dev/null\`; do dir=\`awk '/package/{gsub(/\\./,"/",\$2);gsub(/;/,"",\$2);print \$2;exit}' \$GENERATED_R_FILE\`; mkdir -p /home/ubuntu/android/RR/out/target/common/R/\$dir; /home/ubuntu/android/RR/out/host/linux-x86/bin/acp -fp \$GENERATED_R_FILE /home/ubuntu/android/RR/out/target/common/R/\$dir || exit 31; /home/ubuntu/android/RR/out/host/linux-x86/bin/acp -fp \$GENERATED_R_FILE /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src/R.stamp || exit 32; done ) && (touch /home/ubuntu/android/RR/out/target/common/obj/APPS/MotoDoze_intermediates/src/R.stamp )"
[2017-07-18 17:31:15] ERROR: resource directory 'device/motorola/qcom-common/doze/../../../../packages/resources/devicesettings/res' does not exist[/COLOR]
[2017-07-18 17:31:16] [ 87% 30031/34216] Building with Jack: /home/ubuntu/android/RR/out/target/common/obj/APPS/OneTimeInitializer_intermediates/with-local/classes.dex
[2017-07-18 17:31:17] [ 87% 30031/34216] target R.java/Manifest.java: ManagedProvisioning (/home/ubuntu/android/RR/out/target/common/obj/APPS/ManagedProvisioning_intermediates/src/R.stamp)
[2017-07-18 17:31:23] [ 87% 30031/34216] target R.java/Manifest.java: OmniJaws (/home/ubuntu/android/RR/out/target/common/obj/APPS/OmniJaws_intermediates/src/R.stamp)
[2017-07-18 17:31:23] Warning: AndroidManifest.xml already defines versionCode (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:23] Warning: AndroidManifest.xml already defines versionName (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:23] Warning: AndroidManifest.xml already defines minSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:23] Warning: AndroidManifest.xml already defines targetSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:23] [ 87% 30031/34216] target R.java/Manifest.java: MtpDocumentsProvider (/home/ubuntu/android/RR/out/target/common/obj/APPS/MtpDocumentsProvider_intermediates/src/R.stamp)
[2017-07-18 17:31:24] [ 87% 30031/34216] target R.java/Manifest.java: Contacts (/home/ubuntu/android/RR/out/target/common/obj/APPS/Contacts_intermediates/src/R.stamp)
[2017-07-18 17:31:24] Warning: AndroidManifest.xml already defines versionCode (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:24] Warning: AndroidManifest.xml already defines versionName (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:24] Warning: AndroidManifest.xml already defines minSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:24] Warning: AndroidManifest.xml already defines targetSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:24] nothing matches overlay file view_pager_tab_background.xml, for flavor v21
[2017-07-18 17:31:28] [ 87% 30031/34216] target R.java/Manifest.java: Gallery2 (/home/ubuntu/android/RR/out/target/common/obj/APPS/Gallery2_intermediates/src/R.stamp)
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines versionCode (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines versionName (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines minSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines targetSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] [ 87% 30031/34216] target R.java/Manifest.java: Dialer (/home/ubuntu/android/RR/out/target/common/obj/APPS/Dialer_intermediates/src/R.stamp)
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines versionCode (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines versionName (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines minSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] Warning: AndroidManifest.xml already defines targetSdkVersion (in [url]http://schemas.android.com/apk/res/android);[/url] using existing value in manifest.
[2017-07-18 17:31:28] ninja: build stopped: subcommand failed.
[2017-07-18 17:31:28] build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
[2017-07-18 17:31:28] make: *** [ninja_wrapper] Error 1
[2017-07-18 17:31:28] make: Leaving directory '/home/ubuntu/android/RR'
[2017-07-18 17:31:29] 
[COLOR="red"][2017-07-18 17:31:29] [0;31m#### make failed to build some targets (01:02:04 (hh:mm:ss)) ####[/COLOR]

My build script is:
Code:
cd ~/android/RR
source build/envsetup.sh; 
lunch lineage_xt897-userdebug 
make clobber 
croot; 
brunch lineage_xt897-userdebug 2>&1 | ts '[%Y-%m-%d %H:%M:%S]' | tee -a $HOME/brunch_out.log;

I can build LineageOS for the device successfully. I would be pretty stoked if I could get RR to build for the device:victory: And it may also help others converting their LOS ROM builds to RR. I basically copied the following device and vendor directories over to the RR paths.
Code:
~/android/lineage/kernel/motorola
	copied to ==> ~/android/RR/kernel/motorola

~/android/lineage/vendor/motorola
	copied to ==> ~/android/RR/vendor/motorola

~/android/lineage/device/motorola
	copied to ==> ~/android/RR/device/motorola

Anyone have ideas of what is going wrong in the above? or how to get to a better error description? I have also included a log from a successful LOS build in case it might help.
 

Attachments

  • 201707181918_brunch_out.log.RR_FAILED.zip
    531.3 KB · Views: 4
  • 201706281543_brunch_out.log.LOS_SUCCESS.zip
    649.1 KB · Views: 4
Last edited:

neonkat

Senior Member
Aug 15, 2014
4,408
2,936
0
lost
I am attempting to build a ResurectionRemix Nougat ROM. It is a non suported device (xt897), however, the device IS a LineageOS supported device. I think I read on here somewhere that the Lineage Vendor and Device trees could be used to build RR ROMs, so i gave it a go. I CAN build LineageOS for the device, so I copied across the Device and Vendor trees from LineageOS, into the source for RR. It appeared to be working :highfive: up to about 87% of the build, but then failed :crying:

I get the following error. The full log is attached below. The final error appears to be:


My build script is:


I can build LineageOS for the device successfully. I would be pretty stoked if I could get RR to build for the device:victory: And it may also help others converting their LOS ROM builds to RR. I basically copied the following device and vendor directories over to the RR paths.


Anyone have ideas of what is going wrong in the above? or how to get to a better error description? I have also included a log from a successful LOS build in case it might help.

check if you have packages/resources/devicesettings.

if not,then sync from los.(android_packages_resources_devicesettings:branch cm-14.1)
 
  • Like
Reactions: DiamondJohn

DiamondJohn

Recognized Contributor
Aug 31, 2013
4,946
4,200
243
Sydney
check if you have packages/resources/devicesettings.

if not,then sync from los.(android_packages_resources_devicesettings:branch cm-14.1)
I found I was missing the path "~/android/RR/packages/resources" a little after I posted the above :eek: , so I copied it across from LineageOS and have kicked off another build. I'll let you know how it works out.:fingers-crossed: big thanks!
 

Dersaun

Member
Oct 18, 2016
32
0
0
Can someneone plase help me?
I can't flash my build, I'm having error.
"update process ended with error 7".
E:Unable to mount '/system'
Failed Every Time
 

neonkat

Senior Member
Aug 15, 2014
4,408
2,936
0
lost
Can someneone plase help me?
I can't flash my build, I'm having error.
"update process ended with error 7".
E:Unable to mount '/system'
Failed Every Time

if you have twrp,flash the rom once,after you get error,in twrp go to advanced->copy log to sd(similar name).upload you recovery.log file(probably in internal sd card).
 

Top Liked Posts

  • There are no posts matching your filters.
  • 443
    Hello Everyone....:D:D

    Today I will present you all the ultimate guide for ROM development starting from Source to End.
    This guide will be applicable to all devices.
    So lets Start :D



    What is Android? :rolleyes:

    Android is the open-source operating system used for smartphones. Full Freedom for people using it :D


    What is Android Source Code?

    Android is an open-source software stack created for a wide array of devices with different form factors. The primary purposes of Android are to create an open software platform available for carriers, OEMs, and developers to make their innovative ideas a reality and to introduce a successful, real-world product that improves the mobile experience for users.The result is a full, production-quality consumer product with source code open for customization and porting.
    So basically Android Allows to customize the things you like and make new things without any Restrictions. Cool isn’t it? :cool:

    What is Android ROM ?
    The Android ROM is the Android operating system. This is the User interface (Sense UI in HTC phones) and the file system for maintaining contacts etc. It is composed of a Linux kernel and various add-ons to achieve specific functionality.

    What does a Android Rom Contain ?
    Basically a Android Rom Contains following main things :
    · Kernel
    · Bootloader
    · Recovery
    · Radio
    · Framework
    · Apps
    · core
    · android-runtime,Etc


    Some Basics About Above Terms

    Kernel :
    A kernel is critical component of the Android and all operating systems. It can be seen as a sort of bridge between the applications and the actual hardware of a device. Android devices use the Linux kernel, but it's not the exact same kernel other Linux-based operating systems use. There's a lot of Android specific code built in, and Google's Android kernel maintainers have their work cut out for them. OEMs have to contribute as well, because they need to develop hardware drivers for the parts they're using for the kernel version they're using. This is why it takes a while for independent Android developers and hackers to port new versions to older devices and get everything working. Drivers written to work with the Gingerbread kernel on a phone won't necessarily work with the Ice Cream Sandwich kernel. And that's important, because one of the kernel's main functions is to control the hardware. It's a whole lot of source code, with more options while building it than you can imagine, but in the end it's just the intermediary between the hardware and the software. So basically if any instruction is given to mobile it first gives the command to kernel for the particular task execution.

    Bootloader :

    The bootloader is code that is executed before any Operating System starts to run. Bootloaders basically package the instructions to boot operating system kernel and most of them also have their own debugging or modification environment. Think of the bootloader as a security checkpoint for all those partitions. Because if you’re able to swap out what’s on those partitions, you’re able to break things if you don’t know what you’re doing. So basically it commands the kernel of your device to Boot the Device properly without any issues. So careful with bootloader since it can mess things very badly.

    Recovery :

    [FONT=&quot]Recovery is defined in simple terms as a source of backup. Whenever your phone firmware is corrupted, the recovery does the job in helping you to restore or repair your faulty or buggy firmware into working condition. It is also used for flashing the Rom’s , kernel and many more things.

    [/FONT]
    Radio[FONT=&quot]
    [/FONT]

    The lowest part of software layer is the radio: this is the very first thing that runs, just before the bootloader. It control all wireless communication like GSM Antenna, GPS etc.


    These are main parts of Android Operating System.

    [FONT=&quot]Now has we know what is Android and What it contains lets move to the Next major step. That is Android Rom Development from Source. But before starting this we need some Initial Setup and development Enviroment .[/FONT]

    Android Rom Development

    Setting Up Linux Enviroment




    Pre – Requirements for Android Rom Development.
    1) Linux Operating System ( I will take Ubuntu 13.10 has Example and also recommend you all)
    2) Java Development Kit (JDK)
    3) Some Tools.

    Once you Download Ubuntu 13.10 you can Install it in 2 ways :
    1) Installing has primary OS
    2) Installing Inside the Windows ( Using VM or VB)
    3) Dual booting Linux alongside Windows. ( Using different Partitions )


    Here I will explain how to Install Linux inside Windows. You can use VirtualBox (Free) or VM Workstation/Player (Paid) Softwares. In this guide I will take example of Virtual Box.

    Pre-requirements

    1) Windows 7 64 bit
    2) Download Virtual Box.
    3) Install the VirtualBox
    4) See that JDK is installed before installing VirtualBox
    5) Ubuntu 13.10 ISO file ( Download it)

    Installing Ubuntu 13.10 In VirtualBox
    I will be using 2 words.
    Guest : Operating System in Virtual Box 64 bit
    Host : Windows 7 .


    Note : Since we need to Install Ubuntu 64bit version Intel VT-x should be enabled else you will not be able to install 64bit. Your processor should support that feature.
    Enabling VT-x.
    1) ShutDown PC.
    2) Boot into SetUp Menu (Bios Settings)
    3) Go to Advanced --> Advanced Processor Options --> Intel(R) Virtualization Technology.
    4) Enable it.
    5) Save the settings.
    6) Reboot

    Installation of Ubuntu 13.10 64bit


    1) Open VirtualBox.

    2) Click on New button



    M3QKn8t.png


    ·3) [FONT=&quot]Type the Name you want to give to this OS which will displayed everytime you open VirtualBox.

    qw7keQx.png


    b6ACrTD.png


    [/FONT] 4) Now you have to set the amount of RAM you want to allocate for your Guest OS. Now this is tricky and Dangerous part. Hey don’t worry !! Its simple :D I will explain this with a simple Example : Think that your PC has 10GB of RAM installed and you have Windows 7 64bit OS (Which u need off course :p ) Now out of 10GB of RAM 4Gb will be needed for your Host to work smoothly. The remaining 6GB can be allotted to work for Virtual Box Guest OS. Now you may have a question in your mind why so much RAM is needed while VB can run in 1 GB too?
    The Answer for this simple that has the RAM for Guest Increases your ROM compiling/building speed too increases drastically. That is the reason RAM is needed a bit more here.
    Now In VirtualBox you can see that green dotted line ending with red dotted line showing how much RAM you are allocating NEVER EVER CROSS GREEN LINE TO RED DOING SO CAN CRASH YOUR PC HAS IT IS THE SAME LIMIT FOR THE WINDOWS TO WORK. SO CAREFULL. It is the Max Amount of Ram you can allocate to VB. But always keep pointer 2 dotes below the RED to Be on safer side. After setting click Next.

    FRx9MXi.png


    5) Now here you have to create virtual drive for you Linux OS and its Files. It’s same has Hard Disk for your Windows PC.Were Linux is installed and RUN.Now click on Create New Virtual Hard Drive Now and click Create button.
    · You will get various formats of Virtual Drives. Always select VMDK Since it is supported by other Softwares like VM Workstation (Paid) . Click Next.


    ED0PEO1.png


    jLe0HkX.png


    · 6) Now you will get a option to select Dynamically Allocated or Fixed Size. Select Dynamically Allocated and don’t tick Split into files option has it will mess everything.


    EtrNQrT.png


    7) Enter the Amount of HDD Space you want to allocate to Virtual Hard Disk. Remember the same amount of space should be there in our Physical hard disk of PC too. (Example : If you select 200GB than your physical drive should have atleast 220GB free storage) . Minimum storage for Virtual Drive for the Android Building is 100GB but I recommend you to keep above 150GB. You will come to know why later. Select the folder/drive in your physical drive were you want to store Virtual hard drive (VMDK) in your physical hard disk of PC.

    YJci8mw.png


    Q183qwt.png


    8) Now click on Settings and Go To System a Processor Now in Processor Drag the Pointer to End of green line That it specifies the no of Cores you want to allocate to Guest OS. It doesn’t effect to host…:D:D In my case its 2.:eek:

    RIODIn7.png


    ·9) Now go to Acceleration tab next to Processor Tab and Tick Both.


    KAbCX0n.png



    10) Now go to the Settings à Storage à Click on Controller: IDE à next to Click on small CD with + icon mark.

    d9Yddtw.png


    · 11) Navigate to Ubuntu 13.10 64 Bit ISO and select it.


    5thCPCd.png


    S4bxR0b.png




    12) Now go to settings --> System --> boot order --> change it CD/DVD First. ( Or you can directly start the system and press F12 select CD/DVD either will work fine)

    SZldi0e.png


    13) Now Click Start Button to start VirtualBox Guest .
    14) Once Ubuntu Starts you can see following screen with 2 option here you can either test or Install just click Install button to start Installation Process.


    AFgMcaI.png


    · 15)Here It will show what things Ubuntu Requires is available or not and some updates and third party installs if you want you can select ( I never selected it) click continue Here It will show what things Ubuntu Requires is available or not and some updates and third party installs if you want you can select.

    85WlRAQ.png


    16) Here it will show how you want to install the Ubuntu let it be default has shown below since this is under VirtualBox. ( In Windows Dual Boot Different Procedure will be there which will be discussed in next part

    7gaHrqW.png


    17) Select Time Zone , keyboard layout .
    18) Enter the details required.


    VkZavut.png


    ufrVr8I.png



    19) Enter the details required.


    ynfGFTB.png


    20) It will ask to log in to Ubuntu one with Email Id just skip it and continue

    UCnqdks.png



    20) Installation Begins wait until it completes

    msCeMV7.png


    Hurrrray your Linux System is Ready


    271
    Setting Up Build Enviroment For Compiling ROM's

    Installation of Necessary Tools and packages for ROM Development

    1)Installing Java Development Kit (JDK)

    For Kitkat

    Installation of Java V6

    Open The Terminal and Paste following Command

    a) This will Remove the wrong Java JDK from Ubuntu 13.10
    Code:
    [COLOR=#000000]sudo apt-get purge openjdk-\* icedtea-\* icedtea6[COLOR=#007700][COLOR=black]-\*[/COLOR] [/COLOR][/COLOR]


    b) Enter the Following Command and This will Install JDK

    Code:
    wget https://launchpad.net/~webupd8team/+archive/ubuntu/java/+files/oracle-java6-installer_6u45-0%7Ewebupd8%7E8_all.deb sudo dpkg -i oracle-java6-installer_6u45-0~webupd8~8_all.deb wget https://launchpad.net/~webupd8team/+archive/ubuntu/java/+files/oracle-java6-set-default_6u45-0%7Ewebupd8%7E8_all.deb sudo dpkg -i oracle-java6-set-default_6u45-0~webupd8~8_all.deb

    c) Check The Java Version Installed
    Code:
    [COLOR=#000000]java -[COLOR=#0000BB][COLOR=black]version [/COLOR] [/COLOR][/COLOR]

    For Lollipop Required Java Version is 7

    To Install Java V7


    Code:
     sudo apt-get update && sudo apt-get install openjdk-7-jdk

    :DJava Installation Completes:D

    2)
    Installation Of Required Tools
    Enter The Following Command
    Code:
    sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
    Note : If you get error like broken dependencies then use the following command and then use above command.:D

    Code:
    sudo apt-get update
    Code:
    sudo apt-get upgrade
    After Installation Completes Enter The Following Command
    Code:
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
    So The Above Are The Packages

    Now comes the binary called Repo.


    What Is Repo?:rolleyes:

    Repo is a repository management tool that we built on top of Git. Repo unifies the many Git repositories when necessary, does the uploads to our revision control system and automates parts of the Android development workflow.

    Enter The Following Command
    Code:
    mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
    Using Text Editor Open ~/.bashrc for that use following command
    Code:
    sudo nano ~/.bashrc
    At The Very Bottom Line Add following Line
    Code:
    export PATH=~/bin:$PATH
    Save it. Here To save Press Ctrl+O and Enter and Ctrl+X to exit:)
    Now Enter Following Command
    Code:
    source ~/.bashrc

    :cool::cool:Now Your System Is Ready For ROM Building:D:D
    236
    Downloading Sources

    To build a Rom from Source first we need to download the sources from git.
    Note : Sources will be very huge approx 13GB to 14GB hence lot of patience is required since it will take some time depending on your Internet connection speed.

    So lets start..

    Here i will take the example of cm11.
    The steps goes has follows

    1) Create a directory were your sources will be downloaded. Enter the following command to terminal to create a directory

    Code:
    mkdir cm11
    Now in your Home directory you will see folder called cm11.

    1zEeVvZ.png


    2) The next step is you have to Initiate the repo. meaning of the repo is given above. It will communicate with the git and download the source were it is stored.
    Enter The Following Command to Terminal
    Code:
    cd cm11
    This will take you to the directory you created in Step 1.

    8zCZANO.png

    Now Enter The Following Command Which Will Initiate The Repo :laugh:
    Code:
    [FONT=Arial][SIZE=4]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0[/SIZE][/FONT]


    AH3P62H.png


    MesK53W.png

    Since i m taking example of cm11 above repo initiate command is used you can find this here for CM11
    Note : All the details for Repo Initiate and Building will be given in respective Source Github. Various Github source links will be given in discription and the end.

    This will initialize your local repository using the CyanogenMod trees.:p:D:D
    now got to cm11 folder and press Ctrl+H this will show the hidden folder .repo were sources will be downloaded.

    WSkXUQr.png


    Buqbjst.png

    Now it might give a small error at the end stating for Email id.
    So just create a github account here
    Then Run following in Terminal
    Code:
    [FONT=Arial][SIZE=4]git config --global user.email "[email protected]"
    git config --global user.name "Your Name"[/SIZE][/FONT]


    replace
    "[email protected]" with your github email Id
    replace
    "Your Name" with github Username

    3) Now To control the files that should be downloaded while sync and for adding device tree we use local_manifest.xml. Reagrding this @Kishan14 will explain in detail with Tips and Tricks.

    4) Now it is the time to download the sources. for that run the following Command

    Code:
    repo sync -j#

    #
    is number of jobs you want to give for your downloading source. I use 2 to 4.

    hEbrLC4.png


    dE5oydZ.png

    Now it will download the Sources needed to build the Rom..Download will be huge 13GB to 14GB so be patient since it depends on your Internet Speed.

    The Above was for CM11 same procedure for other provided you have to replace cm11 with one you want to sync/build like AOSP,AOKP,AICP etc and Repo Initialize command varies with the source you want to download.

    Some Git Links :

    CM11 : https://github.com/CyanogenMod/android
    AOKP : https://github.com/AOKP/platform_manifest
    Carbon Rom : https://github.com/CarbonDev/android
    SlimRom : https://github.com/SlimRoms/platform_manifest
    181
    Building Rom For A Particular Device

    Building Rom For A Particular Device

    Now has we have downloaded the sources we need for our Rom Build Lets Move to the Next Step which is Actually Major Step the Building The ROM

    So Lets Start The Game...:laugh::D:D

    Note : I will be taking Samsung Galaxy Grand Duos - GT -I9082 has Example here.
    Example Rom : CM11

    Now before starting with Building guide you have to Download your Device Identity That is has follows
    1) Device Tree
    2) Vendor
    3) Kernel
    The Above files are very Vital Parameters of building they specify your device and its Characteristics.

    Now you might think from where you have to download those files?
    :confused:
    Don't be confused its simple Search in our device forum for CM Tree and Kernel and Vendor. The Dev of CM for your Device forum will specify it in his ROM thread.
    Once you obtain the github for your Device Tree, Vendor and Kernel. Enter following command
    Code:
    cd cm11/.repo
    Y6KmJsy.png

    Here in .repo folder you have to create file called local_manifests.xml
    1) Enter The Following Command in Terminal
    Code:
    nano local_manifest.xml
    mOFUkXi.png

    Structure of Local_manifest.xml is Has follows.
    Code:
    [COLOR=#000000][COLOR=#0000BB]<?xml version[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"1.0" [/COLOR][COLOR=#0000BB]encoding[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"UTF-8"[/COLOR][COLOR=#0000BB]?>
    [/COLOR]<manifest>
      [/COLOR]<project path=" directory in work tree" name="name of the repository in remote" remote="name of remote defined earlier" revision="branch of the repository" /> 
    [COLOR=#000000]</manifest>[/COLOR]
    2) Add your Device , Kernel , Vendor Source
    gHq689W.png


    Taking my Ex here of GT-I9082
    After Adding device tree , Vendor , kernel my Local_manifest.xml will look like has follows
    Code:
    [COLOR=#000000][COLOR=#0000BB]<?xml version[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"1.0" [/COLOR][COLOR=#0000BB]encoding[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"UTF-8"[/COLOR][COLOR=#0000BB]?>
    [/COLOR]<manifest>
      <project path="device/samsung/i9082" name="pawitp/android_device_samsung_i9082" remote="github" revision="cm-11.0" />
      <project path="vendor/samsung/i9082" name="k2wl/android_vendor_samsung_i9082" remote="github" revision="master" />
      <project path="kernel/samsung/i9082" name="pawitp/android_kernel_samsung_i9082" remote="github" revision="cm-11.0" />
    </manifest>[/COLOR]
    ABoaVKn.png

    3) Press ctrl+O and Enter
    DpbtNWp.png


    ZNqRufc.png

    4) Press Ctrl+X to exit.
    Sx5Onvn.png

    After Adding Device Tree,Vendor,Kernel sources just repo sync again so that the files are downloaded. you can also add which files you want to download or you dont want to download. More about manifest and local_manifest will be explained by @Kishan14 in his guide:D

    Once that is done now you have your device Identity with you:laugh::laugh::highfive:
    Now follow the Instruction Given by @rutvikrvr in POST 9 to make the your CM Device Tree Compatible with your ROM Source.

    Once your CM Device tree is successfully made compatible with your ROM its Time for Building :D:cool:
    Now Building Command Various with Rom which you want to compile its different for different ROM you have to see the Manifest of The Rom for it has instruction for building will be given there. Since i m Taking example of CM11 and Device has GT-I9082 the steps goes has follows
    1) Enter the Following command in Terminal
    Code:
    cd cm11
    Just Replace CM11 by your working directory of Rom . Ex : AOGP,AICP etc
    2)Now enter following Command To Terminal
    Code:
    [COLOR=#000000][COLOR=#007700]. [/COLOR][COLOR=#0000BB]build[/COLOR][COLOR=#007700]/[/COLOR][COLOR=#0000BB]envsetup[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]sh[/COLOR][/COLOR]
    3) Build Instruction Varies from Rom to Rom so check manifest of ROM for the Same. General instuction is
    Code:
    [COLOR=#262626]time brunch <codename>[/COLOR] [COLOR=#000000][COLOR=#007700]-[/COLOR][COLOR=#0000BB]j[/COLOR][COLOR=#FF8000]#[/COLOR][/COLOR]
    <Codename> CodeName of your Device
    # is the No of CPU cores you have.
    Building will take time depending on your system configuration.

    Once building is Done.
    Its Time to apply patches which will be given in our CM Rom thread if any.
    Follow the guide by @rutvikrvr in Post 10 for applying patches.
    Once Done rebuild again using command above (This time building will be fast)

    Now go to your working directory and go to OUT/target/your device/ you will get the Zip of the Rom.
    Always make a backup of your current Rom.
    Flash it via recovery and check.:laugh::laugh:

    :cool::cool:Hurrrrrray You Just Developed A Rom from Source:cowboy::cowboy:
    139
    Uploading Device Tree To Github

    So Guys till now we learnt lot of stuffs and finally we build a Rom :highfive: During building the Rom we may have edited lot of stuffs in device tree :D:D To avoid those being repeated in case you delete the Tree or If your ROM is Unofficial then you have to upload the Device Source Tree to Github. There are lot of uses if you upload the device tree.

    Lets Start with guide Now :D:D

    1) Create a account in Github.

    2) Generate a new SSH key
    Enter Following command to Terminal
    Code:
    ssh-keygen -t rsa -C "[email protected]"
    "[email protected]" = your github Email ID

    After pressing Enter you will Observe the following output
    Code:
    # Creates a new ssh key, using the provided email as a label
    # Generating public/private rsa key pair.
    # Enter file in which to save the key (/home/you/.ssh/id_rsa):
    Press Enter.

    Now you need to enter the passphrase
    Code:
    # Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again]
    Once all done you will see the following in your Terminal.

    Code:
    Your identification has been saved in /home/you/.ssh/id_rsa.
    # Your public key has been saved in /home/you/.ssh/id_rsa.pub.
    # The key fingerprint is:
    # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]
    Now go to ~/.ssh folder and copy your id_rsa.pub content into account administration on github.com.
    That is go to github account settings and SSH
    copy paste id_rsa.pub content there and save it done.:D:cowboy:

    Now Its Time To Check If Everything Works.:highfive:


    • Enter The Following Command To Terminal
      Code:
    • It should display has follows
      Code:
      The authenticity of host 'github.com (207.97.227.239)' can't be established.
      # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
      # Are you sure you want to continue connecting (yes/no)?
    • type yes and press enter
      Code:
      Hi username! You've successfully authenticated, but GitHub does not
      # provide shell access.
    Now All Done Its Time To Upload The Device Tree To Github :cowboy:

    Example Device and Rom : GT-I9082 and AOGP Rom.
    In the following steps i take my example device and Rom just replace the device with your device and Rom with your Rom:cool:

    Steps :


    • In Terminal
      Code:
      cd aogp/device/samsung/i9082
    IYwxiGJ.png


    MywR13m.png


    • Then Type Following
      Code:
      git init
    VX7TpL2.png


    ovdAnqa.png


    • Setting up of the git files required to push the files to the github account will be done by following command
      Code:
      git add .
    QA1GZTL.png

    • Now we need to comment on the files we are pushing to github hence enter following command
      Code:
       git commit -m "first commit"
    m6TUgMc.png

    • Now Go to your Github account click on add button on top next to your username and Select New repository
    o9hykDa.png

    • enter the Name of your repository in my case you can see the ScreenShot below
    MJrg5oy.png

    • now you can see some commands displayed enter the git link displayed in your repository created the terminal in my case
      Code:
      git remote add origin https://github.com/username/aogp_device_samsung_i9082.git
    q7GtUIv.png


    1mHEHlS.png


    • Last Step is To Push The Source to Github. Enter The Following Command in Terminal
      Code:
      git push origin master
    lxMlsq0.png


    The Passphrase is the same you entered while creating SSH key.

    06SbxM4.png


    • Finally your source is in Github now add Readme.md File and mention This is <ROM NAME> Device Tree For <Your Device>
    :D:cool:You Have Successfully Uploaded your Device Tree To Github :cowboy::cowboy:

    Credits
    @rutvikrvr
    @Kishan14
    @k2wl (My Mentor and Inspiration for Android)


    If You want to learn more about Github and Stuffs you can visit Following Guide by XDA Senior Moderator @eagleeyetom (Thanks a lot Sir)

    Guide Link : http://forum.xda-developers.com/showthread.php?t=1877040
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone