Building a custom ROM for the Moto-Z - Moto Z Questions & Answers

I need to add the SMSC95XX drivers to the Linux Kernel in an AOSP for the Moto-Z. Can someone tell me how one builds the Linux Kernel then the AOSP for the Moto-Z?
Thx,
Y-

YileKu said:
I need to add the SMSC95XX drivers to the Linux Kernel in an AOSP for the Moto-Z. Can someone tell me how one builds the Linux Kernel then the AOSP for the Moto-Z?
Thx,
Y-
Click to expand...
Click to collapse
Hello,
to include the driver download the kernel sources from here:
https://github.com/boulzordev/android_kernel_motorola_msm8996
and change
Code:
# CONFIG_USB_NET_SMSC95XX is not set to
to
Code:
CONFIG_USB_NET_SMSC95XX=Y
in "arch/arm64/configs/griffin_defconfig"
Something like
Code:
sed "/CONFIG_USB_NET_SMSC95XX/d" -i arch/arm64/configs/griffin_defconfig/griffin_defconfig && echo "CONFIG_USB_NET_SMSC95XX=y" >> arch/arm64/configs/griffin_defconfig/griffin_defconfig
should do the job ( run these inside the cloned kernel repo )

Moto-Z AOSP newbie
Thanks for the pointer. I can do that. I have built AOSP for the Nexus-6, but I have not built it for the Moto-Z Droid. Can someone point me to the general instructions on how to build for the Moto-Z?
CHeers,
Y-

Maybe can build MIUI for the Moto-Z?

rakee said:
Maybe can build MIUI for the Moto-Z?
Click to expand...
Click to collapse
Building miui has 2 way :
Building with rompatch and porting from similar device (Mi5 is good for for moto z) (it's not very common and certain way)
Here's patchrom link : https://github.com/MiCode/patchrom/branches
Patchrom latest version is marshmallow and it's too late to start building most of the people is updated to nuogat so they can't install MM kernel
But about second way (porting), I've tried this but no success to boot I got some errors on netlink uevent
So we need to wait for patchrom to get nougat update and I'll try porting it if I didn't buy new phone

rakee said:
Maybe can build MIUI for the Moto-Z?
Click to expand...
Click to collapse
I don't recognize 'MIUI' what is meant by this?

YileKu said:
I don't recognize 'MIUI' what is meant by this?
Click to expand...
Click to collapse
MIUI is a custom ROM from china

Any chance I can build a ROM for the Moto-Z from here https://source.android.com/source/building-kernels?

StarStorm said:
Hello,
to include the driver download the kernel sources from here:
https://github.com/boulzordev/android_kernel_motorola_msm8996
and change
Code:
# CONFIG_USB_NET_SMSC95XX is not set to
to
Code:
CONFIG_USB_NET_SMSC95XX=Y
in "arch/arm64/configs/griffin_defconfig"
Something like
Code:
sed "/CONFIG_USB_NET_SMSC95XX/d" -i arch/arm64/configs/griffin_defconfig/griffin_defconfig && echo "CONFIG_USB_NET_SMSC95XX=y" >> arch/arm64/configs/griffin_defconfig/griffin_defconfig
should do the job ( run these inside the cloned kernel repo )
Click to expand...
Click to collapse
Thanks StarStorm,
After making these changes, how does one build the ROM with the new kernel?
Y-

YileKu said:
Thanks StarStorm,
After making these changes, how does one build the ROM with the new kernel?
Y-
Click to expand...
Click to collapse
Oh, didn't see your reply until you quoted me~
You can follow Lineage's wiki entry for the Moto Z. Depending on which ROM you want to build you just change
Code:
repo init -u https://github.com/LineageOS/android.git -b cm-14.1
to
Code:
repo init -u <url> -b <branch>
, e.g.
Code:
repo init -u https://github.com/ResurrectionRemix/platform_manifest.git -b nougat
for Resurrection Remix. If you use a ROM that doesn't officially support the Moto Z ( everything other than AOKP/Lineage afaik ) you'll have to add https://github.com/boulzordev/android_device_motorola_griffin and https://github.com/boulzordev/proprietary_vendor_motorola_griffin to your local manifest. You can skip the "extract-files.sh" step if you do that. Once you synched everything with "repo sync" you can make the changes I described in my earlier post.

StarStorm said:
Oh, didn't see your reply until you quoted me~
You can follow Lineage's wiki entry for the Moto Z. Depending on which ROM you want to build you just change
Code:
repo init -u https://github.com/LineageOS/android.git -b cm-14.1
to
Code:
repo init -u <url> -b <branch>
, e.g.
Code:
repo init -u https://github.com/ResurrectionRemix/platform_manifest.git -b nougat
for Resurrection Remix. If you use a ROM that doesn't officially support the Moto Z ( everything other than AOKP/Lineage afaik ) you'll have to add https://github.com/boulzordev/android_device_motorola_griffin and https://github.com/boulzordev/proprietary_vendor_motorola_griffin to your local manifest. You can skip the "extract-files.sh" step if you do that. Once you synched everything with "repo sync" you can make the changes I described in my earlier post.
Click to expand...
Click to collapse
StarStorm,
Thanks for the direction. I am a bit of a newbie on this so I want to verify the steps:
1. Follow the instructions at https://forum.xda-developers.com/chef-central/android/how-to-build-lineageos-14-1-t3551484, up to the point you do the 'repo init'
2. Use the repo init command 'repo init -u https://github.com/ResurrectionRemix/platform_manifest.git -b nougat' instead.
3. Add the following repos to my manifest: https://github.com/boulzordev/androi...torola_griffin and https://github.com/boulzordev/propri...torola_griffin
4. Skip the 'extract-files.sh' command
5. do a 'repo sync' command
6. Modify the linux kernel to include the driver
7. follow the instructions for building at: https://forum.xda-developers.com/chef-central/android/how-to-build-lineageos-14-1-t355148
thx,
Y-

YileKu said:
StarStorm,
Thanks for the direction. I am a bit of a newbie on this so I want to verify the steps:
1. Follow the instructions at https://forum.xda-developers.com/chef-central/android/how-to-build-lineageos-14-1-t3551484, up to the point you do the 'repo init'
2. Use the repo init command 'repo init -u https://github.com/ResurrectionRemix/platform_manifest.git -b nougat' instead.
3. Add the following repos to my manifest: https://github.com/boulzordev/androi...torola_griffin and https://github.com/boulzordev/propri...torola_griffin
4. Skip the 'extract-files.sh' command
5. do a 'repo sync' command
6. Modify the linux kernel to include the driver
7. follow the instructions for building at: https://forum.xda-developers.com/chef-central/android/how-to-build-lineageos-14-1-t355148
thx,
Y-
Click to expand...
Click to collapse
Yep, looks good to me :good:

StarStorm said:
Yep, looks good to me :good:
Click to expand...
Click to collapse
I did the repo init command and I was looking to add the repos to the manifest. The only file I found was .repo/manifest.xml, it didn't seem obvious how to add the two repos above.
Y-

StarStorm said:
Oh, didn't see your reply until you quoted me~
You can follow Lineage's wiki entry for the Moto Z. Depending on which ROM you want to build you just change
Code:
repo init -u https://github.com/LineageOS/android.git -b cm-14.1
to
Code:
repo init -u <url> -b <branch>
, e.g.
Code:
repo init -u https://github.com/ResurrectionRemix/platform_manifest.git -b nougat
for Resurrection Remix. If you use a ROM that doesn't officially support the Moto Z ( everything other than AOKP/Lineage afaik ) you'll have to add https://github.com/boulzordev/android_device_motorola_griffin and https://github.com/boulzordev/proprietary_vendor_motorola_griffin to your local manifest. You can skip the "extract-files.sh" step if you do that. Once you synched everything with "repo sync" you can make the changes I described in my earlier post.
Click to expand...
Click to collapse
When I did the 'breakfast lineage_griffin-userdebug'
I get:
.......
* [new branch] cm-14.1 -> github/cm-14.1
Fetching projects: 100% (5/5), done.
Checking out files: 100% (52729/52729), done.
Syncing work tree: 100% (5/5), done.
Looking for dependencies in kernel/motorola/msm8996
Dependencies file not found, bailing out.
Looking for dependencies in external/bson
Dependencies file not found, bailing out.
Looking for dependencies in external/stlport
Dependencies file not found, bailing out.
Looking for dependencies in device/qcom/common
Dependencies file not found, bailing out.
Looking for dependencies in packages/resources/devicesettings
Dependencies file not found, bailing out.
Done
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
** Don't have a product spec for: 'lineage_griffin'
** Do you have the right repo manifest?
[email protected]:~/android/system$

YileKu said:
When I did the 'breakfast lineage_griffin-userdebug'
I get:
.......
* [new branch] cm-14.1 -> github/cm-14.1
Fetching projects: 100% (5/5), done.
Checking out files: 100% (52729/52729), done.
Syncing work tree: 100% (5/5), done.
Looking for dependencies in kernel/motorola/msm8996
Dependencies file not found, bailing out.
Looking for dependencies in external/bson
Dependencies file not found, bailing out.
Looking for dependencies in external/stlport
Dependencies file not found, bailing out.
Looking for dependencies in device/qcom/common
Dependencies file not found, bailing out.
Looking for dependencies in packages/resources/devicesettings
Dependencies file not found, bailing out.
Done
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
** Don't have a product spec for: 'lineage_griffin'
** Do you have the right repo manifest?
[email protected]:~/android/system$
Click to expand...
Click to collapse
Did you add https://github.com/boulzordev/proprietary_vendor_motorola_griffin to your manifest? What does your local manifest look like?

YileKu said:
I did the repo init command and I was looking to add the repos to the manifest. The only file I found was .repo/manifest.xml, it didn't seem obvious how to add the two repos above.
Y-
Click to expand...
Click to collapse
You aren't supposed to modify .repo/manifest.xml , add your local changes to .repo/local_manifests.xml ( with the same syntax as manifest.xml uses )

StarStorm said:
Did you add https://github.com/boulzordev/proprietary_vendor_motorola_griffin to your manifest? What does your local manifest look like?
Click to expand...
Click to collapse
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
** Don't have a product spec for: 'lineage_griffin'
** Do you have the right repo manifest?
[email protected]:~/moto-z/lineage$ cat .repo/local_manifest
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="1"
fetch="https://github.com/boulzordev/android_device_motorola_griffin" />
<remote name="2"
fetch="https://github.com/boulzordev/proprietary_vendor_motorola_griffin" />
</manifest>
[email protected]:~/moto-z/lineage$

YileKu said:
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
build/core/product_config.mk:254: *** _nic.PRODUCTS.[[device/motorola/griffin/lineage.mk]]: "vendor/motorola/griffin/griffin-vendor.mk" does not exist. Stop.
** Don't have a product spec for: 'lineage_griffin'
** Do you have the right repo manifest?
[email protected]:~/moto-z/lineage$ cat .repo/local_manifest
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="1"
fetch="https://github.com/boulzordev/android_device_motorola_griffin" />
<remote name="2"
fetch="https://github.com/boulzordev/proprietary_vendor_motorola_griffin" />
</manifest>
[email protected]:~/moto-z/lineage$
Click to expand...
Click to collapse
Add something like this to your local manifest, right now you only defined from where you want to download the device tree and the vendor files, you also need to specify where you want them located
Code:
<project path="device/motorola/griffin" name="android_device_motorola_griffin" remote="1" />
<project path="vendor/motorola/griffin" name="proprietary_vendor_motorola_griffin" remote="1" />

StarStorm said:
Add something like this to your local manifest, right now you only defined from where you want to download the device tree and the vendor files, you also need to specify where you want them located
Code:
<project path="device/motorola/griffin" name="android_device_motorola_griffin" remote="1" />
<project path="vendor/motorola/griffin" name="proprietary_vendor_motorola_griffin" remote="1" />
Click to expand...
Click to collapse
Thanks that worked. I had to remove a duplicate path in roomservice.xml, then the sync and breakfast worked.
Y-

Thanks. Okay the build is working. I tried : 'cd kernel/motorola/msm8996'; make ARCH=arm64 CROSS_COMPILE=arm-linux-androideabi- menuconfig; /* enabled SMSC drivers to be in the kernel */; cd -; breakfast lineage_griffin-userdebug; brunch lineage_griffin-userdebug;" and get an error compiling setup.c. Any chance i can get the steps to configure, compile and include the kernel in an android build?
Thanks,
Y-

Related

Guide on how I build my own CM9 test builts

A follow up on this - http://forum.xda-developers.com/showpost.php?p=28177937&postcount=1768 - in the CM9 FXP thread, have I promised to make a little guide.
Guide how I build CM9 for my Mango.
For the first time you try to build CM9.
Create ~/bin and download repo to that directory. Afterwards set executable bit to make it possible to ”execute”.
Code:
mkdir -p ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now reboot the computer.
Create ~/android/system amd initialize the repository.
Code:
mkdir -p ~/android/system
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync
Setup the environmental settings and initialize the Mango build.
Code:
. build/envsetup.sh
brunch mango
Setup the environmental settings and initialize the Mango build.
Code:
git clone git://github.com/TheMuppets/proprietary_vendor_semc.git -b ics ~/android/system/vendor/semc
cd ~/android/system/device/semc/mango/
./setup-makefiles.sh
Download the prebuilts
Code:
~/android/system/vendor/cm/get-prebuilts
Check for new changes
Code:
cd ~/android/system/
repo sync
Setup the environment again and build the ROM (takes long time)
Code:
. build/envsetup.sh
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-9-DATE-UNOFFICIAL-mango.zip
The next times you try to build it, you only need to do the following.
Delete build.prop, if not will build.prop not get generated.
Code:
rm -f ~/android/system/out/target/product/mango/system/build.prop
Syncronise the git repositories.
Code:
cd ~/android/system/
repo sync
Setup the environmental settings.
Code:
. build/envsetup.sh
Configure/build.
Code:
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-9-DATE-UNOFFICIAL-mango.zip
If you are trying to build it on a 32bit system, you should change line 374 in ~/android/system/device/semc/msm7x30-common/releasetools/common.py
from:
Code:
cmd = ["java", "-Xmx2048m", "-jar",
to:
Code:
cmd = ["java", "-Xmx1024m", "-jar",
If you get into any trouble, please let me know, I may have missed something.
EDIT (July 2. 2012): I have made a patch to msm7x30-common, so you do not need to edit the file (with this patch does it automatically check if you run on a 64bit or a 32bit system):
http://code.google.com/p/freexperia/issues/detail?id=527
EDIT (July 6. 2012): If there has been an update on git://github.com/koush/proprietary_vendor_semc.git (like there has been today), shall you do the following (pull the updates):
Code:
cd ~/android/system/vendor/semc
git pull
EDIT (July 8. 2012): Adding the following, just before "</manifest>" in ".repo/local_manifest.xml" and the proprietary files will also get updated, when you make a normal "repo sync". Got this idea after talking to Andreas (so thank you Andreas).
Code:
<project name="TheMuppets/proprietary_vendor_semc" path="vendor/semc" remote="github" revision="ics" />
EDIT (July 11. 2012): Changed the proprietary repository from git://github.com/koush/proprietary_vendor_semc.git to git://github.com/TheMuppets/proprietary_vendor_semc.git
allright, i have already synched the cm9 repo. about 5.8 gbs
can you tell me what folders does it include?
edit:took me a few days to download, just don't want to download again
gandhar said:
allright, i have already synched the cm9 repo. about 5.8 gbs
can you tell me what folders does it include?
Click to expand...
Click to collapse
Are you thinking of the "clean" repo?
My ~/android/system/ consists of the following (remember the hidden directories):
abi
android
bionic
bootable
build
dalvik
development
device
external
frameworks
hardware
kernel
libcore
ndk
out
packages
prebuilt
sdk
system
vendor
.repo
.repoconfig
Makefile
You should be able to move your current directory and "just" sync it, to get it up to date.
hnl_dk said:
Are you thinking of the "clean" repo?
My ~/android/system/ consists of the following (remember the hidden directories):
abi
android
bionic
bootable
build
dalvik
development
device
external
frameworks
hardware
kernel
libcore
ndk
out
packages
prebuilt
sdk
system
vendor
.repo
.repoconfig
Makefile
Click to expand...
Click to collapse
allright, out of these except for kernel, out and .repoconfig i have all the others synced.
will using
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync
work?
i am missing kernel, out and .repoconfig
gandhar said:
allright, out of these except for kernel, out and .repoconfig i have all the others synced.
will using
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync
work?
i am missing kernel, out and .repoconfig
Click to expand...
Click to collapse
They are possibly first created when running brunch the first time. So it should be fine.
successfully building, but getting loads of warnings..
is that normal for the first build?
will report if it boots after compile is over.
gandhar said:
successfully building, but getting loads of warnings..
is that normal for the first build?
will report if it boots after compile is over.
Click to expand...
Click to collapse
There are lots of warnings.
Personally I usually remove all that warnings (using the -Werror option, so warnings get treated as errors) in the projects I am working on. But I understand why it can be a big problem with CM9, that is based on many different projects.
Looking forward to hear if you get a successful built.
hnl_dk said:
There are lots of warnings.
Personally I usually remove all that warnings (using the -Werror option, so warnings get treated as errors) in the projects I am working on. But I understand why it can be a big problem with CM9, that is based on many different projects.
Looking forward to hear if you get a successful built.
Click to expand...
Click to collapse
building will take some time...
well, most warnings are 'some variable has been set but not used', is that much significant?
gandhar said:
building will take some time...
well, most warnings are 'some variable has been set but not used', is that much significant?
Click to expand...
Click to collapse
Yes, first build takes a lot of time... the next times it will be a lot faster.
No that is not very significant, but things like that should still get fixed, to to make it easier to find the significant things.
The less warnings the more easy it is to spot what is important. This also goes for things that should get changed when upgrading to a new major version of the toolchain.
succesfull build!
phone:coconut-wt19i
time: 56 mins for the complete build.
cpu: 2.9 ghz - 4 cores
os:ubuntu 12.04 64 bit
backed up the phone.
boots into recovery
errorless install.
gandhar said:
phone:coconut-wt19i
time: 56 mins for the complete build.
cpu: 2.9 ghz - 4 cores
os:ubuntu 12.04 64 bit
backed up the phone.
boots into recovery
errorless install.
Click to expand...
Click to collapse
Super, looking forward to hear if everything is going to run as as should
hnl_dk said:
Super, looking forward to hear if everything is going to run as as should
Click to expand...
Click to collapse
running fine.
but i see some dependencies missing from the libs needed from
http://wiki.cyanogenmod.com/wiki/Template:Build_from_source_(CM9)
downloading them, will build again later..
is that the reason for the warnings?
gandhar said:
running fine.
but i see some dependencies missing from the libs needed from
http://wiki.cyanogenmod.com/wiki/Template:Build_from_source_(CM9)
downloading them, will build again later..
is that the reason for the warnings?
Click to expand...
Click to collapse
looks like a nice guide that is working with most devices, will save that link
No, the warnings are simply that you rarely find "clean" code, where most warnings have been fixed.
You also need to think of all the code from external projects.
You also only get many of the warnings, if you do not compile the code for some specific platforms.
hnl_dk said:
looks like a nice guide that is working with most devices, will save that link
No, the warnings are simply that you rarely find "clean" code, where most warnings have been fixed.
You also need to think of all the code from external projects.
You also only get many of the warnings, if you do not compile the code for some specific platforms.
Click to expand...
Click to collapse
saw that guide after i started checking for dependencies.
1.hey i see two zips in the output,
one cm-9-20120702-UNOFFICIAL-coconut and other cm_coconut-ota-eng.gandhar
the second is bigger.
i used the first one. why is the second one built i wonder?
2.i think of compiling aosp from source too, but the out folder is 11.3 gbs, what about that?
i do not want to end up falling short on space.
3.this is a system related question, how much will it hinder performance if i move the source to a different internal hd from the main one and build from there?
gandhar said:
saw that guide after i started checking for dependencies.
1.hey i see two zips in the output,
one cm-9-20120702-UNOFFICIAL-coconut and other cm_coconut-ota-eng.gandhar
the second is bigger.
i used the first one. why is the second one built i wonder?
Click to expand...
Click to collapse
Try to read the name ;-)
OTA - Over The Air... I guess that it can mbe used tfor OTA updates, like the mobile companies makes.
gandhar said:
2.i think of compiling aosp from source too, but the out folder is 11.3 gbs, what about that?
i do not want to end up falling short on space.
Click to expand...
Click to collapse
You could do a "make clear", but if you have enough space, would I keep it, so you do not need to wait for the already up to date files.
gandhar said:
3.this is a system related question, how much will it hinder performance if i move the source to a different internal hd from the main one and build from there?
Click to expand...
Click to collapse
There will be no problem with performance, as long as you move it to a HDD that is not too slow.
EDIT (July 2. 2012): I have made a patch to msm7x30-common, so you do not need to edit the file (with this patch does it automatically check if you run on a 64bit or a 32bit system):
http://code.google.com/p/freexperia/issues/detail?id=527
i do a repo sync again, at end of it i get errors on changed files. i think its not replacing the old files.
it's red text
error: bootable/recovery/: CyanogenMod/android_bootable_recovery checkout f8fc12e741d566af215407f35cfc52e5c1cc0023
error: build/: CyanogenMod/android_build checkout df7d6893a59e62c15dd20e306d8280b16969097c
error: external/openssl/: CyanogenMod/android_external_openssl checkout d4004ae717232b83ea445f74c881d9ddc24f589d
error: frameworks/base/: CyanogenMod/android_frameworks_base checkout e0a8c35c1572f0f0dbbda4d871d0a919a79cbe3f
error: hardware/samsung/: CyanogenMod/android_hardware_samsung checkout 23280fc439163a1971956167217283c4ae70bce3
error: packages/apps/Camera/: CyanogenMod/android_packages_apps_Camera checkout 644384a979ec9bd6b237e9031d5afbf592d3056b
error: packages/apps/Settings/: CyanogenMod/android_packages_apps_Settings checkout a946d9a905d460fa9d6c153e031285b566f8d223
error: system/core/: CyanogenMod/android_system_core checkout 389a2fa1d7e4bb8b6be411f272de2e8c92817964
gandhar said:
i do a repo sync again, at end of it i get errors on changed files. i think its not replacing the old files.
it's red text
error: bootable/recovery/: CyanogenMod/android_bootable_recovery checkout f8fc12e741d566af215407f35cfc52e5c1cc0023
error: build/: CyanogenMod/android_build checkout df7d6893a59e62c15dd20e306d8280b16969097c
error: external/openssl/: CyanogenMod/android_external_openssl checkout d4004ae717232b83ea445f74c881d9ddc24f589d
error: frameworks/base/: CyanogenMod/android_frameworks_base checkout e0a8c35c1572f0f0dbbda4d871d0a919a79cbe3f
error: hardware/samsung/: CyanogenMod/android_hardware_samsung checkout 23280fc439163a1971956167217283c4ae70bce3
error: packages/apps/Camera/: CyanogenMod/android_packages_apps_Camera checkout 644384a979ec9bd6b237e9031d5afbf592d3056b
error: packages/apps/Settings/: CyanogenMod/android_packages_apps_Settings checkout a946d9a905d460fa9d6c153e031285b566f8d223
error: system/core/: CyanogenMod/android_system_core checkout 389a2fa1d7e4bb8b6be411f272de2e8c92817964
Click to expand...
Click to collapse
Have not tried that.
You can try to do a "repo forall -c git reset --hard" this "resets" all the repositories (removes all changes, also if something has been corrupted).
hnl_dk said:
Have not tried that.
You can try to do a "repo forall -c git reset --hard" this "resets" all the repositories.
Click to expand...
Click to collapse
will it redownload?

[GUIDE][DEV][DISCONTINUED] How I build my own CM10.1 test builds

This is still unofficial. This thread is intended for devs & advanced users only.
Guide how I build CM10.1 for my smultron.
For the first time you try to build CM10.1
Follow this guide up to "Initialize the CyanogenMod source repository" step (don't execute this step).
http://wiki.cyanogenmod.org/w/Build_for_smultron
Download & install lzop compression tool
Code:
sudo apt-get install lzop
Initialize the CyanogenMod source repository
Enter the following to initialize the repository:
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
Get the required local manifest
Code:
mkdir -p ~/android/system/.repo/local_manifests
curl https://raw.github.com/LegacyXperia/local_manifests/cm-10.1/semc.xml > ~/android/system/.repo/local_manifests/semc.xml
Download the source code
Code:
repo sync
Download some commits from CyanogenMod gerrit which are not accepted yet
Code:
curl https://raw.github.com/LegacyXperia/local_manifests/cm-10.1/updates.sh > ~/android/system/updates.sh
chmod a+x updates.sh
./updates.sh
Get the prebuilts
Code:
cd ~/android/system/vendor/cm
./get-prebuilts
Setup the environment & prepare the device-specific code.
Code:
cd ~/android/system
. build/envsetup.sh
breakfast smultron
Build the ROM (takes long time)
Code:
brunch smultron
If the build finishes successfully, you will find the build here (change DATE into the date):
~/android/system/out/target/product/smultron/cm-10.1-DATE-UNOFFICIAL-smultron.zip
The next times you want to build, you only need to do the following:
Sync the repositories & make sure you are using the latest local_manifest.
Code:
cd ~/android/system/
curl https://raw.github.com/LegacyXperia/local_manifests/cm-10.1/semc.xml > ~/android/system/.repo/local_manifests/semc.xml
repo sync
Download some commits from CyanogenMod gerrit which are not accepted yet
Code:
curl https://raw.github.com/LegacyXperia/local_manifests/cm-10.1/updates.sh > ~/android/system/updates.sh
chmod a+x updates.sh
./updates.sh
Setup the environment
Code:
. build/envsetup.sh
Build the ROM
Code:
brunch smultron
If the build finishes successfully, you will find the build here (change DATE into the date):
~/android/system/out/target/product/smultron/cm-10.1-DATE-UNOFFICIAL-smultron.zip
Steps to build only the kernel:
Sync the repositories.
Code:
cd ~/android/system/
repo sync
Setup the environment
Code:
. build/envsetup.sh
Build the kernel
Code:
breakfast smultron
make -j4 bootimage
If the build finishes successfully, you will find the boot image here:
~/android/system/out/target/product/smultron/boot.img
Credits: Thanks to hnl_dk for the initial CM9 & CM10 guides.
Build is successful using this guide now. You can build for all xperia 2011 phones by replacing "smultron" with your device's name in the guide.
More info can be found here: https://github.com/LegacyXperia/local_manifests/wiki
Re: [GUIDE][WIP] How I build my own CM10.1 test builds
Wew good guide! :thumbup: hope can get the stable version of the CM10.1with this guide here
Sent from my SK17i using xda premium
After 'repo init' there should be a
Code:
mkdir -p ~/android/system/.repo/local_manifests
Script to apply not yet merged changes:
Code:
#!/bin/sh
android=~/android/system
#http://review.cyanogenmod.org/#/c/32906/
cd ${android}/frameworks/av/
git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_av refs/changes/06/32906/2 && git format-patch -1 --stdout FETCH_HEAD | patch -p1
#http://review.cyanogenmod.org/#/c/28336/
cd ${android}/packages/apps/LegacyCamera/
git fetch http://review.cyanogenmod.org/CyanogenMod/android_packages_apps_LegacyCamera refs/changes/36/28336/1 && git format-patch -1 --stdout FETCH_HEAD | patch -p1
#http://review.cyanogenmod.org/#/c/34989/
cd ${android}/hardware/qcom/audio-caf
git fetch http://review.cyanogenmod.org/CyanogenMod/android_hardware_qcom_audio-caf refs/changes/89/34989/5 && git format-patch -1 --stdout FETCH_HEAD | patch -p1
From http://forum.xda-developers.com/showthread.php?t=1358547
Code:
repo sync -f
May fix error: Exited sync due to fetch errors
hi,
I want to build CM 10.1 for my mango, guide is perfectly explain, just one question :
does i need to add the script part explain by M66B two post above or it's outdated and i just need to follow the first post ?
Thanks
Edit : sorry for the noob question, i have read the reviews and have my answer
kosmo666 said:
hi,
I want to build CM 10.1 for my mango, guide is perfectly explain, just one question :
does i need to add the script part explain by M66B two post above or it's outdated and i just need to follow the first post ?
Thanks
Edit : sorry for the noob question, i have read the reviews and have my answer
Click to expand...
Click to collapse
The scrip parts from above are outdated, we maintain this script now.
How to merge in this nAa 3.4.45 kernel sources? Is it connected with kernel sources?
mastero9017 said:
How to merge in this nAa 3.4.45 kernel sources? Is it connected with kernel sources?
Click to expand...
Click to collapse
If you look at Mike's github (https://github.com/LegacyXperia)
you'll see that he maintains his own branch of the nAa kernel (https://github.com/LegacyXperia/msm7x30-3.4.x-nAa).
They are not the same, but similar (Mike currently has more changes, since nAa hasn't updated anything for two weeks).
-> If you build Mike's sources, you'll also get a 3.4.45 kernel.
What am I doing wrong? Did everything, checked all libs 10 times..
EDIT: It's a KDE error,aghhr. Delete/clean /root/.config directory fixes it
Code:
[email protected]:~/android/system# brunch haida
including vendor/cm/vendorsetup.sh
Trying dependencies-only mode on a non-existing device tree?
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.2.2
CM_VERSION=10.1-20130603-UNOFFICIAL-haida
TARGET_PRODUCT=cm_haida
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.2.0-41-generic-x86_64-with-Ubuntu-12.04-precise
HOST_BUILD_TYPE=release
BUILD_ID=JDQ39E
OUT_DIR=/root/android/system/out
============================================
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.2.2
CM_VERSION=10.1-20130603-UNOFFICIAL-haida
TARGET_PRODUCT=cm_haida
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.2.0-41-generic-x86_64-with-Ubuntu-12.04-precise
HOST_BUILD_TYPE=release
BUILD_ID=JDQ39E
OUT_DIR=/root/android/system/out
============================================
make: *** /.config: is a directory. Stop.
Guys,
For your info Windows Host NTFS file system is case insensitive and will break android compilation!!!
Workaround: Create a new virtual hdd with ext3 format and mount it to your ubuntu guest! Sad that ntfs cannot be used.
So, below is for your info if u came across this post. It is useful for sharing folders between Linux guest and Windows host.
IF you are using Virtualbox on a Win7/8 host system,
To use Shared Folder feature and add automount (note, VirtualBox needs to be run as Administrator so that os.symlink works!!!!
In Windows:
1. Go to your VirtualMachine Folder and look for MyVM.vbox,
2. Open with notepad++
3. Look for <ExtraData>
4. Add this inside the <ExtraData></ExtraData>
Code:
<ExtraDataItem name="VBoxInternal2/SharedFoldersEnableSymlinksCreate/android" value="1"/>
where "android" is my shared folder!!! =)
In terminal:
Code:
sudo nano /etc/fstab
Add this line:
Code:
/android /home/myName/android vboxsf rw,uid=1000,gid=1000 0 0
where android is the folder I give when sharing in SharedFolder of the VirtualBox and /home/myName/android is the folder I created in Ubuntu.
Ctrl+O and hit Enter to save. Ctrl+X to quit. and Reboot and you are done.
Also, if you encounter error or Virtualbox/ubuntu hung on repo sync, add -j2 or -j3 to prevent race condition!!!
Code:
repo sync -j3
Syncing work tree error!!!
If you encounter syn error
Code:
Fetching projects: 100% (204/224), done.
Syncing work tree: 90% (204/224) error: manifest required for this command -- please run init
1. Go to "android\system\.repo\"
2. Open "project.list" with notepad or notepad++
3. Go to the line of error. In this case, line 204 as above.
4. E.g. Ling 204 shows: external/wpa_supplicant_6, So, go to the folder "android\system\external\wpa_supplicant_6" and delete ".git" folder
5. Go back to Terminal and "repo sync"
=)
You need the lz4 compression tool from now on to be able to build the kernel. First post is updated with instructions on how to get it.
Code:
sudo apt-get install subversion
cd ~/Downloads
svn checkout -r 91 http://lz4.googlecode.com/svn/trunk/ lz4
cd lz4 && make && cp lz4demo ~/bin/lz4demo
Can any body please tell me,what's the exact size of full cm10.1. Source repo
I had set my laptop to download repo from last 32 hours
And till now more than 8gb data was downloaded ....
And how to know how much data left for download...?
Can anybody give me the exact size of the gits which are to be download so that I can compare that sizes with the files which I had downloaded....?
Sent from my Xperia Mini Pro
Hey @mikeioannina,
Do you have any guide on repo branch? In windows, git gui is easy to do. But I'm not familiar with ubuntu.
How do you branch out the project without error?
I tried in ~/android/system:
Code:
repo start kernel-patch .
it says . project not found. What the hell. Needa branch and test some codes!!! =)
Also, is there a private directory for us to put binary to system/apps or scripts which will not be affected by "repo sync" during compilation?
---------- Post added at 06:42 PM ---------- Previous post was at 06:40 PM ----------
hijagdeep said:
Can any body please tell me,what's the exact size of full cm10.1. Source repo
I had set my laptop to download repo from last 32 hours
And till now more than 8gb data was downloaded ....
And how to know how much data left for download...?
Can anybody give me the exact size of the gits which are to be download so that I can compare that sizes with the files which I had downloaded....?
Sent from my Xperia Mini Pro
Click to expand...
Click to collapse
It's around ~25GB. Maybe less due to compression. ^_^
shenlong85 said:
It's around ~25GB. Maybe less due to compression. ^_^
Click to expand...
Click to collapse
Someone told me that its around 8 gb
Sent from my Xperia Mini Pro
hijagdeep said:
Someone told me that its around 8 gb
Sent from my Xperia Mini Pro
Click to expand...
Click to collapse
If you initiated with the CM10.1 branch, it will be 14Gig, if you initiated with no branch, 25Gig
Langes said:
If you initiated with the CM10.1 branch, it will be 14Gig, if you initiated with no branch, 25Gig
Click to expand...
Click to collapse
I have initiated with this repo command
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
and also used this local manifests
mkdir -p ~/android/system/.repo/local_manifests
curl https://raw.github.com/LegacyXperia/local_manifests/master/semc.xml > ~/android/system/.repo/local_manifests/semc.xml
and now 25 hours are passed and it downloaded 9.5gb data ..
hijagdeep said:
I have initiated with this repo command
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
and also used this local manifests
mkdir -p ~/android/system/.repo/local_manifests
curl https://raw.github.com/LegacyXperia/local_manifests/master/semc.xml > ~/android/system/.repo/local_manifests/semc.xml
and now 25 hours are passed and it downloaded 9.5gb data ..
Click to expand...
Click to collapse
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1 is for the whole cm10.1 sources. Be patient. Are you using full blown linux host or just a virtual machine? IF you are using virtual machine, it may be slow and have race condition during repo which results in errors. Try using
Code:
repo sync -j3
For 3 simultaneous thread or j2 depending on the number of core in your processor and whether there is hyperthreading. It'll make it more stable.

[GUIDE][COMPLETE] All in one Android Development [NOOB FRIENDLY]

Hi All,
I and @akhilnarang decided to post this guide to help anyone wanting to learn building of Roms and kernels. We will be using Ubuntu 14.04 Trusty Tahr here.
You can find instructions to install it elsewhere, just remember rom building needs 64bit OS, minimum 4GB RAM, and 100GB space on HDD. Kernel can be built on less hardware, but will take long
Make sure you have fast net, as you have to download at least 16GB of ROM sources, or more kernel, only 1GB of sources max.
Be prepared to spend a lot of time downloading, learning, and fixing bugs
More RAM, or faster CPU, or SSD will speed up the process.
From our personal experiences we have found that this is the best, stable, up-to-date version of Ubuntu yet. This has come from my trial and errors, searching all over the web, and bits I picked up from here and there.
We will move Rom building part when we completed this step properly. Step by step we will learn compiling kernel, using Github, Gerrit, Cherry-picking.
At the end of the post I have linked a script by @akhilnarang which if run will automatically install all these programs for lazy people like us haha [emoji14]
If you not interested to do all procedure from below just use the script. Simply it will automatically configure the build environment.
NOTE-------- some of these packages may already be on your machine. Obviously, if you complete a step and you have one of these installed, the machine simply will not do anything. So...it will not hurt anything. Some of the packages are different from Ubuntu 12.04 and 13.04 (use these packages for Ubuntu 14.04 as many of the old ones have obsoleted - these are new replacements).
So if you set up your pc with Ubuntu we are good to go.
All code will be in code boxes like this:
Code:
$
means you have to run that command in the terminal (don't type the $).
All commands with sudo, gksudo, or gksu means it requires root permission.
It will ask for password.
Once you type, then in that terminal session it will not ask you for a few minutes again.
Any time you make changes to .bashrc or .profile file, make sure to run
Code:
$ source ~/.bashrc
$ source ~/.profile
Or exit and open new terminal else the changes will not take place
Setting up build environment:
Installing Java JDK
Note: You need JDK 7 when you willing to compile Lollipop. If you wanna compile KitKat or lower you need JDK 6.
Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one:
Download & install java
Code:
$ sudo apt-get update && sudo apt-get install openjdk-7-jdk openjdk-7-jre
CHECK if java properly installed or not
Code:
$ java -version
If you get output like
Code:
java version "1.7.0_79"
on the first line then all is good
Now JDK is configured!
Note: Only for Ubuntu 14.04 or higher
Installing Required Packages
Open Terminal
Now execute this command:
Note: This will take some time, has to download about 500MB or so of packages
Code:
$ sudo apt-get update && sudo apt-get install git-core python gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-7-jdk pngcrush schedtool \
libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib liblz4-* android-tools-adb android-tools-fastboot ccache
Configuring USB Access
Now we need to set permissions so that our USB ports can detect our android devices [emoji14]
Type in the following commands, it will download a file with the permissions, give it permission to execute, and restart the service.
Code:
$ sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/snowdream/51-android/master/51-android.rules
$ sudo chmod 644 /etc/udev/rules.d/51-android.rules
$ sudo chown root. /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
$ sudo killall adb
ADB & Fastboot are configured
Installing Repo Package
Open terminal and type:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Configure Git
Open terminal and type:
Code:
$ git config --global user.email ""
$ git config --global user.name ""
Git is configured.
Configure ccache
Open terminal and type:
Code:
$ gksu gedit ~/.bashrc
Enter these lines
Code:
export USE_CCACHE=1
export CCACHE_DIR=~/.ccache
Save & close
Open terminal & execute:
Code:
$ source .bashrc
$ ccache -M 50G
I usually use 50 gigs. You can use more if you have more space, or build for many devices
Make a GitHub account using the same email address you used for configuring git
Then follow these
So if you not interested in doing above all steps then simply use this script by my friend @akhilnarang
Open terminal and type:
Code:
$ sudo apt-get install git-core
then do
Code:
$ git clone https://github.com/akhilnarang/scripts.git
$ cd scripts
$ . build-environment-setup.sh
This script will install all required packages
Congrats
YOUR BUILD ENVIROMENT IS NOW SETUP
Now move onto #2nd post for Git and repo tutorial
To be continued
How To Use Git!
Now, to explain about git
Its a version control system, for code, like mercurial or subversion
Most android source code is either at AOSP
Most custom ROMs like CyanogenMod,Radium, host their code over at GitHub
So to start off, make a GitHub Account!
Here, you will find all the various repositories, full of code
All files are stored in repositories
When browsing a repository, you will see a button called fork
This will make a copy of it in your account, so you can edit it, and even submit changes for approval to the parent account
Now, to download the source of a repository onto your computer, we use git clone command
Code:
$ git clone https://github.com/akhilnarang/scripts
So we download the scripts from my github onto your PC, so we can run them
Now, if you added your ssh key as shown in bottom of post #1, then when cloning a repo from your account, while copying the link from bottom right corner, choose ssh link.
If you, when pushing(uploading)local changes, you will not be prompted for username and password, your ssh key will identify you .
After cloning, cd to the directory
Run
Code:
git remote -v
This will show a list of remotes
Default is origin, i.e. the link you have cloned from
Now once we make our changes locally
Code:
$ git add -A
This stages all modified/added/deleted files to be committed
Code:
$ git commit
This opens a text editor for you to write a commit message for your commit
Just give me brief description of your changes or something :v.
Then
Code:
$ git push <remote-name> HEAD:<branch>
If you have cloned, then remote will be origin
Branch can be checked by
Code:
git branch
, and also online from where you cloned
If you used https:// URL then you will be prompted for username and password to authenticate yourself
If git:// URL you can't push, you will need to use a https:// or ssh link
Another way to push can be
Code:
$ git push <link> HEAD:<branch>
Now say you want to make your own git repository of your files
Click on the new repository button on GitHub, give a name
You can do initial commit online, or locally
Follow the instructions it gives you
i.e. if you have all files ready (in a folder)
Code:
$ git init
$ git add -A
$ git commit
$ git push <link> HEAD:<branch>
A VERY important thing to be noted while using version control systems like git, is to preserve authorship of a commit
If someone else has made some changes to a file, and we want them, we should not copy the changes and commit, but should give them authorship either by cherry-picking(will be explained)
Or using this syntax
Code:
$ git commit --author="Author Name <[email protected]>"
Through this git will know the correct authors
Not giving proper authorship is known as kanging, not appreciated here on XDA,(or anywhere else for that matter), and can cause you to be banned :3
Anyway, on to cherry-picking
Go to your repository
Code:
$ git remote add blahblah link-to-url-you-want-commit-from
$ git fetch blahblah branch-commit-is-on
$ git cherry-pick Commit-sha1-hash
If you see a commit on GitHub, or GitLab, or BitBucket, there is a unique(to that repo) SHA for every commit to identify it
Fetch the correct repo as shown above, and paste the commit id
That will fetch the changes
However, if your local source is quite different from the source you cherry-picked from, it will conflict
If so your terminal will display it
then run
Code:
$ git status
Files shown in red color have conflicts
Open them with a text editor like Atom(my favorite), nano, gedit, vim, etc
Look for <<<<<<<
From there, the content till ======
is the original content
=======
till >>>>>>> *insert commit message here* is the new stuff
So check the commit, figure out what's wrong, fix it, save.
Then
Code:
$ git add -A
$ git commit
If no conflicts it will commit on its own and you just need to
Code:
$ git push
as explained earlier :v
Running
Code:
$ git log
will show you a list of commits , authors, and SHA
If for some reason you wanna remove some commit, use
Code:
$ git revert commit-SHA
Just like cherry-picks, it may have conflicts
Anyway, this is just a small guide to get started off
You can easily found out more by searching, and experimenting
I will add more stuff here soon
Enjoy with this much till then
Building CyanogenMod for those device which officially supported​If our build environment setted up successfully and after we learnt some Git and repo thing now we will concentrete on rom building
Now we have to Initialize Repo. We will try to build CyanogenMod.
Initialize the repo:
Code:
Code:
$ mkdir cm
$ cd cm
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-13.0
$ repo sync -f --no-clone-bundle
For people who have already done a repo init:
Code:
$ cd cm
$ repo sync -f --no-clone-bundle
When prompted, enter your real name and email address.
Continue onto adding a device
~How To Add A Device To The List~
Find the github for your device you wish to add. (We will give Android One Devices(sprout4&sprout8) as an example
Navigate back to your home directory for building:
Code:
$ cd ~/cm
$ source build/envsetup.sh
Or
$ . build/envsetup.sh
That sets up your environment for building
Get your list of devices:
Code:
$ brunch
Choose your device from the list, till will fetch tree and dependencies if needed, sometimes vendor tree will need to be added manually (In case of CyanogenMod, rest all ROMs keep in dependencies)
Build will start,enjoy!
For users who like understanding>
Code:
. build/envsetup.sh
runs a shell script, which adds various environment variables,etc, and some commands.
Calling "brunch" actually runs the command
Code:
breakfast [email protected] && mka bacon
(for CM)
[email protected] in shell script means all the parameters that have been passed, so if you passed brunch sprout, it would pass sprout
breakfast calls lunch, which selects the device, prepares the environment for building for it, fetches dependencies with the help of roomservice python script
"mka bacon"
This calls GNU make, and passes bacon as a parameters, to be "made"
mka is used instead of make, as it automatically uses all available threads of your CPU
If you have a quad core Intel, or octa core AMD, you could run make -j8 bacon
This is just the gist of it, reading through the envsetup.sh would make it clearer
If successful, you will get a zip in out/target/product/device
If not, check post #6
Most likely, you will find a solution there.
If not, please ask us in the thread, we would be happy to assist you
To be continued
Kernel Compilation
As many of you'll already know, kernel of an operating system
Android devices use a modified version of the linux kernel
Firstly, most important thing to note, in that the Linux Kernel is licensed under the GNU GPL (General Public License), which can be found here
Basically, you must always keep your work on the kernel open-source, and display the link to it when publishing your work on XDA Threads, etc
In order to do this, make sure you fork, or push the kernel source you're working on to your GitHub account so that you can push the changes you're making
Make sure you give proper authorship, as explained in post #2
If unable to, give credits to author in commit message, but don't kang please [emoji14]
Please try to have at least a basic knowledge of C, so that you can fix errors
Else, use Google before asking in thread, there's a huge chance someone has already gotten and solved it :v
So now, getting to work
I will give an example using Android One Device (sprout4&&sprout8)
The kernel source be found here(branch android-mediatek-lollipop-mr1 for 5.1,or something, not sure, check), and also here, branch cm-12.1 for 5.1 ROMs
So fork it to your GitHub account, or clone from AOSP and push to your git
I'd recommend the one from CM git, as it usually has small bugs fixed compared to stock
In my device's case, a whole lotta broken stuff is fixed, so I would take from cm
So start off, by installing all dependencies as shown in 1st post
Code:
$ git clone https://github.com/akhilnarang/android_kernel_mediatek_sprout -b cm-12.1 sprout-kernel
Replace the link with your own, ssh if you wish, as explained in #2
You must specify -b cm-12.1,as the default is cm-11.0, and you will end up will KitKat source!
The last parameter is optional, it saves it in that directory, in this case sprout-kernel
Now, all kernel source's have a file called a defconfig, or default configuration, that is device-specific
You will find it in arch/*your devices architecture*/configs
Your device may be arm, arm64, x86
Make sure you remember the name of the defconfig, you can rename it too [emoji14]
If you would like to give your kernel a name, simplest way would be to look for the CONFIG_LOCALVERSION in the defconfig
Make it something like
Code:
CONFIG_LOCALVERSION="-Your-Kernel-Name"
Anyway, so now you need a toolchain
For starting off, we will use GCC 4.8 from Google
For ARM devices
Code:
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/
For aarch64/arm64
Code:
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8/
For x86 I'm not sure, go have a look here
Now remember where you saved it
Now open the file called "Makefile" in the root of kernel source
Look for a line that has ARCH?=
that dosen't start with a # (lines starting with # are comments)
And make it
Code:
ARCH ?= arm
or
Code:
ARCH ?= arm64
And look for CROSS_COMPILE ?=
make it
Code:
CROSS_COMPILE ?= path/to/downloaded/toolchain/bin/arm-eabi-
for arm devices
Code:
CROSS_COMPILE ?= path/to/downloaded/toolchain/bin/aarch64-android-linux-
for arm64 devices
This may differ on Custom toolchains, etc, you can find out about that by viewing the commits of different kernels, and going through various threads
I'm only gonna explain how to compile the kernel, not how to add stuff (at least for now)
If you wish now, you can refer to #2, and commit and push these changes [emoji14]
Now run
Code:
$ make cyanogenmod_sprout_defconfig
That's what my defconfig is called, yours maybe called something else [emoji14]
And now finally to start the build
First, check how many cores/threads your CPU has
A quad core Intel, an octa core AMD, will have 8
So if you have one, run
Code:
$ make -j8
This will compile the code on all 8 threads parallely
However this makes debugging errors harder
If you have an error, just run
Code:
$ make
to reduce output and identify error
Anyway, the process generate a zImage in arch/arm/boot/zImage
or arch/arm64/boot/zImage
This is a binary file
If you check the zip of your favorite custom kernel, you will find one too
In most cases, you can simply replace it with this, update the updater-script, and flash
Most of these zips use anykernel format, meaning it utilizes ramdisk from existing kernel, so if you find such a zip for your device, you're good to go
Else unpack your boot.img and add this add the file boot.img-zImage, repack, flash
If you don't understand any of these terms [emoji14], please google about them first, and then if you are unable to find out ask here please
Enjoy
More stuff will be added soon
Uses of Local_manifests​
Now we will learn what is Manifest. Its used for syncing source from Github,Bitbucket. Its driven via XML. Basically XML is a markup language. We can modify Rom's default.xml but it can cause of conflicts next time. So never think of editing default.xml
Now you can say how we sync our desired repo without modifying default manifest? There is a option called local manifests. By local manifests we can sync our desired repository. You can add,remove any project from default manifest without modifying default.xml
So now we will learn using local manifests-----
Open terminal and type
Code:
cd your source directory name/.repo
e.g: cd cm/.repo
Now create a new directory called local_manifests
Then type
Code:
cd local_manifests
Now type
Code:
nano localmanifest.xml
Now add whatever you want and save it via "ctrl+X"
Adding or Removing repo
Open localmanifest.xml then
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="CyanogenMod/android_frameworks_base" />
<project path="frameworks/base" name="Anik1199/android_frameworks_base" remote="github" revision="cm-13.0"/>
This will remove project from CyanogenMod and sync from Anik1199's git.
When adding a new project that replaces an existing project, you should always remove that project before defining the replacement.
You can simply add a new project to the source code, such as when you want to add your own app to the build.
Note that when adding new projects, there are at least three parts defined:
• remote -- the name of the remote. this can be one that was defined in either the default manifest or local_manifest.xml.
• name -- the name of the git project-- for github it has the format account_name/project_name.
• path -- where the git repository should go in your local copy of the source code.
• revision -- (optional) which branch or tag to use in the repository. If this attribute is omitted, repo sync will use the revision specified by the <default ... /> tag in the default manifest.
After creating .repo/local_manifests.xml, you should be able to repo sync and the source code will be updated accordingly
In many Manifest.xml you ll find many stuff not needed by our device. Also there are files needed and that is not present in the default.xml.
Adding Projects to local_manifest.xml
So, to add projects to your local_manifest.xml for your device refer the following format that explains the same.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path=" directory in work tree" name="name of the repository in remote" remote="name of remote defined earlier" revision="branch of the repository" />
</manifest>
If you have any doubt? See my localmanifest.xml
Device Example Used Here : Android One (Sprout)
Code:
<manifest>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!--Devices-->
<project path="device/google/sprout4" name="CyanogenMod/android_device_google_sprout4" remote="github" revision="cm-13.0" />
<!--Devices commons-->
<project path="device/google/sprout-common" name="CyanogenMod/android_device_google_sprout-common" remote="github" revision="cm-13.0" />
<!--Kernels-->
<project path="kernel/mediatek/sprout" name="CyanogenMod/android_kernel_mediatek_sprout" remote="github" revision="cm-13.0" />
<!--Vendors-->
<project path="vendor/google" name="TheMuppets/proprietary_vendor_google" remote="github" revision="cm-13.0" />
</manifest>
This will download your device Identity needed for Rom Building
Making CM Device Tree Compatible With Your Rom For Compiling​
We learnt how to initialize build environment,learnt some git,how to use local_manifest and learnt how to build CyanogenMod. Now we will learn how to compatiable CyanogenMod device tree for other Rom. We used Android One aka sprout as a reference. Now we will try to build another CyanogenMod based Rom for sprout.
I am using Team-Radium Rom as reference. So we can start......
There are 3 files in CM Tree Which Should Be Modified.
They are,
1) cm.mk
2) cm.dependencies
3) vendorsetup.sh
We have to edit this 3 files for building Team-Radium
1) Rename cm.mk to radium.mk
As You can see That WE HAVE JUST REPLACED CM WITH Radium
Now you all must be thinking why did we rename cm.mk to radium.mk
A Simple Answer is we go to the vendor folder and check the name and replace it.
So now you must be wondering about the product name ...as in the above image only the "cm" changes to "Radium" with the same logic of the vendor name
In this case we see that Radium is the vendor ...so we rename the cm.mk to radium.mk
this same rule applies to the content inside the radium.mk too ... we first make sure that the files are available in that location .
2) Now we have to move second file "cm.dependencies"
This file will be simply renamed by Vendor Name ...
In This Case "Radium" ....so we rename it to "radium.dependencies"
3) The Last And The Final Change Required Is In The "vendorsetup.sh"
Open vendorsetup.sh and rename cm as radium and save.
Thats it!! So simple i think
Happy building
Good luck!!! :good:
Last one in case
Will soon add some common bugs and their fixes
If repo sync gives error like cannot overwrite work tree
then
Code:
$ repo sync --force-sync
For those with slow net
You can download highly compressed sources by @regalstreak and some others from here!
Unless its a one time build, i'd recommend getting the one with .repo folder, else you won't be able to easily update the source to the latest version!
Thanks guys like @OwnDroid @westcripp @##W4TCH0UT## @varun.chitre15 @CaptivateKing and many others who have inspired me about Android
Reserved
Anik_khan and akhilnarang ( My Encyclopedia of Development), love u guys. Keep doing awesome work
This is a nice guide... I think most of the people in India do not have high speed internet or continuous electricity for repo sync
This puts limitations on using own PCs for ROM building. I have seen lots of people who are using rented servers for this purpose. These servers are located somewhere in Europe or USA and one can access them (or VMs on them) remotely. These servers have internet speeds in GBs so the repo sync does not take more than 30 minutes...
I've recently started learning about ROM building and I've started with Google Cloud. Google have 2 months free service (so interested guys can start the ROM building right away without thinking about the time required for downloading 15-20 GBs )
@Anik_khan may be you can think of adding this as a tip in the OP...
@akhilnarang thanks for helping me and be ready... I'll be coming with lots of questions
Great work guys.
This will help a lot of newbies.
Add use of build scripts maybe.
P.S : Sometime I forget actual commands because of too much use of build scripts
corphish said:
Add use of build scripts maybe.
P.S : Sometime I forget actual commands because of too much use of build scripts
Click to expand...
Click to collapse
I was planning too, the guide is gonna be improved over the next few days
Sent from my A0001 using Tapatalk
a small correction in installing java procedure, you need jdk 7 to build lollipop, you mentioned as jdk7 and higher but you can't build with jdk8. awesome guide so far, regards from me.
Sent from my XT1033 using Tapatalk
Great Post , Thanks my two most favorite Brother .
I am searching for this awesome post , and you give the way with a easy way .
Awesome written . Really easily to understand.
Thanks man thanks
Thanks guys..finally got a 'noob friendly guide'..
Sent from my HM 1SW using XDA Free mobile app
OMG!! It's awesome and damn noob friendly!! It's the best guide I have ever seen!!
Thanks to you @Anik_khan & @akhilnarang
Keep your awesome work guys!!
Anik_khan said:
There are 3 files in CM Tree Which Should Be Modified.
They are,
1) cm.mk
2) cm.dependencies
3) vendorsetup.sh
Click to expand...
Click to collapse
Just add this point as a note :-
Some ROMs extensively need device dependencies in their vendor source, be sure that u add it before building (if necessary)
Sent from my A0001 using Tapatalk
Its really a nice guide, but i need your help as am stuck on how to add a device to aosp/CM source, whenever i tried to add a device, I follows all instructions but it always give me an error
Which would you like? [aosp_arm-eng] 7
build/core/product_config.mk:222: *** Can not locate config makefile for product "ha_i9500". Stop.
** Don't have a product spec for: 'ha_i9500'
** Do you have the right repo manifest?
Frostyagent said:
Its really a nice guide, but i need your help as am stuck on how to add a device to aosp/CM source, whenever i tried to add a device, I follows all instructions but it always give me an error
Which would you like? [aosp_arm-eng] 7
build/core/product_config.mk:222: *** Can not locate config makefile for product "ha_i9500". Stop.
** Don't have a product spec for: 'ha_i9500'
** Do you have the right repo manifest?
Click to expand...
Click to collapse
Rename cm.mk to ha_i9500.mk
Sent from my A0001 using Tapatalk
ujwal.p said:
Rename cm.mk to ha_i9500.mk
I have done it but still no luck and error continues to display, I want to know what am i doing wrong, I was trying all the night but bad luck
Click to expand...
Click to collapse

Need Help manifest.xml

hello
I have a problem with the creation of the manifest file for Sailfish os
in the documentation of sailfish os is that one should make it so :
You’ll have to create the local manifest yourself, which contains at least two repos: one for the kernel,
another for the device configuration. Find those CM device wiki, for Nexus 5 it would be http://wiki.
cyanogenmod.org/w/Hammerhead_Info inside the Source code table. Local manifest below will also
need pointing to correct branches - identify which one matches the default manifest branch.
Add the following content to $ANDROID_ROOT/.repo/local_manifests/$DEVICE.xml:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/lge/hammerhead"
name="CyanogenMod/android_device_lge_hammerhead"
revision="stable/cm-11.0" />
<project path="kernel/lge/hammerhead"
name="CyanogenMod/android_kernel_lge_hammerhead"
revision="stable/cm-11.0" />
</manifest>
Time to sync the whole source code, this might take a while:
HABUILD_SDK $
hadk
repo sync --fetch-submodules
that is my manifest named kenzo_mm.xml :
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/xiaomi/kenzo"
name="CyanogenMod/android_device_xiaomi_kenzo"
revision="cm-13.0" />
<project path="kernel/xiaomi/msm8956"
name="CyanogenMod/android_kernel_xiaomi_msm8956"
revision="cm-13.0" />
</manifest>
as described is the file in the folder
/home/xxxxxxxx/ANDROID_ROOT/.repo/local_manifests/kenzo_mm.xml
when i try repo init or sync I get error message :
[Error02] repo-about-git-head-error-manifest-missing-or-unreadable-please-run-init
thanx 4 Help
greetz
I helped myself , I thank you for helping all who helped me
noobstyle1337 said:
I helped myself , I thank you for helping all who helped me
Click to expand...
Click to collapse
Hey man, I have the same issue, what's the fix?
Benjimaestro said:
Hey man, I have the same issue, what's the fix?
Click to expand...
Click to collapse
I have the manifest file pushed into the .repo folder and could then sync
but now I have the next problem I if
wants breakfast kenzo do then I have another error with the manifest file
I have also downloaded to github all things kenzo per zip download and pulled in $ home / android folder and could then run extract-file.sh what not hasnt
I bite me through
somehow it seems to be so easy in the tutorial but the capabilities are not steps you have to tinker immediately until it works .
totally frustrating for me
all manifests are bull**** I start again
have again and start to point 5.4 everything works repo init has also but when I breakfast kenzo enter I get this error
including vendor/cm/vendorsetup.sh
device/xiaomi/kenzo/BoardConfig.mk:185: device/qcom/sepolicy/sepolicy.mk: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
make: *** No rule to make target 'device/qcom/sepolicy/sepolicy.mk'. Stop.
Device kenzo not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Found repository: android_device_xiaomi_kenzo
Default revision: stable/cm-13.0-ZNH0E
Checking branch info
Default revision stable/cm-13.0-ZNH0E not found in android_device_xiaomi_kenzo. Bailing.
Branches found:
cm-13.0
stable/cm-13.0-ZNH5Y
Use the ROOMSERVICE_BRANCHES environment variable to specify a list of fallback branches.
device/xiaomi/kenzo/BoardConfig.mk:185: device/qcom/sepolicy/sepolicy.mk: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
make: *** No rule to make target 'device/qcom/sepolicy/sepolicy.mk'. Stop.
** Don't have a product spec for: 'cm_kenzo'
** Do you have the right repo manifest?
did you set the path to the ndk/sdk
export NDK=<path>/android-ndk
export ANDROID_NDK=<path>/android-ndk
export ANDROID_HOME=<path.d/android-sdk-linux
might not be 100% correct since it's been awhile since I compiled anything for android
noobstyle1337 said:
have again and start to point 5.4 everything works repo init has also but when I breakfast kenzo enter I get this error
including vendor/cm/vendorsetup.sh
device/xiaomi/kenzo/BoardConfig.mk:185: device/qcom/sepolicy/sepolicy.mk: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
make: *** No rule to make target 'device/qcom/sepolicy/sepolicy.mk'. Stop.
Device kenzo not found. Attempting to retrieve device repository from CyanogenMod Github
Found repository: android_device_xiaomi_kenzo
Default revision: stable/cm-13.0-ZNH0E
Checking branch info
Default revision stable/cm-13.0-ZNH0E not found in android_device_xiaomi_kenzo. Bailing.
Branches found:
cm-13.0
stable/cm-13.0-ZNH5Y
Use the ROOMSERVICE_BRANCHES environment variable to specify a list of fallback branches.
device/xiaomi/kenzo/BoardConfig.mk:185: device/qcom/sepolicy/sepolicy.mk: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
make: *** No rule to make target 'device/qcom/sepolicy/sepolicy.mk'. Stop.
** Don't have a product spec for: 'cm_kenzo'
** Do you have the right repo manifest?
Click to expand...
Click to collapse
Hi, i've got the same error trying to breakfast the device. Did you find a way to fix this error ? Thanks you a lot !
I have fixed the problem . it was the roomservice.xml . manifest file . which is really huge and there is much to write
I also have the mount points fixed but the problem is the build that he believed break CM13 is supported not right i think
unfortunately I have no internet in the Moment, I change to o2 I germany 'm working on it maybe I find the error during build if I may give you the tip a look here in redmi note 3 forum to the manifest file which is to build ads of nougat . which helped a lot you need you can take the frameworks , security almost everything . you have to test it unfortunately if I have internet again I can even upload my manifest file
noobstyle1337 said:
unfortunately I have no internet in the Moment, I change to o2 I germany 'm working on it maybe I find the error during build if I may give you the tip a look here in redmi note 3 forum to the manifest file which is to build ads of nougat . which helped a lot you need you can take the frameworks , security almost everything . you have to test it unfortunately if I have internet again I can even upload my manifest file
Click to expand...
Click to collapse
Thank you a lot. I will try giving a look to nougat manifest waiting for your manifest.
View attachment roomservice.xml.tar.gz
here is the manifest file
repo init -u git://github.com/mer-hybris/android.git -b hybris-13.0
but I do not know if you also hybris repos add intended or whether to remain in the default xml so but it will run first
otyg said:
did you set the path to the ndk/sdk
export NDK=<path>/android-ndk
export ANDROID_NDK=<path>/android-ndk
export ANDROID_HOME=<path.d/android-sdk-linux
might not be 100% correct since it's been awhile since I compiled anything for android
Click to expand...
Click to collapse
I had the paths not set thanks
noobstyle1337 said:
View attachment 3880405
here is the manifest file
repo init -u git://github.com/mer-hybris/android.git -b hybris-13.0
but I do not know if you also hybris repos add intended or whether to remain in the default xml so but it will run first
Click to expand...
Click to collapse
Hi ! Did you managed to run without errors the breakfast command with your manifest ? I tried it, but unfortunately I got always the same error.
Thank you in advance
it runs without error one should manifest the add before the repo sync
** Don't have a product spec for: 'cm_kenzo'
noobstyle1337 said:
have again and start to point 5.4 everything works repo init has also but when I breakfast kenzo enter I get this error
including vendor/cm/vendorsetup.sh
device/xiaomi/kenzo/BoardConfig.mk:185: device/qcom/sepolicy/sepolicy.mk: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
make: *** No rule to make target 'device/qcom/sepolicy/sepolicy.mk'. Stop.
Device kenzo not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Found repository: android_device_xiaomi_kenzo
Default revision: stable/cm-13.0-ZNH0E
Checking branch info
Default revision stable/cm-13.0-ZNH0E not found in android_device_xiaomi_kenzo. Bailing.
Branches found:
cm-13.0
stable/cm-13.0-ZNH5Y
Use the ROOMSERVICE_BRANCHES environment variable to specify a list of fallback branches.
device/xiaomi/kenzo/BoardConfig.mk:185: device/qcom/sepolicy/sepolicy.mk: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
/bin/bash: prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: No such file or directory
make: *** No rule to make target 'device/qcom/sepolicy/sepolicy.mk'. Stop.
** Don't have a product spec for: 'cm_kenzo'
** Do you have the right repo manifest?
Click to expand...
Click to collapse
just saying...if thats the prob the solution is inside decive source,rename the "cm.mk" to "cm_kenzo.mk"...i had this prob lately and i solved it in that way :good:

[7.1.2] Building android didn't generated image for my target product

I'm trying to generate my first rom from AOSP. Yesterday I finally managed to actually build it with no errors. I followed this tutorial and the oficial from source.android.com. The problem is that it didn't generated the zip file in the directory out/target/product/*CODENAME*. I Followed these steps:
- set up the build environment
- Got the AOSP source:
repo init -u https://android.googlesource.com/platform/manifest
repo sync
Click to expand...
Click to collapse
- Got the device tree and kernel for my device:
git clone https://github.com/CyanogenMod/android_device_motorola_falcon -b cm-14.1 device/motorola/falcon
git clone https://github.com/CyanogenMod/android_kernel_motorola_msm8226 -b cm-14.1 kernel/motorola/msm8226
Click to expand...
Click to collapse
(of course I ran these commands in the root of the working directory of the source)
- Ran the comands to set up for the correct architecture:
. build/envsetup.sh
lunch aosp_arm-eng
Click to expand...
Click to collapse
And build it:
make -j8
Click to expand...
Click to collapse
In the end, I got only the out/target/product/generic folder with system.img file (not zip) and also not the out/target/product/falcon as I was expecting (was my expectation right?). So, anyway, what did I miss in the process? Thanks in advance

Categories

Resources