cherry-picking into rom? - Nexus 4 Q&A, Help & Troubleshooting

hi i am trying to cherry pick this http://review.cyanogenmod.org/#/c/29118/ so i went into frameworks/base and used git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_base refs/changes/18/29118/12 && git cherry-pick FETCH_HEAD
but i get an error about files/commits being merged. does anyone know how to fix this?

It's already merged?
Sent from my Nexus 4 using Tapatalk 2

this is what happens.
[email protected]:~/testrasbean/frameworks/base$ git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_base refs/changes/18/29118/12 && git cherry-pick FETCH_HEAD
From http://review.cyanogenmod.org/CyanogenMod/android_frameworks_base
* branch refs/changes/18/29118/12 -> FETCH_HEAD
error: could not apply 6bbe7b7... Quick Settings: Swipe to switch
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
Recorded preimage for 'packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java'
Recorded preimage for 'packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java'
[email protected]:~/testrasbean/frameworks/base$

this is what i did to fix it but i still have issues:
[email protected]:~/testrasbean/frameworks/base$ git fetch http://review.cyanogenmod.org/CyanogenMod/android_frameworks_base refs/changes/18/29118/12 && git cherry-pick FETCH_HEAD
From http://review.cyanogenmod.org/CyanogenMod/android_frameworks_base
* branch refs/changes/18/29118/12 -> FETCH_HEAD
error: could not apply 6bbe7b7... Quick Settings: Swipe to switch
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
Recorded preimage for 'packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java'
Recorded preimage for 'packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java'
[email protected]:~/testrasbean/frameworks/base$ git status
# Not currently on any branch.
# You are currently cherry-picking.
# (fix conflicts and run "git commit")
#
# Unmerged paths:
# (use "git add <file>..." to mark resolution)
#
# both modified: packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
# both modified: packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
#
no changes added to commit (use "git add" and/or "git commit -a")
[email protected]:~/testrasbean/frameworks/base$ git add packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
[email protected]:~/testrasbean/frameworks/base$ git add packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
[email protected]:~/testrasbean/frameworks/base$ git commit -c 6bbe7b7
[detached HEAD 13e45b8] Quick Settings: Swipe to switch
Author: Thiago Vinícius Freire de Araújo Ribeiro <[email protected]>
2 files changed, 188 insertions(+), 8 deletions(-)
[email protected]:~/testrasbean/frameworks/base$
trying to build...in the middle
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java:2547: class, interface, or enum expected
}
^
734 errors
make: *** [out/target/common/obj/APPS/SystemUI_intermediates/classes-full-debug.jar] Error 41
make: *** Waiting for unfinished jobs....
Preparing output jar [/home/jarman/testrasbean/out/target/common/obj/APPS/Mms_intermediates/proguard.classes.jar]
Copying resources from program jar [/home/jarman/testrasbean/out/target/common/obj/APPS/Mms_intermediates/classes.jar]
DroidDoc took 15 sec. to write docs to out/target/common/docs/api-stubs
[email protected]:~/testrasbean$

Related

[GUIDE] Building CyanogenMod 9 from Source with openSuSE 12.1

Introduction
If you have tried to build Android on systems other than Ubuntu (or Ubuntu based systems) you may have noticed, that there are pretty much no guides for other systems.
I finally set up my openSuSE to build CM9 successfully, and would like to share the process with you.
I will also try to adopt this guide for CM10 if i find the time.
If you find mistakes feel free to post them here or PM me.
Contents
Requirements
About this guide
Install "Oracle JDK"
Install other needed packages
Install "make 3.81"
Install "Android SDK"
Set up source directories
Set up "repo"
Set up repositories
Update source code
Update device specific source code
Copy proprietary files
Download prebuilts
Build CyanogenMod 9
Done!
Possible build errors on openSuSE
Credits
1. Requirements
openSuSE 12.1 64bit (may work on other versions too)
a good internet connection
as much RAM as possible (at least 2GB to finish a build, but that will take very, very long.)
patience
common sense
Note: I did all this in a virtual machine, but i highly recommend installing Linux on your hardware. Building Android takes a long time even on high end hardware.
2. About this guide
Lines beginning with '$' are supposed to be entered in shell (without the $ sign).
File names are bold.
This guide assumes that you set up the sources at ~/android/system/. Feel free to change that.
bacon = device name (e.g. i9300 for Samsung Galaxy SIII I9300. See CyanogenMod Homepage for other devices.)
3. Install "Oracle JDK"
Download latest jdk-6uXX-linux-x64-rpm.bin from http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html
$ <downloadfolder>/jdk-6uXX-linux-x64-rpm.bin -x
Open <downloadfolder> in your file manager
Right click jdk-6uXX-linux-x64-rpm -> open with -> Install Software
YaST Software Manager will open up.
DON'T click accept yet.
Search for openJDK and check uninstall for ALL openJDK packages.
DON'T click accept yet, go to next chapter.
4. Install other needed packages
Search and install following packages with YaST
git
gnupg
flex
bison
gperf
SDL-devel
esound-devel
wxGTK-devel
zip
curl
ncurses-devel
ncurses-devel 32bit
zlib-devel
zlib-devel 32bit
gcc-c++
glibc-devel 32bit
libstdc++ 32bit
mesa libs
Now click accept.
5. Install "make 3.81"
Note: Other versions won't work.
Download source from http://ftp.gnu.org/gnu/make/make-3.81.tar.gz.
Extract downloaded file.
$ cd <extracted folder>
$ ./configure
$ make
$ make install
6. Install "Android SDK"
Note: This is pretty straightforward. I will add this section later.
7. Set up source directories
$ mkdir ~/android
$ mkdir ~/android/system
$ mkdir ~/android/cache
8. Set up "repo"
Note: "repo" is a tool by Google, created to make access to git and gerrit very, very easy.
$ mkdir ~/bin
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Open ~/.bashrc in a file editor (e.g. kwrite)
Add the following line:
PATH=~/bin:$PATH
Save and close.
Close your shell and re-open it.
9. Set up repositories
$ cd ~/android/system
$ repo init -u git://github.com/CyanogenMod/android.git -b ics
10. Update source code
$ cd ~/android/system
$ repo sync -jX
X = number of connections. Try X = 1 if there are problems downloading.
This will take a while.
11. Update device specific source code
$ cd ~/android/system
$ . build/envsetup.sh && breakfast bacon
12. Copy proprietary files
Note: This only needs to be run once. You will need CyanogenMod 9 running on the device you are building for to complete this.
Connect the phone via USB.
Install USB drivers to get ADB access.
$ cd ~/android/system/device/<manufacturer>/<devicename>
$ ./extract-files.sh
13. Download prebuilts
$ ~/android/system/vendor/cm/get-prebuilts
14. Build CyanogenMod 9
$ ~/android/system
$ . build/envsetup.sh && brunch bacon
15. Done!
You now should have a CWM-flashable .zip file ~/android/system/out/target/product/maguro/cm-9-XXXXX-UNOFFICIAL-bacon.zip.
16. Possible build errors on openSuSE
Because Ubuntu is based on Debian and openSuSE is based on Slackware, you will probable get some build errors. In post 2 is a list of errors that can occur and how to fix them.
Credits
CyanogenMod Team
CyanogenMod Wiki
The Software Rouge (http://thesoftwarerogue.blogspot.de/2011/11/building-android-ics-ice-cream-sandwich.html)
Note: I got the fixes for build errors from some page in Google Groups. I can't find it anymore. If someone finds it, please PM me.
Possible build errors on openSuSE
Note: I used kwrite as text editor. To use another, just change kwrite to whatever editor you want to use.
Note: Open shell and got to ~/android/system
Error 1
make gets killed at some point
Fix: you need more RAM to finish the build.
Error 2
Code:
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptDir> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1
Fix:
$ kwrite frameworks/base/tools/aapt/Android.mk
Add '-fpermissive' to line 31:
LOCAL_CFLAGS += -Wno-format-y2k -fpermissive
Error 3
Code:
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::wp<android::AssetManager::SharedZip> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/AssetManager.o] Error 1
Fix:
$ kwrite frameworks/base/libs/utils/Android.mk
Add '-fpermissive' to line 64:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
Error 4
Code:
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:11: note: use ‘this->SetState’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] Error 1
Fix:
$ cd external/srec
$ wget "https://github.com/CyanogenMod/android_external_srec/commit/4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff"
$ patch -p1 < 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
$ rm -f 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
$ cd ../..
Error 5
Code:
development/tools/emulator/opengl/host/tools/emugen/main.cpp:79:9: error: ‘optind’ was not declared in this scope
development/tools/emulator/opengl/host/tools/emugen/main.cpp:92:45: error: ‘optind’ was not declared in this scope
make: *** [out/host/linux-x86/obj/EXECUTABLES/emugen_intermediates/main.o] Error 1
Fix:
$ kwrite development/tools/emulator/opengl/host/tools/emugen/main.cpp
Add '#include <getopt.h>' to list of includes:
#include <getopt.h>
Error 6
Code:
host C++: liboprofile_pp <= external/oprofile/libpp/arrange_profiles.cpp
In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1
Fix:
$ kwrite external/oprofile/libpp/format_output.h
Remove 'mutable' from 'mutable counts_t & counts;' on line 94:
counts_t & counts;
Error 7
Code:
development/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp:345:65: required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<unsigned int, ShaderData*>’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libOpenglCodecCommon_intermediates/GLSharedGroup.o] Error 1
Fix:
$ kwrite development/tools/emulator/opengl/Android.mk
Add '-fpermissive' to line 25:
EMUGL_COMMON_CFLAGS := -DWITH_GLES2 -fpermissive
Error 8
Code:
/usr/bin/ld: note: 'XInitThreads' is defined in DSO /lib/libX11.so.6 so try adding it to the linker command line
/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer] Error 1
Fix:
$ kwrite development/tools/emulator/opengl/host/renderer/Android.mk
Add new entry 'LOCAL_LDLIBS += -lX11' after line 6 as shown:
LOCAL_SRC_FILES := main.cpp
LOCAL_CFLAGS += -O0 -g
LOCAL_LDLIBS += -lX11
#ifeq ($(HOST_OS),windows)
#LOCAL_LDLIBS += -lws2_32
Error 9
Code:
external/llvm/include/llvm/ADT/PointerUnion.h:56:10: error: enumeral mismatch in conditional expression: ‘llvm::PointerLikeTypeTraits<llvm::PointerUnion<clang::Stmt*, const clang::Type*> >::<anonymous enum>’ vs ‘llvm::PointerLikeTypeTraits<clang::eek:bjCInterfaceDecl*>::<anonymous enum>’ [-Werror]
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs.o] Error 1
Fix:
$ kwrite frameworks/compile/slang/Android.mk
Remove '-Werror' from line 22:
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
Error 10
Code:
frameworks/base/libs/rs/rsFont.cpp:224:76: required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<unsigned int, android::renderscript::Font::CachedGlyphInfo*>’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libRS_intermediates/rsFont.o] Error 1
Fix:
$ kwrite frameworks/base/libs/rs/Android.mk
Add '-fpermissive' to line 183:
LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable -fpermissive
Error 11
Code:
external/mesa3d/src/glsl/linker.cpp:1394:49: error: expected primary-expression before ‘,’ token
......
external/mesa3d/src/glsl/linker.cpp:1734:59: error: ‘offsetof’ was not declared in this scope
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1
Fix:
$ kwrite external/mesa3d/src/glsl/linker.cpp
Add '#include <stddef.h>' to list of includes as shown:
#include <climits>
#include <stddef.h>
#include <pixelflinger2/pixelflinger2_interface.h>
Error 12
Code:
external/gtest/src/../include/gtest/gtest-param-test.h:287:58: note: ‘template<class Container> testing::internal::ParamGenerator<typename Container::value_type> testing::ValuesIn(const Container&)’ declared here, later in the translation unit
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o] Error 1
Fix 1:
$ kwrite external/gtest/src/Android.mk
Add '-fpermissive' to lines 52 and 70 (both lines contain same info)
LOCAL_CFLAGS += -O0 -fpermissive
Fix 2:
$ kwrite external/gtest/include/gtest/internal/gtest-param-util.h
Add '#include <stddef.h>' to list of includes as shown:
#include <vector>
#include <stddef.h>
#include <gtest/internal/gtest-port.h>
Error 13
Code:
frameworks/compile/slang/slang_rs_export_foreach.cpp: In static member function ‘static slang::RSExportForEach* slang::RSExportForEach::Create(slang::RSContext*, const clang::FunctionDecl*)’:
frameworks/compile/slang/slang_rs_export_foreach.cpp:249:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1
Fix:
$ kwrite kwrite frameworks/compile/slang/Android.mk
change
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
to
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
reserved #2
Wish somebody would build for the LG optimistic logic
Sent from my LGL35G using xda premium

[Q] Compiling CM for my d802

Hi all,
I'm trying to build CyanogenMod for intl G2 (the only change I've made is to add halo)
for the repo init I've done:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0 -g all,-notdefault,d802,lge
And then repo sync -j8
After that, like I've said, I've added halo.
And now I'm trying to build by doing:
Code:
$ source build/envsetup.sh
$ breakfast d802
but the only things I get is:
Code:
[email protected]:~/CM/G2# breakfast d802
including vendor/cm/vendorsetup.sh
build/core/product_config.mk:238: *** _nic.PRODUCTS.[[device/lge/d802/cm.mk]]: "device/lge/g2-common/g2.mk" does not exist. Arrêt.
Device d802 not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Traceback (most recent call last):
File "build/tools/roomservice.py", line 76, in <module>
result = json.loads(urllib.request.urlopen(githubreq).read().decode())
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 448, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
build/core/product_config.mk:238: *** _nic.PRODUCTS.[[device/lge/d802/cm.mk]]: "device/lge/g2-common/g2.mk" does not exist. Arrêt.
** Don't have a product spec for: 'cm_d802'
** Do you have the right repo manifest?
I don't understand because when I take a look to device, there is no lge/d802 directory. By doing the init command, I would have to download specific files
also lunch and breakfast command gave me the same error...
Do you have an idea where I'm wrong and what can I do ? I think I've to download device specific files but how can I do this (if this is the error), normally before building, the files are downloaded ? I don't see...
Thanks in advance !
Up, if someone can help me :fingers-crossed:
I have the same problem, someone can help?

[Guide] Build MoKee Rom 7.1.2 For Samsung T700/T705/T800/T805

How To Build MoKee Rom For Exynos5420 Device (7.1.2)​Support Device :
HTML:
klimtwifi # Samsung T700
klimtlte # Samsung T705
chagallwifi # Samsung T800
chagalllte # Samsung T805
chagallltetmo # Samsung T807T
ha3g # Samsung Note3 (N900)
Step 1: Setting Up A Compile Environment
You must have a 64-bit environment.
A Linux computer should have 8 GB RAM or more, otherwise build errors may occur.
Ubuntu 16.04
These instructions should work for other version of Ubuntu and most other Debian-based systems.
Install build packages
Open a terminal (ctrl + alt + t). First install the necessary packages; copy paste the code below and hit enter.
HTML:
sudo apt-get update
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven bc pngquant imagemagick yasm libssl-dev
sudo apt-get install openjdk-8-jdk
HTML:
mkdir -p ~/bin
mkdir -p ~/mokee
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Add bin to PATH
HTML:
echo "export PATH=~/bin:$PATH" >> ~/.bashrc
Configure git:
HTML:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Move to build directory and sync the source code:
HTML:
cd ~/mokee
repo init -u https://github.com/Cyborg2017/android_mokee.git -b mokee-7.1.2
repo sync -j8 -f --no-clone-bundle
Let's configure ccache too. It will reduce the build time to 40% after first build
HTML:
echo "export USE_CCACHE=1" >> ~/.bashrc
~/mokee/prebuilts/misc/linux-x86/ccache/ccache -M 25G
25G means it will use upto 25 gb of disk space for ccaching. Atleast 10 gb is recommended. But if you want to compile for more devices, use more space for ccache.
Step 2: Compiling For Your Device
# MoKee Rom For Samsung Exynos5420 Chips Device
============================================================
To initialize your local repository using the MoKee trees, use a command like this:
HTML:
repo init -u https://github.com/Cyborg2017/android_mokee.git -b mokee-7.1.2
Then to sync up:
HTML:
repo sync
Start Work
-------------------------------------------------------------
To work faster, we introduced a new build script to help you start compiling.
First, go to the root path of your project. We assume that your source is under
(/mokee):
HTML:
cd /mokee
then feel free to use the build script:
HTML:
. build/envsetup.sh
lunch mk_klimtwifi # T700
lunch mk_klimtlte # T705
lunch mk_chagallwifi # T800
lunch mk_chagalllte # T805
lunch mk_chagallltetmo # T807T
lunch mk_ha3g # N900
mka bacon -j8
The script is interactive so everything else is self-explanatory.
Source:
https://github.com/Cyborg2017/android_mokee
https://github.com/Cyborg2017/android_device_samsung_exynos5420-common
https://github.com/Cyborg2017/android_device_samsung_chagalllte
https://github.com/Cyborg2017/android_device_samsung_chagallwifi
https://github.com/Cyborg2017/android_device_samsung_klimtlte
https://github.com/Cyborg2017/android_device_samsung_klimtwifi
https://github.com/Cyborg2017/android_device_samsung_chagallltetmo
https://github.com/Cyborg2017/android_device_samsung_ha3g
https://github.com/Cyborg2017/android_kernel_samsung_exynos5420
Thanks:
MoKee Rom Team: https://github.com/MoKee
Exynos5420 Team: https://github.com/exynos5420
LineageOs Team: https://github.com/LineageOS

[ROM] [Development] [Source] [Noob] [Friendly]

Introduction & Setting Up Build Environment​
Well hello everyone today I will teach you “How to build custom ROM’s for your device from source”. So, if you are interested then please continue to read. So, first of all, you must know how Linux work and few commands for that you can simply visit here
I guess you are done with commands now let's move ahead. First and for most important… You must have a high specs PC like with i7, 16gb ram, 512gb SSD. If yes then move ahead if no then look for online cloud services like GCloud/AWS.
Setting Up Environment for the build!
Woo-ho! We will set up the environment for the build now …
Now install Linux in your PC. You can install any distro but I would suggest installing Ubuntu 16.04.
Just copy paste below codes and if asked for y/n then type y and hit enter, all set!
Code:
sudo apt-get update && sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip openjdk-8-jdk openjdk-11-jdk && sudo apt-get upgrade
Code:
git clone https://github.com/akhilnarang/scripts.git ~/scripts
cd scripts
bash setup/android_build_env.sh
All set! As mentioned earlier allow the packages to be installed by typing “y” if asked.
Syncing Sources ​
Now look for your favorite ROM sources like for me its lineage so source are here
After you are done with your sources just clone the source but before that let's make a directory where we will store our source like for me I am using android/lineage for your ROM you can change as per your wish! Well if you still didn’t get your ROM sources then I will drop down link below of my top 5 favorite ROM sources!
Now let's make our directory
Code:
mkdir android/lineage && cd android/lineage
Now let’s initialize our ROM repo like for me its lineage, but for you change it as per your ROM. Here for your info after “-b” is your branch you will have to look for your ROM and change accordingly.
Code:
repo init -u git://github.com/LineageOS/android.git -b lineage-16.0
Well, now you will encounter a small error to fix it up just copy below code.
Code:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Replace [email protected] & “Your Name with your GitHub account email and username respectively. After that re-initize source.
Wow, it’s for Pie hehehe but it’s not yet done. We have just initialized source we are yet let to sync it. but before that please note source size is about 60-80gb so make sure you have enough bandwidth with high speed …
Now let’s sync our source
Code:
repo sync -f –-no-tags –-no-clone-bundle
Well, now you can do only one thing that is wait ... as repo is long (60g-80gb)
Done? Then why to wait just start with syncing device related sources.
Now you must be wondering what are they and why we need those… So, device related sources are of the device tree, kernel source, vendor blobs. You can find those by searching your device codename like for me I will search k5fpr device tree, k5fpr kernel source, k5fpr vendor tree (Here k5fpr is my device codename you change as per your device.) Now I got these links
DT : https://github.com/SahilSonar/android_device_lenovo_k5fpr
Kernel Source : https://github.com/SahilSonar/android_kernel_lenovo_k5fpr
Vendor Blobs/Tree : https://github.com/SahilSonar/android_vendor_lenovo_k5fpr
Well, now you don’t use these until and unless you want to build for k5fpr. You look for your device and now let’s clone them to our working dir. Again as dir. may change please edit the code as per your ROM
Code:
git clone https://github.com/SahilSonar/android_device_lenovo_k5fpr.git -b lineage-15.1 ~/android/lineage/device /lenovo/k5fpr
git clone https://github.com/SahilSonar/android_kernel _lenovo_k5fpr.git -b lineage-15.1 ~/android/lineage/kernel /lenovo/k5fpr
git clone https://github.com/SahilSonar/android_vendor _lenovo_k5fpr.git -b lineage-15.1 ~/android/lineage/vendor /lenovo/k5fpr
Now after -b is our branch just look one there in your source, which one you want to use just change it now most of the people must have thought hey man there is another way for this … We can use manifest… yes, those are 100000% but cloning is an easy way instead of manifest but still for those who want to clone using manifest then simply follow below steps instead of above … No issue you can use anyone.
First, let’s move to the dir where we are supposed to add manifest like for me its android/lineage/.repo You will have to change as per your dir.
Code:
cd android/lineage/.repo && mkdir local_manifests && cd local_manifests && nano roomservice.xml
After pasting above code you will see a text editor in that we are supposed to paste our manifest okay I am giving manifest of k5fpr you change source as per your device.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/lenovo/k5fpr" name="mohancm/android_device_lenovo_A7010a48" remote="github" revision="oreo" />
<project path="vendor/lenovo/k5fpr" name="mohancm/android_vendor_lenovo_k5fpr" remote="github" revision="oreo" />
<project path="kernel/lenovo/k5fpr" name="mohancm/android_kernel_lenovo_A7010a48" remote="github" revision="oreo" />
</manifest>
Okay, so you must be wondering what to do for my device… Well don’t worry as we have used -b here its revision so after revision what comes is our branch and after “name” it's our source link and after “path” it's our destination like we have used ~/android/lineage/device/lenovo/k5fpr. That’s all for manifest just save it and exit after that just sync sources again … Whoa man, I don’t have 60-80gb left. Well, don’t worry its just loads the repo which is downloaded also it only fetches device specific sources.
Code:
repo sync -f –-no-tags –-no-clone-bundle
Patches & Bring-up!​
Now let it finish syncing and after that, we will apply patches. Yes! Patches now most of you must be thinking what are those? Well, patches are nothing more than fixes they are located in your device tree(android/lineage/device/lenovo/k5fpr/patches) Now look there and see which patches you want to apply. If you are confused which to apply then simply apply all. Whoa man, we are new and no idea how to apply those. Well I know don’t worry I will teach you same now.
First of all copy patches from device tree to our source like for e.g I will show you how to apply bionic_libc.patch.
Code:
cp ~/android/lineage/device/lenovo/k5fpr/patches/bionic/bionic_libc.patch ~/android/lineage/bionic
Now what comes after bionic_libc.patch is our destination where we are copying our patch. For your info “cp” is nothing then copy. Now just apply it by using below codes.
Code:
cd android/lineage
git add .
git commit -m “Patch”
Now you are done with applyin bionic_libc. patch but there are many other patches left do same with those just change their dir location like we choose/bionic/bionic_lib.patch same way for other patches just changes as accordingly.
Now after you are done applying all patches lets build our ROM … Oh! Yea finally.
Well not yet before that will learn a new thing called as “bing-up” well not device is universal for every ROM but there are some changes needed to be done before you build for any ROM like for me my device tree is already on lineage but if in case I want to build aosp or rr or any other ROM I will have to do certain changes in device tree for that particular ROM. Like here we will choose AOSP.
Now move to device tree like here in my case
Code:
cd ~/android/lineage/device/lenovo/k5fpr
Now following things will require changes :
*AndroidProducts.mk
*lineage.mk (Now pretty tricky this file name is lineage if your source is for dot just consider then its dot .mk)
*vendorsetup.sh
Just these 3 needed few changes now pay careful attention or else you won't get what I am saying. Now here we are doing bring-up for aosp from lineage so first and for most, we will start with AndroidProducts.mk so I am showing before bring-up and after bring-up (These changes are done using notepad like nano AndroidProducts.mk)
Before
Code:
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/lineage.mk
After
Code:
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/aosp_k5fpr.mk
Now if you can see then we have changed lineage.mk to aosp_k5fpr.mk… yes for newer oses like pie we will have to include device code name as we did so here you are supposed to change lineage to aosp_k5fpr. Well, now we will talk about lineage.mk itself as we have changed it to aosp_k5fpr there then let's change the name of the file itself for that save the change and exit notepad and copy below code to rename it.
Code:
mv lineage.mk aosp_k5fpr.mk
Here you can observe we have typed lineage.mk at first so it means we want to change this file name and to what after space we typed aosp_k5fpr.mk. This means you will have to change it as per your current makefile and to which you want. Now open aosp_k5fpr.mk by using nano aosp_k5fpr.mk
Before
Code:
#
# Copyright (C) 2015-2016 The CyanogenMod Project
# Copyright 2017-2018 The LineageOS Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Inherit some common lineage stuff.
$(call inherit-product, vendor/lineage/config/common_full_phone.mk)
# Inherit device configuration
$(call inherit-product, $(LOCAL_PATH)/device_k5fpr.mk)
# Device display
TARGET_SCREEN_HEIGHT := 1920
TARGET_SCREEN_WIDTH := 1080
# Device identifier
PRODUCT_BRAND := lenovo
PRODUCT_DEVICE := k5fpr
PRODUCT_MANUFACTURER := LENOVO
PRODUCT_MODEL := Lenovo K4 Note
PRODUCT_NAME := lineage_k5fpr
PRODUCT_RELEASE_NAME := k5fpr
PRODUCT_RESTRICT_VENDOR_FILES := false
After
Code:
#
# Copyright (C) 2015-2016 The CyanogenMod Project
# Copyright 2017-2018 The LineageOS Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Inherit device configuration
$(call inherit-product, $(LOCAL_PATH)/device_k5fpr.mk)
# Device display
TARGET_SCREEN_HEIGHT := 1920
TARGET_SCREEN_WIDTH := 1080
# Device identifier
PRODUCT_BRAND := lenovo
PRODUCT_DEVICE := k5fpr
PRODUCT_MANUFACTURER := LENOVO
PRODUCT_MODEL := Lenovo K4 Note
PRODUCT_NAME := aosp_k5fpr
PRODUCT_RELEASE_NAME := k5fpr
PRODUCT_RESTRICT_VENDOR_FILES := false
Now if you observe we removed a line “
# Inherit some common lineage stuff.
$(call inherit-product, vendor/lineage/config/common_full_phone.mk)
“ Well in aosp there is no common_full_phone.mk so we removed entire but for most of the ROM’s its common.mk So make sure you check that out. Also, path will be changed like vendor/dot/config/common.mk for dot but for aosp there is nothing so we removed. Now also we did a change to PRODUCT_NAME : aosp_k5fpr from lineage_k5fpr.mk Well that all changes needed just save it and move to last but not the least vendorsetup.sh. Just open it by nano vendorsetup.sh
Before
Code:
add_lunch_combo lineage_k5fpr-eng
add_lunch_combo lineage_k5fpr-userdebug
add_lunch_combo lineage_k5fpr-user
After
Code:
add_lunch_combo aosp_k5fpr-eng
add_lunch_combo aosp_k5fpr-userdebug
add_lunch_combo aosp_k5fpr-user
This was a simple change just aosp from the lineage that all save it and let's start building now … Wait we did bring-up just for teaching you how exactly it works but doesn’t use aosp bring-up for lineage. Also if you still see some error cannot locate makefile for your device then try changing aosp_k5fpr.mk to aosp.mk and also in AndroidProducts.mk If still not then see for common.mk file or can seek your maintainer who has made trees.
Building ROM & Basic Info regarding errors!​
Now let's start the build
Code:
. build/envsetup.sh
export USE_CCACHE=1
export LC_ALL=C
brunch aosp_k5fpr-userdebug
Now we used userdebug but I would suggest eng as debugging is on by default so as to pull logs in case ROM doesn’t boot and wont to know what went wrong. For your info “export LC_ALL=C” Enables local time as it fixes up an error which new kernel causes due to improper time. “export USE_CCACHE=1” Enables cache, now cache speed up build. If you want to know more about lunch, brunch, mka and make just read this
Now building takes a long time as of me it took ~ 5hrs but I am sure it takes around ~6 hrs.
Also some basics… Now you will see many things in screen just ignore those as you may see “warning’s” well those are normal and will see those don’t worry about those but if you see something like “error” or “failed” That means something is wrong with certain file just ask Android ROM Development Group (Telegram)about the error as I cannot help with device-related errors. Also, these errors are due to device tree issues most of the cases as your maintainer has not maintained tree properly or due to some changes required for bring-up! Additionally, your device tree may also contain build manual just have a look at it
You forgot to add build guide for Snapdragon as you said MTK and Snapdragon are different.
Good guide btw.
SkaboXD said:
You forgot to add build guide for Snapdragon as you said MTK and Snapdragon are different.
Good guide btw.
Click to expand...
Click to collapse
Added !

cannot find dreamlte in lunch menu

i cant see any samsung devices in lunch
my device that i want to build for is dreamlte
and i want to build my own ROM based on Havoc (cus it seems stable)
Bash:
$ mkdir HavocOS
$ cd HavocOS
HavocOS$ repo init -u https://github.com/Havoc-OS/android_manifest.git -b eleven
HavocOS$ mkdir .repo/local_manifests
HavocOS$ curl https://raw.githubusercontent.com/diepquynh/local_manifests/lineage-17.1-8895/default.xml > .repo/local_manifests/default.xml
HavocOS$ repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags
HavocOS$ patches/apply_patches patches
Bash:
HavocOS$ . build/envsetup
HavocOS$ add_lunch_combo havoc-dreamlte-userdebug
:14: add_lunch_combo is obsolete. Use COMMON_LUNCH_CHOICES in your AndroidProducts.mk instead.
HavocOS$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_x86-eng
4. aosp_x86_64-eng
5. arm_krait-eng
6. arm_v7_v8-eng
7. armv8-eng
8. armv8_kryo385-eng
9. silvermont-eng
Which would you like? [aosp_arm-eng]
have i done something wrong?
i tried adding
Code:
COMMON_LUNCH_CHOICES := \
lineage_dreamlte-eng \
lineage_dreamlte-user \
lineage_dreamlte-userdebug \
to
Code:
device/samsung/dreamlte/AndroidProducts.mk
but i get
Code:
HavocOS$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_x86-eng
4. aosp_x86_64-eng
5. arm_krait-eng
6. arm_v7_v8-eng
7. armv8-eng
8. armv8_kryo385-eng
9. lineage_dreamlte-eng
10. lineage_dreamlte-user
11. lineage_dreamlte-userdebug
12. silvermont-eng
Which would you like? [aosp_arm-eng] 9
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
vendor/samsung/dreamlte/dreamlte-vendor.mk:20: error: _nic.PRODUCTS.[[device/samsung/dreamlte/lineage_dreamlte.mk]]: "vendor/lineage/config/common_full_phone.mk" does not exist.
13:28:50 dumpvars failed with: exit status 1
Device dreamlte not found. Attempting to retrieve device repository from Havoc-OS Github (http://github.com/Havoc-Devices).
Repository for dreamlte not found in the Havoc-Devices Github repository list. If this is in error, you may need to manually add it to your local_manifests/roomservice.xml.
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
vendor/samsung/dreamlte/dreamlte-vendor.mk:20: error: _nic.PRODUCTS.[[device/samsung/dreamlte/lineage_dreamlte.mk]]: "vendor/lineage/config/common_full_phone.mk" does not exist.
13:28:52 dumpvars failed with: exit status 1
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
vendor/samsung/dreamlte/dreamlte-vendor.mk:20: error: _nic.PRODUCTS.[[device/samsung/dreamlte/lineage_dreamlte.mk]]: "vendor/lineage/config/common_full_phone.mk" does not exist.
13:28:53 dumpvars failed with: exit status 1
** Don't have a product spec for: 'lineage_dreamlte'
** Do you have the right repo manifest?
Code:
HavocOS$ ls vendor
codeaurora gapps havoc nxp qcom samsung support

Categories

Resources