Building AOSP Emulator - General Topics

Though it's not necessary to build AOSP to build AOSP emulator, but I will discuss it here anyway.
Note: From here on we are considering, $HOME/AOSP is our AOSP repo download folder.
Android Build:
-----------------
Everything are already explained in source.andorid clearly except some step. I am going to explain those.
1. Follow this url, "https://source.android.com/setup/build/requirements".
2. Replace branch name of,
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
by going "https://android.googlesource.com/platform/manifest" and select chosen branch. Download may take up to 20 hours or more.
3. If not sure what argument to choose from lunch command, just type lunch and a bunch of options will be shown. Then select the correct one.
4. Replace "make –jN" to the number of threads you have in your PC. For example for a 4 thread processor "make –j4" will be the command.
5. If jack server has any memory issue run following command,
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
./prebuilts/sdk/tools/jack-admin kill-server
./prebuilts/sdk/tools/jack-admin start-server
Remember to replace –Xmx4g accordingly, here 4g means 4GB. Total build may take up to 9hrs.
6. After that, for every incremental build, type source and lunch command then make command for fresh started terminal otherwise only make will do.
Adding Default Application to android Source:
--------------------------------------------------------
1. Create an application in Android Studio.
2. We don’t need any gradle related folders for AOSP build. Take only java, assets and res folder and copy that in a new folder. Then take that folder to "AOSP/packages/apps" folder.
3. Add "Android.mk" file to that folder and add following lines (replace AppName accordingly and if app has assets un-comment line starting with "LOCAL_ASSETS_DIR"),
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := AppName
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, java)
# Include libraries
#LOCAL_JAVA_LIBRARIES := <Java lib dependencies>
LOCAL_STATIC_JAVA_LIBRARIES := android-common
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
#LOCAL_ASSETS_DIR := $(LOCAL_PATH)/assets
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat
include $(BUILD_PACKAGE)
4. Don't use newly introduced layouts, which may create run-time exception (use linear, relative or other old layouts). Also use properly scoped style. For example,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_weight="1"
android:text="Hello World!"
android:textAppearance="@android:style/TextAppearance.Large" />
</LinearLayout>
In andorid studio "android:layout_width" may be written as "layout_width" and "@android:style/TextAppearance.Large" may be written as "TextAppearance.Large". We've to add full scope to every item, as AOSP build doesn't use gradle build system.
5. Add app name to "PRODUCT_PACKAGES" variable of "AOSP/build/target/product/core.mk" and "AOSP/device/generic/armv7-a-neon/mini_common.mk" files.
6. Build app using make appName then use make –jN or make snod.
NOTE: In emulator, settings page might crash. To fix this, go to "AOSP/packages/apps/Settings/src/com/android/settings/wfd/WifiDisplaySettgins.java", replace existing code by code below,
public static boolean isAvailable(Context context) {
return false;
//return context.getSystemService(Context.DISPLAY_SERVICE) != null
// && context.getSystemService(Context.WIFI_P2P_SERVICE) != null;
}
Emulator Build:
------------------
1. Android emulator is build upon QEMU. Branch for QEMU on "https://android.googlesource.com" is named qemu and generic kernel is in goldfish branch. Note that though we can build goldfish kernel using simple make commands, we've used prebuilt kernel for our approach.
2. Emulator source:
git clone https://android.googlesource.com/platform/external/qemu
(note there is another branch named qemu-android, this branch is not used any more so avoid cloning that branch)
Goldfish source:
git clone https://android.googlesource.com/device/generic/goldfish
(not needed to build emulator)
3. Remember we've to use the appropriate branch after repo name for example for emulator we are using latest 2.8 version which is in branch, "emu-2.8-release". So our command will be,
git clone https://android.googlesource.com/platform/external/qemu-android -b emu-2.8-release
or we can switch to that branch after cloning for master.
4. After cloning, copy the whole directory to "$HOME/AOSP/external" folder, rename older to qemu (if we've cloned qemu into our chosen named folder). We need this because qemu build uses "AOSP/external" and "AOSP/prebuilt" folder for its dependencies. By doing this we can avoid copying multiple repos for emulator, as we've already pulled it during AOSP cloning.
5. Run,
./android/configure.sh
./configure
6. We need to clone some other branches to build the emulator. Below branches should be copied to external folder,
git clone https://android.googlesource.com/platform/external/gtest -b emu-2.8-release
git clone https://android.googlesource.com/platform/external/tinyobjloader -b emu-2.8-release
put below branches in prebuilts/android-emulator-build folder,
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/archive -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/common -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/curl -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/mesa -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/mesa-deps -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/protobuf -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/qemu-android-deps -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/qt -b emu-2.8-release
also we may need below branch, (we've to put it in "prebuilts/clang/host/linux-x86" folder)
git clone https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 -b emu-2.8-release
Note: if we look through git path of each branch they are same as AOSP folder structure. So we can get the hint, where to put them
If any ssl problem occures to download repo, run below command,
export GIT_SSL_NO_VERIFY=1
7. Run "make -jN". if any other things are missing we will be shown the message and please clone those items from googlesource and put it in the correct location.
8. If emulator build failed for warning the run this "./configure --disable-werror", then make again.
9. After successful build we will get obs folder. Replace contents of "$home/AOSP/prebuilts/android-emulator/linux-x86_64" by the contents of our built folder.
10. Go back to AOSP root folder, now if we run "emulator" command, our custom built emulator will be used from now on.
11. We can run "emulator -verbose" to see generated commands.
Note: to buid AOSP again, we need to remove qemu, gtest, tinyobjloader from AOSP source, as they interfere with AOSP prebuilt packages. So after buiding emulator remove those folders from AOSP source folder.
Some Commands:
----------------------
This commands may or may not be needed, depending on the status of Ubuntu or source code.
1. Adding qt library in path
export PATH=/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_swiftshader:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle9:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle11:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/libstdc++:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/qt/lib:$PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/qt/plugins
2. Library installation commands
apt-get install build-essential zlib1g-dev pkg-config libglib2.0-dev binutils-dev libboost-all-dev autoconf libtool libssl-dev libpixman-1-dev libpython-dev python-pip python-capstone virtualenv
sudo apt-get install libsdl1.2-dev libsdl1.2debian libsdl-gfx1.2-5 libsdl-gfx1.2-dev libsdl-gfx1.2-doc libsdl-image1.2 libsdl-image1.2-dbg libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dbg libsdl-mixer1.2-dev libsdl-net1.2 libsdl-net1.2-dbg libsdl-net1.2-dev libsdl-sound1.2 libsdl-sound1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev
sudo apt-get install libgtk-3-dev libspice-server-dev libusb-1.0-0-dev libusbredirparser-dev
3. QEMU default command, (not working just given for reference)
qemu-system-x86_64 \
-enable-kvm -smp 2 \
-append "console=ttyS0 vt.global_cursor_default=0 androidboot.selinux=permissive debug drm.debug=0 -device VGA" \
-m 1024 \
-serial mon:stdio \
-kernel $HOME/AOSP/out/target/product/generic_x86_64/kernel-ranchu \
-initrd $HOME/AOSP/out/target/product/generic_x86_64/ramdisk.img \
-drive index=0,if=none,id=system,file=$HOME/AOSP/out/target/product/generic_x86_64/system.img \
-device virtio-blk-pci,drive=system \
-drive index=1,if=none,id=cache,file=$HOME/AOSP/out/target/product/generic_x86_64/cache.img \
-device virtio-blk-pci,drive=cache \
-drive index=2,if=none,id=userdata,file=$HOME/AOSP/out/target/product/generic_x86_64/userdata.img \
-device virtio-blk-pci,drive=userdata \
-netdev user,id=mynet,hostfwd=tcp::5400-:5555 -device virtio-net-pci,netdev=mynet \
-device virtio-mouse-pci -device virtio-keyboard-pci \
-d guest_errors \
-nodefaults \
-display gtk,gl=on

I will add an sample app later

Sample emulator app
shoaibsaikat said:
I will add an sample app later
Click to expand...
Click to collapse
Here is the emulator client app
https://github.com/shoaibsaikat/ScreenTransferFromAndroidEmulatorToPhone

Why the emulator repo isn't updates since 6 years ago? Where is the emulator app right now?

Related

[GUIDE/ROM] Project Rookie - How to's - Building ROMs, Kernels & Mods [TEAM ROOK]

Welcome to Project Rookie:
This is the unofficial guide to ROM, Kernel and AROMA installer building. This guide is primarily geared toward building for the AT&T Samsung Galaxy Skyrocket, but as a general guide it will work for all devices (you just need to know where to plug in your device specific repos and commands). The intended audience is for individuals with basic knowledge of linux, a degree of knowledge in basic troubleshooting and a general curiosity for how this stuff works.
This thread is extraordinarily long and is jam packed full of useful information. Please SEARCH the thread before asking questions related to building. If you cannot find your answer, or need additional clarification then don't hesitate to ask. Everyone participating here is knowledgeable and helpful to new builders, so don't abuse it – any flaming will immediately be reported to the moderation team.
In the very least, read through the first posts of this thread in detail, at least twice, before you start building and running commands to get setup.
On one hand, it should go without saying that if you have no knowledge and/or experience with building, java, C++, and various other tools, you probably shouldn't begin here. At the same time, it is possible to learn to build, provided you can read, follow directions, and aren't too lazy to RESEARCH.
OH YEAH, and you better have patience. This isn't easy. It will be work. The quickest way to get flamed is to show yourself to be lazy. If you think that with a couple clicks, you can have your own flashy ROM, forget it. But, if you do want to learn, this is a good place to get started. Nobody here has an ego about this, and we all want to help. But, we all struggled to get to a successful point, and lazy, unmotivated people just irritate those who have had to learn from scratch too. This is an ever-changing thread; team members are working on or currently building all types of ROMs, kernels and other MODs like AROMA installer. Tutorials will be posted for any new thing learned and built as time and space allow. ALL ARE WELCOME AND ALL QUESTIONS ARE TOO. But, seriously, if it's a really ridiculous one, we reserve the right to screw with you about it.
Thread Disclaimer:
The releases, instructions, and extras posted here are to be used at your own risk. We work hard to provide good, workable knowledge and builds, and test our work before posting it up front. Nevertheless, no one is responsible if you lose your files, brick your device, or inadvertently cause a nuclear war. If you are seeking absolute perfection, RUN NOW WHILE YOU STILL CAN!!
Thread Table of Contents:
Post 1:
- Linux system configuration (Ubuntu 12.04 & 13.04)
- ROM building instructions for CM10.2, AOKP, PACMAN
Post 2:
- Instructions for kernel building, along with other additions, mods, and helpful tutorials
Post 3:
- Misc topics
- Team Rookie ROM & Kernel Distributions
- Links to related topics and specific posts of interest
The tutorial for building your own AROMA installer can be found here: http://forum.xda-developers.com/showpost.php?p=34886089&postcount=2708​
GETTING STARTED
Setting up your environment :
This is a combination of the steps offered in the threads 'Compile JB on Ubuntu' and TeamChopsticks CyanogenMod for Hercules and Skyrocket.
Special thanks to dastin1015 and TeamChopsticks.
Tip: Allocate at least 75 gigs of space for the building of ONE ROM. If you install ccache, you will want 90. A complete build directory can use as much as 100 gigs, so make sure you have plenty of room. One of the ways to fail out a build is too use all of your partition before acquiring all the necessary files.
For OSX Mavericks users, check out this thread for getting setup: http://forum.xda-developers.com/showthread.php?t=2510898
Here are the steps from those 2 tutorials in correct order:
1) You need the following:
-JDK 6 if you wish to build Jellybean.
Code:
[COLOR="Black"]$ sudo apt-get install openjdk-6-jdk[/COLOR]
-Python 2.4 -- 2.7, which you can download from python.org. Or:
Code:
[COLOR="black"]$ sudo apt-get install python[/COLOR]
-Git 1.7 or newer. You can find it at git-scm.com. Or:
Code:
[COLOR="black"]$ sudo apt-get install git-core[/COLOR]
-Android SDK:
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to – this tutorial assumes you've done that as well.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:
Code:
[COLOR="black"]# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin[/COLOR]
Find your .profile file and add this at the bottom of the file:
Code:
[COLOR="black"]PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"[/COLOR]
You have now successfully installed the Android SDK.
To check for updates issue this into your terminal:
Code:
[COLOR="black"]$ android[/COLOR]
2) Install required packages. 64-bit (recommended)
Code:
[COLOR="black"]$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils lzop schedtool[/COLOR]
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
[COLOR="black"]$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so[/COLOR]
Code:
[COLOR="black"]$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so[/COLOR]
3) Configure your USB.
Code:
[COLOR="black"]$ gksudo gedit /etc/udev/rules.d/51-android.rules[/COLOR]
Inside of this blank text file insert:
Code:
[COLOR="black"]#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"[/COLOR]
4) Save the file and close it and then issue this command:
Code:
[COLOR="black"]$ sudo chmod a+r /etc/udev/rules.d/51-android.rules[/COLOR]
5) Install the repo:
Code:
[COLOR="black"]$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo[/COLOR]
Create your work directory:
Code:
[COLOR="black"]mkdir ~/"your directory name here" For example: mkdir ~/cm10
cd ~/cm10[/COLOR]
This is what you need to begin building. From here, the various types of ROM styles can be built with a few additions and commands.
UNOFFICIAL CM10.2 :
Initialize the work directory:
Code:
[COLOR="Black"]repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2[/COLOR]
Create and edit roomservice.xml in .repo: gedit /.repo/local_manifests/roomservice.xml
Code:
[COLOR="Black"]<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_samsung_skyrocket" path="device/samsung/skyrocket" remote="github" revision="cm-10.2" />
<project name="CyanogenMod/android_device_samsung_hercules" path="device/samsung/hercules" remote="github" revision="cm-10.2" />
<project name="CyanogenMod/android_device_samsung_msm8660-common" path="device/samsung/msm8660-common" remote="github" revision="cm-10.2" />
<project name="CyanogenMod/android_kernel_samsung_msm8660-common" path="kernel/samsung/msm8660-common" remote="github" revision="cm-10.2" />
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-10.2" />
<project name="CyanogenMod/android_device_samsung_celox-common" path="device/samsung/celox-common" remote="github" revision="cm-10.2" />
<project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-10.2" />
</manifest>[/COLOR]
Code:
[COLOR="black"]repo sync -j16 (this may take a few hours as it downloads ~17GB of source)[/COLOR]
To Build:
Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
repo sync -j16
[/color]
For Skyrocket:
Code:
$ CM_EXTRAVERSION=mycustombuild CM_SNAPSHOT=1 brunch cm_skyrocket-userdebug
or
$ breakfast cm_skyrocket-userdebug
$ brunch cm_skyrocket-userdebug
For Hercules:
Code:
CM_EXTRAVERSION=mycustombuild CM_SNAPSHOT=1 brunch cm_hercules-userdebug
**After you build, your repo files will remain in place. This will cause your future builds to be based from that specific time of additions and merges. Wiping or 'cleaning' your files often will ensure that your builds are the most up-to-date. To be sure that you start with a fresh repo at the beginning of every build, you should 'make clean' often. For example:
Code:
[COLOR="Black"]$ cd ~/cm10
$ make clean (or 'make clobber' without quotes)[/COLOR]
If you want to have your 'cleaning service' done as part of your process, this is a way to achieve it:
Code:
[COLOR="black"]$ cd cm10
$ repo sync -j16
$ . build/envsetup.sh && make clobber && CM_EXTRAVERSION= mycustombuild CM_SNAPSHOT=1 brunch cm_skyrocket-userdebug[/COLOR]
This will make the cleaning process automatic.
The Git can be found here:
https://github.com/CyanogenMod
UNOFFICIAL CM11.0 :
The steps are essentially the same as CM10.2 ... just have to make a couple changes to your git init and your roomservice.xml as follows:
Code:
[COLOR="Black"]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0[/COLOR]
Create and edit roomservice.xml in .repo: gedit /.repo/local_manifests/roomservice.xml
Code:
[COLOR="Black"]<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_samsung_skyrocket" path="device/samsung/skyrocket" remote="github" />
<project name="CyanogenMod/android_device_samsung_hercules" path="device/samsung/hercules" remote="github" />
<project name="CyanogenMod/android_device_samsung_msm8660-common" path="device/samsung/msm8660-common" remote="github" />
<project name="CyanogenMod/android_kernel_samsung_msm8660-common" path="kernel/samsung/msm8660-common" remote="github" />
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" />
<project name="CyanogenMod/android_device_samsung_celox-common" path="device/samsung/celox-common" remote="github" />
<project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" />
</manifest>[/COLOR]
The remaining steps to build are the same ... breakfast, lunch, brunch etc.
UNOFFICIAL AOKP :
This is a set of steps to set up and run an AOKP build. Special thanks to m4570d0n for taking the time to share his detailed instructions, and R41NS for his assistance in providing some simplifications. Buy those guys a beer if you see them!
It's actually pretty close to CM. It's just several tiny changes. I made some changes that are not necessary but did so to conserve space. With CM's manifest setup, you don't have to worry about downloading a bunch of stuff you don't need but with AOKP, by default you're downloading all the kernels and /device/whatever for pretty much all devices and I didn't want to do that so here's what I did.
1)
Code:
[COLOR="Black"]repo init -u https://github.com/AOKP/platform_manifest.git -b jb-mr1[/COLOR]
2) Create local_manifest.xml in .repo with the following in it:
Code:
[COLOR="black"]
[/COLOR]
3) Next, do a repo sync.
4) Edit vendorsetup.sh to have the following in it :
Code:
[COLOR="Black"]add_lunch_combo aokp_skyrocket-userdebug[/COLOR]
Also, open device.mk and change it to this :
Code:
[COLOR="black"]$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
## The gps config appropriate for this device
PRODUCT_COPY_FILES += device/common/gps/gps.conf_US_SUPL:system/etc/gps.conf
## (2) Also get non-open-source specific aspects if available
$(call inherit-product-if-exists, vendor/samsung/skyrocket/skyrocket-vendor.mk)
## misc
PRODUCT_PROPERTY_OVERRIDES += \
dalvik.vm.dexopt-flags=m=v,o=y
## overlays
DEVICE_PACKAGE_OVERLAYS += device/samsung/hercules/overlay
# Device uses high-density artwork where available
PRODUCT_AAPT_CONFIG := normal hdpi
PRODUCT_AAPT_PREF_CONFIG := hdpi
# Hardware
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml
# Ramdisk
PRODUCT_COPY_FILES += \
device/samsung/skyrocket/ramdisk/init.qcom.rc:root/init.qcom.rc \
device/samsung/skyrocket/ramdisk/init.qcom.sh:root/init.qcom.sh \
device/samsung/skyrocket/ramdisk/init.qcom.usb.rc:root/init.qcom.usb.rc \
device/samsung/skyrocket/ramdisk/init.qcom.usb.sh:root/init.qcom.usb.sh \
device/samsung/skyrocket/ramdisk/init.target.rc:root/init.target.rc \
device/samsung/skyrocket/ramdisk/ueventd.rc:root/ueventd.rc \
device/samsung/skyrocket/ramdisk/init.emmc.rc:root/init.emmc.rc \
device/samsung/skyrocket/fstab.qcom:root/fstab.qcom
# BT firmware
PRODUCT_COPY_FILES += \
device/samsung/skyrocket/firmware/bcm4330B1.hcd:system/etc/firmware/bcm4330B1.hcd
# Vold
PRODUCT_COPY_FILES += \
device/samsung/skyrocket/vold.fstab:system/etc/vold.fstab
# QRNGD
PRODUCT_PACKAGES += qrngd
# common msm8660
$(call inherit-product, device/samsung/msm8660-common/msm8660.mk)
$(call inherit-product, frameworks/native/build/phone-xhdpi-1024-dalvik-heap.mk)
$(call inherit-product-if-exists, vendor/samsung/skyrocket/skyrocket-vendor.mk)
#WIFI_BAND := 802_11_ABG
#$(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4330/device-bcm.mk)
# NFC
BOARD_HAVE_NFC := true[/COLOR]
**With the exception of making the change to use the Hercules overlay, the other edits to device.mk are optional, and will cause different results with the different options you use.
5)Go to vendor/AOKP/products and create a skyrocket.mk file that is essentially copied from the hercules.mk. :
Code:
[COLOR="black"]# Inherit AOSP device configuration for skyrocket.
$(call inherit-product, device/samsung/skyrocket/full_skyrocket.mk)
# Inherit common product files.
$(call inherit-product, vendor/aokp/configs/common_phone.mk)
# Inherit GSM common stuff
$(call inherit-product, vendor/aokp/configs/gsm.mk)
# skyrocket overlay
PRODUCT_PACKAGE_OVERLAYS += vendor/aokp/overlay/hercules
# Setup device specific product configuration.
PRODUCT_NAME := aokp_skyrocket
PRODUCT_BRAND := Samsung
PRODUCT_DEVICE := skyrocket
PRODUCT_MODEL := SGH-I727
PRODUCT_MANUFACTURER := Samsung
PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=SGH-I727 TARGET_DEVICE=SGH-I727 BUILD_FINGERPRINT="samsung/SGH-I727/SGH-I727:4.1.1/IMM76D/UCLF6:user/release-keys" PRIVATE_BUILD_DESC="SGH-I727-user 4.1.1 IMM76D UCLF6 release-keys"
# boot animation
PRODUCT_COPY_FILES += \
vendor/aokp/prebuilt/bootanimation/bootanimation_480_800.zip:system/media/bootanimation.zip[/COLOR]
Then go to vendor/AOKP and
6) Add the skyrocket.mk file in Step 5 to vendor/AOKP/products/AndroidProducts.mk :
Code:
[COLOR="black"]PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/captivatemtd.mk \
$(LOCAL_DIR)/crespo.mk \
$(LOCAL_DIR)/crespo4g.mk \
$(LOCAL_DIR)/d2tmo.mk \
$(LOCAL_DIR)/d2usc.mk \
$(LOCAL_DIR)/d2vzw.mk \
$(LOCAL_DIR)/evita.mk \
$(LOCAL_DIR)/galaxysmtd.mk \
$(LOCAL_DIR)/fascinatemtd.mk \
$(LOCAL_DIR)/galaxysmtd.mk \
$(LOCAL_DIR)/grouper.mk \
$(LOCAL_DIR)//skyrocket.mk \
$(LOCAL_DIR)/hercules.mk \
$(LOCAL_DIR)/i9300.mk \
$(LOCAL_DIR)/i9100.mk \
$(LOCAL_DIR)/i9100g.mk \
$(LOCAL_DIR)/maguro.mk \
$(LOCAL_DIR)/n7000.mk \
$(LOCAL_DIR)/p3100.mk \
$(LOCAL_DIR)/p3110.mk \
$(LOCAL_DIR)/p3113.mk \
$(LOCAL_DIR)/p5100.mk \
$(LOCAL_DIR)/p5110.mk \
$(LOCAL_DIR)/p5113.mk \
$(LOCAL_DIR)/tf101.mk \
$(LOCAL_DIR)/toro.mk \
$(LOCAL_DIR)/toroplus.mk \
$(LOCAL_DIR)/vibrantmtd.mk[/COLOR]
7) In vendor/AOKP open vendorsetup.sh and add this :
Code:
[COLOR="black"]add_lunch_combo aokp_skyrocket-userdebug[/COLOR]
8) Go to https://github.com/TeamChopsticks/proprietary_vendor_samsung/downloads and select "Download as zip." After the download completes, open the archive and extract the "skyrocket" folder to /vendor/samsung.
or
8) cd to your home directory. Download the proprietary_vendor_samsung repo from Team Chopsticks and then copy the skyrocket directory to /vendor/samsung:
Code:
[COLOR="Black"]cd
git clone -b jellybean https://github.com/TeamChopsticks/proprietary_vendor_samsung.git
cp -r proprietary_vendor_samsung/skyrocket aokp/vendor/samsung[/COLOR]
9) Start building :
Code:
[COLOR="Black"]. build/envsetup.sh
lunch aokp_skyrocket-userdebug && mka bacon[/COLOR]
SLIMBEAN :
By popular demand, here is a set of steps for building Slimbean - Many thanks to onlychevys for taking the time to lay this out
To build Slim Bean, you do the same as cm10 only with their platform_manifest:
https://github.com/SlimRoms/platform_manifest
(The manifest code is too long to place here, sorry)
If you have the space on your hard drive, then you can copy the .repo file from cm10 or aokp etc (.repo is a hidden file,cntrl + h to see it) to another directory and delete the local_manifest in there.
Then:
Code:
[COLOR="Black"]repo init -u git://github.com/SlimRoms/platform_manifest.git -b jb4.2[/COLOR]
Copy this code to terminal while in that directory to initialize their repo.
Next:
Code:
[COLOR="black"]repo sync -j16[/COLOR]
**Copying the .repo saves about 3 plus hours of downloading aosp source.
Then you should be ready to build.
Start building :
Code:
[COLOR="Black"]. build/envsetup.sh
lunch slimbean_skyrocket-userdebug && mka bacon[/COLOR]
PAC-man :
This is a newer but very functional and well-liked compilation of three builds: Paranoid Android, CM, and AOKP. Here is a brief set of steps from the PAC git:
To get started with PAC-man, you'll need to get familiar with Git and Repo.
To initialize your local repository using the PAC-man trees, use a command like this:
Code:
[COLOR="Black"]repo init -u git://github.com/PAC-man/android.git -b cm-10.1[/COLOR]
Then to sync up:
Code:
[COLOR="black"]repo sync[/COLOR]
After the syncing process completes, you can run your build commands:
Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]
Code:
[COLOR="black"]vendor/cm/get-prebuilts[/COLOR]
Code:
[COLOR="black"]repo sync -j16[/COLOR]
And finally:
Code:
[COLOR="black"]./build-pac.sh skyrocket -j16[/COLOR]
The Git can be found here:
https://github.com/PAC-man
Some github information from @m4570d0n who has some serious git-fu skills.
m4570d0n said:
You don't have to cd into a project directory to do a repo sync for that project. You can just run repo sync path/to/project. from the root of your build tree.
While I'm here, someone asked me about some git stuff recently, and I figured the info might be useful here as well....
Start with the tutorials on github.
Create A Repo
Fork A Repo
Using Pull Requests
Github Glossary
Also, don't underestimate the usefulness of --help. It's nearly a universal rule that adding "--help" to any command will bring up a help menu for that command. For git, it's particularly helpful for me, and literally every git command has it's own help file, and usually has example commands as well. For example, each of these will bring up a different help file:
Code:
git branch --help
git pull --help
git log --help
git remote --help
git show --help
etc., etc.
You can also just browse the whole manual, which is where those help files come from.:
http://git-scm.com/docs
I've also had a few specific things I was trying to figure out how to do on git and in the process found some nice sites/articles that were very helpful:
Visual Git Cheat Sheet
git howto: revert a commit already pushed to a remote repository - Christoph Rüegg
On undoing, fixing, or removing commits in git
More reference info with examples:
http://gitref.org/branching/
http://gitref.org/remotes/
a few miscellaneous command I picked up that I found useful.
commit a change created by someone else, and manually retaining the original author of the commit:
Code:
git commit --author="John Doe <[email protected]>"
commit a change created by someone else, and manually retaining the original author and the original commit date:
Code:
git commit --author="John Doe <[email protected]>" --date="Thu Oct 03 20:19:03 2013 +0000"
Push a change to CM's gerrit or PAC-man's gerrit:
Code:
git push ssh://[email protected]:29418/android_packages_apps_Setting HEAD:refs/for/cm-10.2
Code:
git push ssh://[email protected]:29418/android_packages_apps_Settings HEAD:refs/for/cm-10.2
Find the git index blob associated with a particular file:
Code:
[COLOR=SeaGreen][email protected][/COLOR]:[COLOR=RoyalBlue]~/PAC[/COLOR]$ cd frameworks/base
[COLOR=SeaGreen][email protected][/COLOR]:[COLOR=RoyalBlue]~/PAC/frameworks/base[/COLOR]$ git hash-object core/res/assets/images/android-logo-mask.png
498ad8885e2a1e55a499c404effa457de2cb6461
Also there's a couple extra git packages in the official Ubuntu repos that can be pretty handy. One is called git-stuff. I'm pretty sure the guy that created that is one of the dudes in CM (author is Daniel Baumann and I see commits on CM's gerrit almost daily from a guy named Danny Baumann).
Two others:
git-extras
git-gui
git gui is kinda cool and noob friendly. In order to use it, just cd into a folder that has a git repo in it and type:
Code:
git gui
Another useful git command is git stash.
Let's say you made some local changes to /packages/apps/Mms. If you wanted to cherry-pick a commit that involved any files you changed locally, the cherry-pick would fail because there are uncommitted changes. You could commit them, but then they would be undone on your next repo sync. With git stash, it will save your uncommitted changes. Then you can apply the cherry picks, and then apply your changes again on top of them by running:
Code:
git stash apply
Note: that will work if you only have one stash or if your most recent stash is the one you want to apply, otherwise you will have to add the name of the stash as well. For reference on git stash command options like listing the stashes, diffs, etc. see this:
https://www.kernel.org/pub/software/scm/git/docs/git-stash.html
Click to expand...
Click to collapse
KERNEL BUILDING and other EXTRAS
Building your first kernel :
This is a set of steps to get you building your first kernel. Special thanks to thewadegeek for putting this tutorial together. His thread can be found here: http://forum.xda-developers.com/showthread.php?t=1748297
Step 1. Build Environment
A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)
B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.
C. Open a terminal
D. Type
Code:
[COLOR="black"]mkdir android[/COLOR]
E. Type
Code:
[COLOR="black"]cd android[/COLOR]
G.Type
Code:
[COLOR="black"]mkdir kernel[/COLOR]
Step 2. Your Source
A. Open your Terminal Prompt
B. Type
Code:
[COLOR="black"]cd android/kernel[/COLOR]
C. Type
Code:
[COLOR="black"]git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains[/COLOR]
D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.
http://www.htcdev.com/
http://opensource.samsung.com/
.http://developer.sonymobile.com/wpor...ads/opensource
http://www.lg.com/global/support/ope...opensource.jsp
Step 3. Modifications
This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.
Mod 1. Applying a patch
A. Download the patch you wish to apply, in this case this one should work.
B. Save that file as "kernelPatch" in your kernel directory.
C. Open a Terminal
D. Move into the root directory of the kernel you wish to patch.
E. Type
Code:
[COLOR="black"]patch -p1 < ../kernelPatch[/COLOR]
Mod 2. Adding a Governor Alone
A. Open "drivers/cpufreq/Kconfig"
B. Add the following lines in appropriate spot amongst the other govenor's
Code:
[COLOR="Black"]config CPU_FREQ_DEFAULT_GOV_SMARTASS
bool "smartass"
select CPU_FREQ_GOV_SMARTASS
select CPU_FREQ_GOV_PERFORMANCE
help
Use the CPUFreq governor 'smartass' as default.
[/COLOR]
Code:
[COLOR="Black"]config CPU_FREQ_GOV_SMARTASS
tristate "'smartass' cpufreq governor"
depends on CPU_FREQ
help
smartass' - a "smart" optimized governor!
If in doubt, say N.[/COLOR]
C. Open "drivers/cpufreq/Makefile"
D. Add the following line in the appropriate spot.
Code:
[COLOR="Black"] obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS) += cpufreq_smartass.o[/COLOR]
E. Create a file called "drivers/cpufreq/cpufreq_smartass.c"
F. Put the following code in that file.
http://pastebin.com/f0Bk9kVZ
G. open "include/linux/cpufreq.h"
H. Under the "Cpufreq Default" section add
Code:
[COLOR="Black"]#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS)
extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)[/COLOR]
Ok there is a governor added, do the exact same steps for any other one's you would like to add.
Step 4. Getting a Config file
Option A. Pulling a config file from a kernel.
A. Hook up a device that is using a kernel similar to one you are using as your base.
B. Open a terminal
C. Change to your root kernel directory
D. Type
Code:
[COLOR="black"]adb pull /proc/config.gz[/COLOR]
E. Type
Code:
[COLOR="black"]gunzip config.gz[/COLOR]
F. Type
Code:
[COLOR="black"]mv config arch/arm/configs/<your_config_name>_defconfig[/COLOR]
Option B. Using the manufacturers config.
Unfortunately as stated above, not all kernels support the "/proc/config.gz" method. You can typically find a manufacturer's configuration file in "arch/arm/configs". I believe the one for my HTC Flyer was called "flyer_hc_defconfig", so look for a layout similar to that one. Also read the README to get a better idea of how to modify it. I would personally make a copy of it called "<your_config_name>_defconfig" and use that as my base.
Step 5. Building
Time to start the real "build" section of this tutorial.
Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory
B. Type
Code:
[COLOR="black"]export ARCH=arm[/COLOR]
C. Type
Code:
[COLOR="black"]export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-[/COLOR]
Part B. The First Build
A. Type
Code:
[COLOR="black"]make <your_config_name>_defconfig[/COLOR]
B. Type
Code:
[COLOR="black"]make menuconfig[/COLOR]
and make the required changes to use any modules you added or similar changes.
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part C. Re-Builds
A. Type
Code:
[COLOR="black"]make clean[/COLOR]
B. Type
Code:
[COLOR="black"]make oldconfig[/COLOR]
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part D. Building Modules
You have two options:
A. Type
Code:
[COLOR="black"]make modules[/COLOR]
B. Type
Code:
[COLOR="black"]make path/to/your/module.ko[/COLOR]
The above steps explained:
Part A.(These steps are required every time you close your terminal and re-open it to build again.)
A. Ok shouldn’t need to explain this.
B. This command sets your target architecture.
C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.
Part B.(These only need to be run the first time you build a kernel.)
A. Load's your configuration file from earlier.
B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.
C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j4". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.
Part C. (Use the command's when you are building any-time outside of the first)
A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every I build unless my changes are really small and localized.
B. A very awesome command, it parses through what has changed and only prompts you about new options.
C. See the explanation for the above "Part C.".
Part D.(Use these for just building kernel modules.)
A. This will re-build all modules.
B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.
Step 6. Now what
Ok we have now started our build and we are waiting for it to finish, so there are two possible outcomes:
Outcome A. Build Succeeds
W00t!! You have a kernel built by your self from source. There are a couple things you need in-order to use this kernel on your device any ".ko" modules and the zImage binary. If you pay attention to the output of your compiler then you will see the location of those objects. However the following commands will make your life a bit easier(Thanks Recognized Developer Hacre):
A. Open a terminal
B. Change to your root kernel directory
C. Type
Code:
[COLOR="black"]mkdir ../<your_kernel>_output[/COLOR]
D. Type
Code:
[COLOR="black"]cp arch/arm/boot/zImage ../<your_kernel>_output/zImage[/COLOR]
E. Type
Code:
[COLOR="black"]find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;[/COLOR]
The above steps explained:
A-C. Self-Explanatory
D. Move our kernel binary into our output folder
E. This handy bit of magic finds all ".ko" modules and also copies them into your output file.
You will also need to assemble a kernel image containing a initramfs for your device, along with the kernel binary and such. That however is beyond the scope of this tutorial. To get started though try searching the following phrases.
Code:
[COLOR="Black"]building android kernel image
xda build kernel image
xda unpack boot.img[/COLOR]
Outcome B. Build Fails
Oh dear. It failed. Well guess what...this is going to happen..a LOT. Get used to it, and get used to googling and experimenting with different solutions. The following are some tips that will help you with debugging your issues.
Running a "Clean" build
A. Backup your config file - Type
Code:
[COLOR="black"]cp .config ../backupConfig[/COLOR]
B. Re-run the build process using just your defconfig from earlier.
Limiting Output(Thanks Hacre.)
A. Another good tip is to run "make -j1" to get the error, as it will limit the amount of text you need to scroll through.
CCACHE​
Here is a brief tutorial on the installation of Ccache, which can shorten build times drastically :
If you have room on your build system you can speed
your builds up considerably by using ccache. ccache is a compiler
cache. It speeds up re-compilation of C/C++ code by caching
previous compiles and detecting when the same compile is
being done again.
Install it with apt-get:
Code:
[COLOR="Black"]sudo apt-get install ccache[/COLOR]
Set environment vars for Android use:
(I put these exports in my .bashrc)
Code:
[COLOR="Black"]export USE_CCACHE=1
export NDK_CCACHE=ccache[/COLOR]
Set a cache size of 10G for optimal results:
Code:
[COLOR="black"]ccache -M 10G[/COLOR]
Check the status of your cache with the command:
Code:
[COLOR="black"]ccache -s [/COLOR]
Returns:
Code:
[COLOR="black"]
cache directory /home/jocala/.ccache
cache hit 106673
cache miss 18379
called for link 3758
preprocessor error 5
not a C/C++ file 4425
unsupported compiler option 678
no input file 4565
files in cache 36758
cache size 3.2 Gbytes
max cache size 10.0 Gbytes[/COLOR]
Instructions for submitting to Gerrit are listed here: http://forum.xda-developers.com/showpost.php?p=34095392&postcount=2588
ADVANCED INSTRUCTIONS FOR BUILDING CUSTOMIZATION
Special thanks to m4570d0n for putting this together for everyone
If you wanted to add something like, for example, Titanium Backup, you could go to /vendor/cm/config/common.mk and starting on line 98 where you see:
Code:
[COLOR="Black"]PRODUCT_COPY_FILES += \
vendor/cm/proprietary/RomManager.apk:system/app/RomManager.apk \
vendor/cm/proprietary/Term.apk:system/app/Term.apk \
vendor/cm/proprietary/lib/armeabi/libjackpal-androidterm4.so:system/lib/libjackpal-androidterm4.so \
vendor/cm/prebuilt/common/apps/Superuser.apk:system/app/Superuser.apk[/COLOR]
and add a line below that like this:
Code:
[COLOR="black"] vendor/cm/prebuilt/common/apps/TitaniumBackup.apk:system/app/TitaniumBackup.apk[/COLOR]
Then just place your TitaniumBackup.apk in the /vendor/cm/prebuilt/common/apps folder. You can modify that folder location to whatever folder you want to use, and you can substitute Titanium Backup with whatever apk you'd like. Take note though that this will install it as a system app in /system/app, while most apps would normally be installed as a user app in /data/apps. I think you could change the location to /data/app in that line, but I'm not positive. Someone please correct me if I'm wrong. I mean, I know you can, but I'm not sure if it would be an issue when you flash a zip without wiping /data and the zip file has files in /data.
You could also create your own github repo, name it something like vendor_onlychevys and add that repo to your local manifest with the path as vendor/onlychevys. Then you could use that as your directory path to the apps you want to add.
The slightly longer, but better way, is that you could also create your own make file in that repo by copying /device/samsung/skyrocket/cm.mk to your repo and rename it (let's say vendor_onlychevys/products/onlychevys_skyrocket.mk) and add a line in that file with something like this:
Code:
[COLOR="black"]# Inherit some common onlychevys stuff.
$(call inherit-product, vendor/onlychevys/config/common_full_phone.mk)[/COLOR]
and also editing the product name in that file near the bottom to something like this:
Code:
[COLOR="black"]PRODUCT_NAME := onlychevys_skyrocket[/COLOR]
You would need to make 3 more files.
In that same directory make a file called AndroidProducts.mk and in that file add this:
Code:
[COLOR="black"] PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/onlychevys_skyrocket.mk[/COLOR]
Next, copy /vendor/cm/config/common_full_phone.mk to your repo at vendor_onlychevys/config/common_full_phone.mk. Then edit that file by adding a line in there with something like this:
Code:
[COLOR="black"]PRODUCT_COPY_FILES += \
vendor/onlychevys/prebuilt/common/apps/TitaniumBackup.apk[/COLOR]
And make sure to put your app in that prebuilt/common/apps/ directory in your repo.
Finally, create a new file in gedit (or other text editor of your choice). In that file add this:
Code:
[COLOR="black"] add_lunch_combo onlychevys_skyrocket-userdebug[/COLOR]
Name the file vendorsetup.sh and put it in your repo at vendor_onlychevys/vendorsetup.sh
Now, when you want to build you can run:
Code:
[COLOR="black"]. build/envsetup.sh
brunch onlychevys_skyrocket-userdebug[/COLOR]
This will be the same as if you used the regular command but will also include whatever apks you want to put in your repo, since you are just copying those files and adding a line to also include your stuff. This way, though you can add apps and/or make changes to your repo and you wont get errors about having local changes to vendor/cm or wherever when you try to run repo sync. You also wont have to keep deleting and re-adding the same files over and over after every sync because they will be in your own repo.
And just for clarity, your repo would look something like this:
Code:
[COLOR="black"]vendor_onlychevys
|-- config
| `-- common_full_phone.mk
|-- prebuilt
| `-- common
| | `-- apps
| | `-- TitaniumBackup.apk
|-- products
| |-- AndroidProducts.mk
| `-- onlychevys_skyrocket.mk
`-- vendorsetup.sh[/COLOR]
More advanced instructions to be posted as time allows. Now, get to work!
CHERRYPICKING: If you have progressed beyond the level of copying and pasting, and have begun researching the 'cherry-picking' process, there is a brief set of steps regarding this on post #1292 : http://forum.xda-developers.com/showthread.php?t=1798056&page=130.
This should give those interested a basic idea of the process. More detailed instructions are going to be posted as time allows.
NOTE: the cherry-picks listed in that tutorial are no longer neccesary. They have been merged, and don't require picking. But, for the informational purposes, the steps are useful. Thanks to m4570d0n for laying that out for everyone!​
Links for all relevant topics:
Here are some relevant topics/tutorials/sites:
Download | Ubuntu - www.ubuntu.com/download
Official Ubuntu Documentation: Help for all versions. - https://help.ubuntu.com/
How To Windows Dual Boot: - https://help.ubuntu.com/community/WindowsDualBoot
How To Use The Terminal: Commandline stuff. - https://help.ubuntu.com/community/UsingTheTerminal/
[HOW TO] Beginners Guide to Android ROM Development - http://forum.xda-developers.com/showthread.php?t=1272270 (courtesy of isidromxz)
[Tutorial] Compile JB on Ubuntu - http://forum.xda-developers.com/showthread.php?t=1762641 (courtesy of dastin1015)
[CM10] [PPA] Cyanogenmod Compiler v0.6 - http://forum.xda-developers.com/showthread.php?t=1789190 (courtesy of lithid-cm)
[WIP][CM10] CyanogenMod 10 Alpha | tutorial - http://forum.xda-developers.com/showthread.php?t=1775133 (courtesy of sk8erwitskil)
[Wiki] How to: Gerrit - http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit
[Wiki] How to: Git - http://wiki.cyanogenmod.com/wiki/Howto:_Git
[Wiki] How to: Connect to device with SSH - http://wiki.cyanogenmod.com/wiki/Howto:_Connect_to_Device_with_SSH
Here is an easy-to-use page on common Linux commands: - http://www.pixelbeat.org/cmdline.html
Linux Newbie Guide : - http://www.unixguide.net/linux/linuxshortcuts.shtml
Also, Team Chopsticks has a good page with some useful tips as well, located here:
http://www.teamchopsticks.org/p/contributing.html (thanks to bdusmc for the tip)
Here is a link to LIFEHACKER's command line tutorials. Very good stuff!! : http://lifehacker.com/5743814/become-a-command-line-ninja-with-these-time+saving-shortcuts
Building AOKP from source : http://rootzwiki.com/topic/31166-tutorial-so-you-want-to-build-aokp-jb-ubuntu-1204/
Link to AOKP (Android Open Kang Project) · GitHub :
https://github.com/AOKP
Link to AOKP news : http://aokp.co/index.php/news
Link to R41NS AOKP work : http://rootzwiki.com/topic/34092-aok...-2-jb-build-4/
Link to aznrice2k4s other Skyrocket and OneX work : http://forum.xda-developers.com/showthread.php?t=1956247
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Builds :
M4570D0N has a new PAC-man ROM for all to see, use and emulate!
Info:
based on the latest AOSPA (ParanoidAndroid 3.14+)
plus the latest CM10.1
plus the latest AOKP-MR1
In addition to everything included in the vanilla PAC-man build I've added:
internal/external sdcard storage options for Camera/Gallery
Alt-signal layout from AOKP
CM circle battery from CM10/10.1
Titanium Backup
ADWLauncher
M4570M0D v1.1
tiny gapps
Download:
http://d-h.st/sZo
​
I think you should call it project powerthrust....much catchier
Sent from my SAMSUNG-SGH-I727 using xda app-developers app
i really want this thread to go somewhere so im going try and set up my build environment and see if i can get jb to compile. im using ubuntu 12.04 because i think soon its going to become the new standard for building. here is some instructions by sk8rwitskil http://forum.xda-developers.com/showthread.php?t=1766862
mbucks911 said:
no offense, but you probably should have actually built something before creating this thread because just creating this thread isnt going to "get the ball rolling" but what will is a starting point or an alpha build for the aspiring developers to look at and try to debug and make better. right now you just look like "that guy" that just wanted attention by trying to start something in the dev thread
Click to expand...
Click to collapse
I respectfully disagree. I am happy to see this thread (I think my comments in the WIP CM10 are what prompted it) and I fully support it. People need to have a place to learn to develop and build ROMs from source, and this is a step to help provide that place without clogging up other more focused dev threads. I don't think anyone is trying to use the thread to get attention, other than to get others involved, talking, debugging and building.
Tom
Yea it might have been better to post in general guys. Looking forward to this and good luck
Sent from my Nexus 7 using xda premium
I'm jumping on board here too. Feel free to mosey on over to fb and join our group. It's called Team NAND, it is for aspiring devs as well. Only it isn't intended for jb only.
I'm hoping to have all my prereqs set up by the weekend and ill post my first build here. Good luck everyone.
Sent from my SAMSUNG-SGH-I727 using xda app-developers app
Go TEAM ROOKIE aha but yea I'm all set up and ready to go developing with everyone else
Sent from my SAMSUNG-SGH-I727 using xda app-developers app
mbucks911 said:
no offense, but you probably should have actually built something before creating this thread because just creating this thread isnt going to "get the ball rolling" but what will is a starting point or an alpha build for the aspiring developers to look at and try to debug and make better. right now you just look like "that guy" that just wanted attention by trying to start something in the dev thread
i do want this thread to go somewhere so im going try and set up my build environment and see if i can get jb to compile. im using ubuntu 12.04 because i think soon its going to become the new standard for building. here is some instructions by sk8rwitskil http://forum.xda-developers.com/showthread.php?t=1766862
Click to expand...
Click to collapse
WOW that didn't take long. Thanks for that. Real helpful. I was trying to start a place for those of us that really want to provide builds, but HAVEN"T yet. I spent two days getting my environment together and have seen so many posts from other feeling the same way that this seemed like a good idea, until now. I specifically said that I assumed no control over this thread. If you actually looked anywhere else, you would see that myself and quite a few other rookies have been posting on sk8rs thread for the better part of two weeks. We need novices that want to help, not start static. Sheesh
Decepticaons said:
I'm jumping on board here too. Feel free to mosey on over to fb and join our group. It's called Team NAND, it is for aspiring devs as well. Only it isn't intended for jb only.
I'm hoping to have all my prereqs set up by the weekend and ill post my first build here. Good luck everyone.
Sent from my SAMSUNG-SGH-I727 using xda app-developers app
Click to expand...
Click to collapse
Can you link the group, searching FB finds nothing.
dakpluto said:
Can you link the group, searching FB finds nothing.
Click to expand...
Click to collapse
As you wish!
https://www.facebook.com/#!/groups/205511066243382/
I am interested in this. What do I need to do to setup initial environment? Do I follow instructions by sk8rwitskil?
cnewsgrp said:
I am interested in this. What do I need to do to setup initial environment? Do I follow instructions by sk8rwitskil?
Click to expand...
Click to collapse
Do you have Ubuntu installed? If not install Ubuntu then follow the instructions here http://source.android.com/source/initializing.html after that you can follow sk8erwitskil's instructions
Sent from my Transformer Pad TF300T using Tapatalk 2
Fyi - i have a hercules, but im already down. Going to need to repartition my hdd, and work some stuff around... but ill get er done.
Sent from my ASUS Transformer Pad TF300T using XDA Premium HD app
cnewsgrp said:
I am interested in this. What do I need to do to setup initial environment? Do I follow instructions by sk8rwitskil?
Click to expand...
Click to collapse
Preferences vary among the Linux crowd, but from my own experience and what others have posted, Ubuntu is the easiest to install and get started with. Google it and their site will have everything you need, right down to an exe. for easy install. From there, follow the other's instructions for getting an environment set up. Any questions or issues, someone here will help, I'm sure.
EDIT: posted a link to this at the beginning of the thread
new ion? said:
Fyi - i have a hercules, but im already down. Going to need to repartition my hdd, and work some stuff around... but ill get er done.
Sent from my ASUS Transformer Pad TF300T using XDA Premium HD app
Click to expand...
Click to collapse
I am a novice, so I don't know the particulars yet, but from what I've read it shouldn't be a serious issue. Maybe a fix here or there....
Decepticaons said:
I'm jumping on board here too. Feel free to mosey on over to fb and join our group. It's called Team NAND, it is for aspiring devs as well. Only it isn't intended for jb only.
I'm hoping to have all my prereqs set up by the weekend and ill post my first build here. Good luck everyone.
Sent from my SAMSUNG-SGH-I727 using xda app-developers app
Click to expand...
Click to collapse
Link to the fb group? Searched, but with no luck.
EDIT: Nevermind. I see it was already asked/answered haha.
btm fdr said:
Link to the fb group? Searched, but with no luck.
Click to expand...
Click to collapse
You searched huh, its only 6 posts back
Sent from my SAMSUNG-SGH-I727 using xda premium

Creating your CM ROM for Galaxy S plus

Credits:
Thanks to Arco, Realtyem and andres_a whose posts helped me to build the ROM from sources.
Most of the post is copied from the guide YardE's guide and a pdf whose author I could not find later. (Please let me know if I have missed somebody.)
*******************************************************
First get the build tools:
*******************************************************
1. Get the packages required for building the ROM.
On 10.04
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils
sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
2. Download repo tool,
Code:
curl [url]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/url] > /tmp/repo
sudo mv /tmp/repo /usr/local/bin
export PATH=$PATH:/usr/local/bin
*******************************************************
Next: Get the source
*******************************************************
I have tried to build the source code from CyanogenMod for ICS version of Android and the device Samsung Galaxy S plus. (Already ported by Arco )
This example uses their repositories to download the code,
1. Get the android source code:
Code:
cd ~/work/cyanogenmod
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync
The repo sync command takes some time which depends on your internet connection speed.
2. The above commands download the generic source code. For creating the ROM for the device Galaxy S Plus, we need to use the Arco's repositories.
3. Create a local_manifest.xml in ~/work/cyanogenmod/.repo as follows
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="arco" fetch="https://github.com/arco"/>
<project path="device/samsung/ariesve" name="android_device_samsung_ariesve" revision="ics" remote="arco"/>
<project path="kernel/ariesve" name="samsung-kernel-ariesve" remote="arco" revision="ics"/>
<project path="vendor/samsung/ariesve" name="android_vendor_samsung_ariesve" remote="arco" revision="ics"/>
<project path="frameworks/base" name="android_frameworks_base" remote="arco" revision="ics" />
<project path="kernel/msm7x30" name="samsung-kernel-msm7x30" remote="arco" revision="ics-2.6.35" />
</manifest>
4. Perform repo sync.
Code:
repo sync
*******************************************************
Building Kernel
*******************************************************
It is not necessary to build kernel – the one Arco have build is already located in ~/work/cyanogenmod/device/samsung/ariesve/prebuilt.
But if you still want to do that by our own, you should do the next thing: Download running kernel's config from your dvevice, then ungzip it and
save it as ~/work/cyanogenmod/kernel/ariesve/.config
Code:
adb pull /proc/config.gz
cat config.gz | gunzip > ~/work/cyanogenmod/kernel/ariesve/.config
rm config.gz
After that you should declare cross-compiler path variable:
Code:
export CCOMPILER=~/work/cyanogenmod/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
Next step is to run
Code:
make oldconfig
Feel free to modify config, for example in ncurses gui:
Code:
make menuconfig
When you're done just execute
Code:
make ARCH=arm CROSS_COMPILE=$CCOMPILER -j5
where -j5 is number of your CPU cores+1;
When compile is over, the resulting zImage will be located in ~/work/cyanogenmod/kernel/ariesve/arch/arm/boot
As mentioned before, you should place it into ~/work/cyanogenmod/device/samsung/ariesve/prebuilt
So when kernel is ready, it's time for the greatest thing:
*******************************************************
Building CyanogenMod 9
*******************************************************
So when all the sources are downloaded, and (optional) kernel is built
let's start to build the CM.
First of all, download prebuilds:
Code:
~/work/cyanogenmod/vendor/cm/get-prebuilts
If you skipped kernel build chapter, please, export CCOMPILER
variable as mentioned there.
Next, edit file: ~/work/cyanogenmod/vendor/samsung/ariesve/device-vendorblobs.mk
and change “ancora” to “ariesve” on lines 25-28
and file ~/work/cyanogenmod/device/samsung/ariesve/BoardConfig.mk
and change “ancora” to “ariesve” on line 132.
The final part is actually building:
Code:
cd ~/work/cyanogenmod
bash
source build/envsetup.sh
lunch full_ariesve-eng
I wrote “bash” in the list of commands because envsetup.sh script
doesn't support some other shells.
Run the make command.
*******************************************************
Build issues.
*******************************************************
1. If you face an issue due to OverlayHtc.h file not found as below:
Code:
Notice file: hardware/libhardware_legacy/NOTICE -- out/target/product/ariesve/obj/NOTICE_FILES/src//system/lib/libpower.so.txt
Copy: out/target/product/ariesve/obj/lib/libaudioalsa.so
Copy: out/target/product/ariesve/obj/lib/libcamera.
target thumb C++: camera.msm7x30 <= device/samsung/ariesve/camerahal/cameraHAL.cpp
device/samsung/ariesve/camerahal/cameraHAL.cpp:31:27: error: ui/OverlayHtc.h: No such file or directory
Notice file: hardware/qcom/display/libcopybit/NOTICE -- out/target/product/ariesve/obj/NOTICE_FILES/src//system/lib/hw/copybit.msm7x30.so.txt
device/samsung/ariesve/camerahal/cameraHAL.cpp: In function 'camera_memory_t* wrap_memory_data(priv_camera_device_t*, const android::sp<android::IMemory>&)':
device/samsung/ariesve/camerahal/cameraHAL.cpp:268: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'ssize_t'
device/samsung/ariesve/camerahal/cameraHAL.cpp: In function 'int camera_set_preview_window(camera_device*, preview_stream_ops*)':
device/samsung/ariesve/camerahal/cameraHAL.cpp:488: error: invalid use of incomplete type 'struct android::eek:verlay'
device/samsung/ariesve/camerahal/CameraHardwareInterface.h:29: error: forward declaration of 'struct android::eek:verlay'
make: *** [out/target/product/ariesve/obj/SHARED_LIBRARIES/camera.msm7x30_intermediates/cameraHAL.o] Error 1
make: *** Waiting for unfinished jobs....
You need to get the fix by using following command:
Code:
cd ~/work/cyanogenmod/frameworks/base/ && git fetch [url]http://review.cyanogenmod.com/CyanogenMod/android_frameworks_base[/url] refs/changes/85/13285/8 && git cherry-pick FETCH_HEAD
(Thanks to the post on xda: http://forum.xda-developers.com/showthread.php?p=27475486#post27475486)
2. If you face an issue in compiling charger.c with following error:
Code:
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:958: error: undefined reference to 'gr_font_size'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:991: error: undefined reference to 'gr_fb_blank'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:699: error: undefined reference to 'gr_fb_blank'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:732: error: undefined reference to 'gr_fb_blank'
If you aren't afraid of doing some editing, grab the function "gr_fb_blank"(line 377) and "gr_font_size" (line 210) out of bootable/recovery/minui/graphics.c and paste them into device/samsung/crespo/graphics.c (at the end of the file, and at line 158, respectively) for now. Tested booting, and tested system off charging and both seem to be ok. I'm not gonna look at logs since nothing is acting wonky lol.
(Thanks to the post on xda: http://forum.xda-developers.com/showthread.php?t=1399035&page=676)
==================================================
Ref. threads:
http://forum.xda-developers.com/showthread.php?t=1650615
Nice, but I don't recommend to use the outdated framework/base repo by arco.
Instead I suggest to use the CM repo and do the following.
Needs to be done once
Code:
cd frameworks/base
git remote add arco git://github.com/arco/android_frameworks_base.git
git fetch arco
Needs to be done after every repo sync
Code:
git cherry-pick 748a5e5f70858e5f5f77c65b7c185ec980f821f5
git cherry-pick f6d9aa858cbcabb29c1f941e2e8f0672360985ba
git cherry-pick 1a3e62ddae28b3f871ced2c1d40a18c7d8a6ea7d
So you can use the CM9 repo with the necessary changes made by arco.
EDIT:
And the CODE-Tags will make your post better readable.
I think that unknown pdf file tutorial is of vpukin..
Sent from my GT-I9001 using Tapatalk 2
also this isnt needed to synch in manifest.xml
<project path="vendor/samsung/ancora" name="android_vendor_samsung_ancora" remote="arco" revision="ics"/>
Click to expand...
Click to collapse
it isnt i9001 related
texten said:
also this isnt needed to synch in manifest.xml
it isnt i9001 related
Click to expand...
Click to collapse
right.
"ancora" is Galaxy W I8150, arco's phone
...but...where is the sense of this thread? only a cm9 tutorial for...build another ones?
Good guide , But why is there a $ in front of each command ? , when i enter them it gives error
PS: You can surround all codes with CODE Tags
Thanks for suggestion.
I would update the guide with code tags.
what packages I need to download for ubuntu 12.04?[finded]
hemansan said:
2. Download repo tool,
Code:
curl [url]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/url] > /tmp/repo
sudo mv /tmp/repo /usr/local/bin
export PATH=$PATH:/usr/local/bin
Click to expand...
Click to collapse
one command is missing
Code:
sudo chmod +x /usr/local/bin/repo

Bulding any rom from source for your android device.

I'm using HTC One S and LiquidSmooth as examples. It should work for all devices. Nexus should be a little different story.
Do you know about a ROM that it's not builded for our beloved One S? Do you want to port it for our device? This easy guide will help you.
Requirements:
A One S.
A relatively recent computer (Linux, OS X, or Windows) w/a reasonable amount of RAM and about 35 GB of free storage. The less RAM you have, the longer the build will take. Using SSDs results in faster builds than traditional hard drives.
A micro USB cable.
A decent Internet connection & reliable electricity
Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with what a recovery image such as ClockworkMod is, for example. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.
​HERE IS THE GUIDE.
Installing Build Packages
Open the terminal and type: (for 64-bit&32-bit)
Code:
sudo apt-get install bison build-essential curl flex git-core gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev
In addition to the above, for 64-bit systems:
Code:
sudo apt-get install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Creating Directories
In order to start building ROMs you'll need to create some directories
Code:
mkdir -p ~/bin
mkdir -p ~/yourworkingdirectory
Installing the REPO command
Enter the following to download the "repo" binary:
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Now lets give this the proper permissions to make it runnable:
Code:
chmod a+x ~/bin/repo
Put the ~/bin directory in your path of execution
Make sure that the ~/bin directory you just created is in your path of execution so that you can easily run the repo command even when you're not in ~/bin.
Code:
export PATH=${PATH}:~/bin
Initialize the source repository
Code:
cd yourworkingdirectory
Now you'll need the repo init related to the rom you'd like to build. Here i will insert some of the I used. Anyway to find this you can go the rom's github and search for the manifest (android or platform-manifest).Just choose the right branch.
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
repo init -u git://github.com/LiquidSmooth/android.git -b kitkat
repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4-caf
repo init -u git://github.com/ChameleonOS/android.git -b kitkat-staging
Download the source code
This will download all the source code to your computer.Prepare to wait a long time while the source code downloads.
Code:
repo sync
Download device,kernel and vendor tree for Liquid
We will use CM ones. Thanks a lot.
Basically we need to add some projects to the download list. To do this we'll need a local_manifest.
Go in the .repo folder in your working directory(it's an hidden folder press ctrl+h). Create a new folder called "local manifests" then double click on it. Now you'll have to create a roomservice.xml file for the most of the ROMs and a slim_manifest.xml for SlimRoms, it's the same thing just the name it's different.
Open this file and paste this inside:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github"
fetch="git://github.com/" />
<project name="CyanogenMod/android_device_htc_ville" path="device/htc/ville" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_s4-common" path="device/htc/s4-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_msm8960" path="kernel/htc/msm8960" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>
Now give another:
Code:
repo sync
and wait.
Do some modifications to the .mk files
Since we are using CM device tree we need to modify them for the choosen ROM.
Go into the device folder(device/htc/ville) and do some modifications. I will explain you what i mean using LiquidSmooth as example.
1) Create a new file called vendorsetup.sh . Open it and inside you'll have to write a script to add it to the lunch list.
Code:
add_lunch_combo liquid_ville-userdebug
You can choose if you want an userdebug version of the rom or an eng one just by writing eng instead of userdebug.
2) Now rename cm.mk into liquid.mk(for other ROMs this file should be renamed in a different way. Use an existing device tree to see the correct naming.)
3) Open the .mk file. You'll find something like this:
Code:
# Release name
PRODUCT_RELEASE_NAME := ville
# Boot animation
TARGET_SCREEN_HEIGHT := 960
TARGET_SCREEN_WIDTH := 540
# Inherit some common CM stuff.
$(call inherit-product, vendor/cm/config/common_full_phone.mk)
# Inherit device configuration
$(call inherit-product, device/htc/ville/device_ville.mk)
# Device naming
PRODUCT_DEVICE := ville
PRODUCT_NAME := cm_ville
PRODUCT_BRAND := htc
PRODUCT_MODEL := One S
PRODUCT_MANUFACTURER := HTC
# Set build fingerprint / ID / Product Name ect.
PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=htc_ville BUILD_FINGERPRINT=htc_europe/ville/ville:4.1.1/JRO03C/128506.8:user/release-keys PRIVATE_BUILD
You need to modify some things to make it buildable:
Code:
# Inherit some common CM stuff.
$(call inherit-product, vendor/cm/config/common_full_phone.mk)
becomes:
Code:
# Inherit some common LiquidSmooth stuff.
$(call inherit-product, vendor/liquid/config/common_phone.mk)
To understand the changes you'll have to go in the vendor folder searching the rom specific vendor and open the config folder to see what .mk file you need.
This:
Code:
PRODUCT_NAME := cm_ville
becomes:
Code:
PRODUCT_NAME := liquid_ville
4) Now rename cm.dependencies in liquid.dependencies(SlimRoms does not require this step for unsupported devices.)
Start the build
Code:
source build/envsetup.sh
If you created the vendorsetup.sh in the right way you will read the ville folder.
Code:
lunch
Now you have to choose the number near the ville in the list of the supported devices.
If you have done all in the correct way in your terminal you'll see a page like this:
View attachment 2470228
Build
After lunching you have to start the build using the right command:
For liquid:
Code:
time mka liquid
For others:
Code:
make bacon
make
brunch devicename
Wait some time till the build ends hopefully with no errors.​
Credits: http://wiki.cyanogenmod.org/w/Build_for_ville
and all the experience i got in this 2 months of building.
For most ROMS you'll have some overlays errors.
Just go in the overlay folder linked in the error and open config.xml. Just delete the lines in the error or search in the folder history the commit that you have to revert.
To revert a commit:
Code:
cd intheinteressedfolder
git revert thenumberofthecommit
Here is a screenshot of the what the number/name of the commit is:
View attachment 2470242
Enjoy.
Edited the title. And added a repo init!

[GUIDE] How to port Bluez to Kitkat, Lollipop & Marshmallow

Introduction
When the bluetooth stack changed to Bluedroid in Android 4.2, it was a nightmare to some of the old devices like my GT-P6800. I didn't have any experience in Bluetooth before so I did what I know. I spent weeks to revert the 4.2 platform to Bluez. Even though I succeeded, it probably not doable for 4.3 and later.
Last Nov. I found that bluez.org announced support for Andriod in Sep. It gave me hope again! Thanks to the bluez team!:good: The principle is straight forward - Implement the functions defined in "hardware/libhardware/include/hardware/bluetooth.h". That's what I thought but I didn't have enough knowledge nor confidence to try...
After studying for a while, I started porting bluez to Android 4.4 last Christmas. It was frustrated and helpless. Although the lastest Android 4.4 example for Mako and Flo are out, they don't help much. A bunch of prebuilt kernel objects surely doesn't help! Porting for those devices already having bluedroid support is meaningless to most of us too...
Building the bluez hal and daemon are straight forward but how to make it really work is another story. After a few painful and frustrated weekends, I finally managed to pull everything together. I can start/stop and pairing bluetooth devices in the platform now. And here I'm, sharing my experiences. I think there might be better way and I welcome any corrections.
My p6800 has CSR bluetooth chip which has no bluedroid support. I think the same approach would work for other chips too. Cheers! :highfive:
** All paths assume your rom source dircetory to be the current directory **
1. Downlaod and Build
Bluez.org already has its own tutorial. I just summerize and list my suggestions.
1.1 local manifest
I learned my lesson and would avoid touching the "manifest.xml".
Add the following lines to your ".repo/local_manifests/local_menifest.xml"
For cm11, omni, etc.
Code:
<remote name="gcode" fetch="https://code.google.com/p/"/>
<remote name="korg" fetch="git://git.kernel.org/pub/scm/bluetooth/"/>
<remove-project name="android_external_bluetooth_bluedroid"/>
<project remote="korg" path="external/bluetooth/bluez" name="bluez" group="pdk" revision="master"/>
<project remote="korg" path="external/bluetooth/sbc" name="sbc" group="pdk" revision="master"/>
<project remote="gcode" path="external/bluetooth/glib" name="aosp-bluez.glib" group="pdk" revision="master"/>
For AOSP, replace the remove-project with:
Code:
<remove-project name="platform/external/bluetooth/bluedroid"/>
After repo sync, bluez will replace bluedroid.
1.2 patching bionic
The patches for bionic are simple. Mainly by adding two flags and the function epoll_create1().
Bionic may vary from ROMs. It is wiser to patch the bionic of your ROM manually. You may follow the changes of the two commits below:
https://code.google.com/p/aosp-blue...96020013615b00d70579123f&repo=platform-bionic
https://code.google.com/p/aosp-blue...3347746d0d9727d8439ef4c4&repo=platform-bionic
1.3 neccessary tools
There are tools in "external/bluetooth/bluez/tools". You may need some of those tools for setup or testing.
This is the "Android.mk" I added to "external/bluetooth/bluez/tools". You may cheery pick the required tools for your device.
Code:
#
# Bluetooth tools for setup and debug
# daniel_hk
LOCAL_PATH := external/bluetooth
# Retrieve BlueZ version from configure.ac file
BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/bluez/configure.ac | cpp -P -D'AC_INIT(_,v)=v')
# Specify pathmap for glib
#pathmap_INCL += glib:external/bluetooth/glib
# Specify common compiler flags
BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\" \
-DSTORAGEDIR=$(ANDROID_STORAGEDIR) \
# Disable warnings enabled by Android but not enabled in autotools build
BLUEZ_COMMON_CFLAGS += -Wno-pointer-arith -Wno-missing-field-initializers
# @ daniel, extra tools for CSR
ifeq ($(BOARD_HAVE_BLUETOOTH_CSR),true)
#
# bccmd
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
bluez/lib/hci.c \
bluez/lib/bluetooth.c \
bluez/tools/bccmd.c \
bluez/tools/csr.c \
bluez/tools/csr_3wire.c \
bluez/tools/csr_bcsp.c \
bluez/tools/csr_hci.c \
bluez/tools/csr_h4.c \
bluez/tools/csr_usb.c \
bluez/tools/ubcsp.c
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
LOCAL_C_INCLUDES:=\
$(LOCAL_PATH)/bluez \
$(LOCAL_PATH)/bluez/lib \
$(LOCAL_PATH)/bluez/tools \
$(LOCAL_PATH)/bluez/src \
$(LOCAL_PATH)/bluez/src/shared \
LOCAL_MODULE:=bccmd
include $(BUILD_EXECUTABLE)
#
# sdptool
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
bluez/lib/hci.c \
bluez/lib/bluetooth.c \
bluez/lib/sdp.c \
bluez/tools/sdptool.c \
bluez/src/sdp-xml.c
LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
LOCAL_C_INCLUDES:=\
$(LOCAL_PATH)/bluez \
$(LOCAL_PATH)/bluez/lib \
$(LOCAL_PATH)/bluez/tools \
$(LOCAL_PATH)/bluez/src \
$(LOCAL_PATH)/bluez/src/shared \
LOCAL_C_INCLUDES += \
$(call include-path-for, glib) \
$(call include-path-for, glib)/glib \
LOCAL_SHARED_LIBRARIES := \
libglib \
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE:=sdptool
include $(BUILD_EXECUTABLE)
endif
1.4 patches for CyanogenMod 11
In CyanogenMod 11, the function "pin_request_cb" has one more argument. The following file need some patches:
in the file "external/bluetooth/bluez/android/hal-bluetooth.c"
Code:
[I]** in function: handle_pin_request[/I]
bt_hal_cbacks->pin_request_cb(addr, name, ev->class_of_dev, 0); // @ daniel, added 0 for cm11
in the file "external/bluetooth/bluez/android/client/if-bt.c"
Code:
[I]** in function: pin_request_cb[/I]
static void pin_request_cb(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name,
uint32_t cod, uint8_t secure) // @ daniel, added secure from cm11
{
/* Store for command completion */
bt_bdaddr_t2str(remote_bd_addr, last_remote_addr);
pin_request_addr = *remote_bd_addr;
haltest_info("%s: remote_bd_addr=%s bd_name=%s cod=%06x secure=%02x\n", __func__,
last_remote_addr, bd_name->name, cod, secure); // @ daniel, added
terminal_prompt_for("Enter pin: ", pin_request_answer);
}
2. kerenl patch
In the "README" inside "external/bluetooth/bluez/android", there is the line:
Minimal required version of management interface is 1.3. This corresponds to Linux 3.9 but latest available version is recommended.
Click to expand...
Click to collapse
If you have tried porting bluez and fail, check the logcat. You might probably found the error "Failed to access management interface". This is the key making bluez to work! Sadly, most of the existing Android kernels are before ver. 3.9! The latest kernel we have might be ver. 3.4.x and the kernel for my p6800 is ver. 3.0.x! As the above line stated, Bluez5 requires the kernel to have management interface 1.3 or above. That means we have to backport the bluetooth subsystem from at least ver. 3.9. I backport my kernel with the latest (3.13-1) found in linux-foundation.org: http://drvbp1.linux-foundation.org/~mcgrof/rel-html/backports/
It was a tough and painful job! There are lots of changes. I finally got a bootable backport kernel in 2 days!
I packed my patches in View attachment kernel-3.0.x-backport-3.13-1.zip. This patch is for my 3.0.x kernel which might be different from other 3.0.x kernels. Don't have time to tidy up but it works for me. Although I've done the hard part, it still requires extra patience to get yours done. Prepare yourself...
2.1 Backport 3.13-1 to your kernel
Direct replacements.
Replace the following folders in the zip with the one in your kernel source:
drivers/bluetooth
net/bluetooth
include/net/bluetooth
include/backport​
Direct replacement might not work!
Check include/linux in the zip
For each file,
add the required part (which I delimited with comments @ daniel and //@ ) to the corresponding file in your kernel source.
If file not exist,
copy the files to your kernel source​
Check your defconfig. As README suggested, defconfig should have:
CONFIG_BT
CONFIG_BT_RFCOMM
CONFIG_BT_RFCOMM_TTY
CONFIG_BT_BNEP
CONFIG_BT_BNEP_MC_FILTER
CONFIG_BT_BNEP_PROTO_FILTER
CONFIG_BRIDGE
CONFIG_UHID
# and for CSR chips
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y​
You probably need to compile the kernel many times to get it work. I worte a build script View attachment build-k.zip to compile the kernel only.
Copy build-k to your ROM source directory and type:
Code:
./build-k <your device>
2.2 Backport-hid-generic to your kernel
There is another patch in the Mako-kern example:
https://code.google.com/p/aosp-blue...eneric-driver.patch?repo=device-lge-mako-kern
Don't know if it is required for your kernel but adding this patch seems doesn't hurt.
If you do it right, you may find "Bluetooth management interface 1.4" in your logcat. Congratulation! Bluetoothd can connect to your kernel now!
3. initialization and setup
Take a look at your devices tree's TARGET_CUSTOM_BLUEDROID definition. If you have a file assigned, it supposed to replace the file "bluetooth.c" in the "system/bluetooth" project. In Android 4.4, this project is no longer exist/needed. Before Android 4.2, this project provide the functions "bt_enable()" and "bt_disable()" which are called in the frameworks. These functions will tell you how to "power on", "power off" and init your device's Bluetooth chip.
For CSR:
set /sys/class/rfkill/rfkill0/state to 1 ("power on")
start the service "bccmd" which will setup the chip and upload a PSConfig to the chip
start the service "hciattach" which init the port hci0 with parameters
start the service "bluetoothd" which is the bluez stack
The services are defined in init.rc or init.${ro.hardware}.rc.
3.1 Test your device and the tools
Disable the "import init.bluetooth.rc" line if you have added it before.
Example for CSR chips. Follow the steps in bt_enable. In a terminal or via adb:
Code:
$ su -- [I][COLOR="SeaGreen"]root user is required[/COLOR][/I]
# echo "1" > /sys/class/rfkill/rfkill0/state
# bccmd -t bcsp -d /dev/ttySAC0 -b 115200 psload -r /system/etc/PSConfig_8811.psr
Loading 0x212c ... done
Loading 0x212d ... done
...
Loading PSKEY_CLOCK_REQUEST_ENABLE ... done
Loading PSKEY_UART_HOST_WAKE ... done
# hciattach -p /dev/ttySAC0 bcsp 3000000 flow
Device setup complete
# hciconfig hci0 up
# hcitool scan -- [I][COLOR="SeaGreen"]turn on a device's bluetooth for testing[/COLOR][/I]
Nexus 4 -- [I][COLOR="SeaGreen"]found the device means bluetooth is working now[/COLOR][/I]
3.2 Init sequence
In Bluez5, the HAL (bluetooth.default.so) driver will be loaded at boot and the daemon (bluetoothd) will be started inside too. Take a look at the function "bool hal_ipc_init(void)" in "external/bluetooth/bluez/android/hal-ipc.c". You may find how the HAL is init which is different from pre-4.2 Androids.
In order to get the daemon (bluetoothd) to work, we have to init the chip before that.
I worte a shell script init.bt.sh to init the chip/port:
Code:
#!/system/bin/sh
# modified by daniel_hk
LOG_TAG="CSR8811-HCI"
BTUART_PORT=/dev/ttySAC0
BTSTATE=/sys/class/rfkill/rfkill0/state
PSCONFIG=/system/etc/PSConfig_8811.psr
logi ()
{
/system/bin/log -t $LOG_TAG -p i ": [email protected]"
}
loge ()
{
/system/bin/log -t $LOG_TAG -p e ": [email protected]"
}
failed ()
{
loge "$1: exit code $2"
exit $2
}
#Enable power of csr chip
echo "1" > $BTSTATE
# PS Config with bccmd
logwrapper /system/bin/bccmd -t bcsp -d $BTUART_PORT -b 115200 psload -r $PSCONFIG
case $? in
0) logi "bccmd init port....done";;
*) failed "port: $BTUART_PORT - bccmd failed" $?;
exit $?;;
esac
# attach HCI
logwrapper /system/bin/hciattach -p $BTUART_PORT bcsp 3000000 flow
case $? in
0) logi "hci attached to : $BTUART_PORT";;
*) failed "port: $BTUART_PORT - hciattach failed" $?;
exit $?;;
esac
exit 0
It takes time for bccmd and hciattach to complete. Putting them in seperate services requires delay in between. I think it is better to run them as application one after one.
A new rc file init.${ro.hardware}.bt.rc is created and need to be imported in your init.${ro.hardware}.rc
Code:
on boot
start bt_init
on property:init.svc.bluetoothd=running
start hci0_up
on property:init.svc.bluetoothd=stopped
start hci0_down
service bt_init /system/bin/logwrapper /system/bin/sh /system/etc/init.bt.sh
class main
user root
group bluetooth net_bt_admin system
disabled
oneshot
service hci0_up /system/bin/logwrapper /system/xbin/hciconfig hci0 up
class main
group bluetooth
disabled
oneshot
service hci0_down /system/bin/logwrapper /system/xbin/hciconfig hci0 down
class main
group bluetooth
disabled
oneshot
import init.bluetooth.rc
Since HAL (bluetooth.default.so) is started quite early, I start the service bt_init at boot. I have tried a few places, daemon might timed out before bt_init finish. It also seems no need to repeat the init process everytime.
When bluetoothd is running (system/core/init will set the property init.svc.bluetoothd=running), set hci0 up with hciconfig. And when the service bluetoothd is stopped, set hci0 down with hciconfig. There might be a better way. Please indulge me if something better coming up.
You may turn ON/OFF bluetooth in settings now. Pairing and file transfer is working too.
4. Further porting
Take a look at the function get_profile_interface() in the file external/bluetooth/bluez/android/hal-bluetooth.c. Some interfaces which frameworks requested are missing.
eg. Bluetooth Handsfree interface
Bluetooth Map Client Interface
Bluetooth Health Interface
Bluetooth GATT Interface​Update: Fully support for Kitkat now. Check the README inside the android folder for detail.
As I mentioned before, I'm new to bluetooth. Further reading is required for me to fix other services. I also don't have enough time now. I have to process the stuck works after the Chinese New Year holiday. :cyclops: Hoping I can continue by the end of Feb. In the mean time, I hope someone have better knowledge may help fix other services.
For those devices don't have bluedroid support, we have a chance to carry on now!
[GUIDE] Porting Bluez to Marshmallow
Check the modified Bluez in my github.
It has been tested with Omni6 (Android-6.0.1_r3)
You have to remove system_bt in local_manifest.xml (similar to bluedroid, check post #1 for detail)
CM needs extra modifications. Will be available after testing.
Nice , Xperia Novathor devs also working on stable bluez 
 @95A31
Nice guide In CM11 you need also revert this https://github.com/CyanogenMod/andr...mmit/763c68d048d268bd931dffa72000f52830ffe2d8
95A31 said:
Nice guide In CM11 you need also revert this https://github.com/CyanogenMod/andr...mmit/763c68d048d268bd931dffa72000f52830ffe2d8
Click to expand...
Click to collapse
Thanks! Patch in section 1.4 is another alternative for cm11.
daniel_hk said:
Thanks! Patch in section 1.4 is another alternative for cm11.
Click to expand...
Click to collapse
Wops my fault :silly:, you have right
although i dont have my previous device which has csr chip..but those still have csr will get greatly benefited ..your work is incredible......god bless u!!!
keep the good work!!!
static void pin_request_cb is defined in external/bluetooth/bluez/android/client/if-bt.c
95A31 said:
static void pin_request_cb is defined in external/bluetooth/bluez/android/client/if-bt.c
Click to expand...
Click to collapse
yeah, it is also defined in if-bt.c but if you check android/Android.mk, only haltest use it. If you want to build haltest, you need to change if-bt.c too.
Take a look the file android/Android.mk which is the make file for android. bluetooth.default.so which cm11 refered to, use the definition in hal-bluetoth.c.
Sent from my Nexus 7 using Tapatalk
daniel_hk said:
yeah, it is also defined in if-bt.c but if you check android/Android.mk, only haltest use it. If you want to build haltest, you need to change if-bt.c too.
Take a look the file android/Android.mk which is the make file for android. bluetooth.default.so which cm11 refered to, use the definition in hal-bluetoth.c.
Sent from my Nexus 7 using Tapatalk
Click to expand...
Click to collapse
Forgot my unknowledge/newbie but I can not find it in hal-bluetoth.c (In BLueZ git)
95A31 said:
Forgot my unknowledge/newbie but I can not find it in hal-bluetoth.c (In BLueZ git)
Click to expand...
Click to collapse
It's in the android folder. In the same place as Android.mk.
If you can't find inside the file, you might have the old version. Try include the project in manifest and sync again.
I have a suggested local_manifest in post #1.
Good luck!
Sent from my Nexus 7 using Tapatalk
daniel_hk said:
It's in the android folder. In the same place as Android.mk.
Sent from my Nexus 7 using Tapatalk
Click to expand...
Click to collapse
I mean in hal-bluetooth.c, can you tell me the line in this version ot the file? (I know that it is a retarded question but I really can find other occurences of pin_request_cb outside handle_pin_request function) I am working on BlueZ git so I am working on lastest version
95A31 said:
I mean in hal-bluetooth.c, can you tell me the line in this version ot the file? (I know that it is a retarded question but I really can find other occurences of pin_request_cb outside handle_pin_request function) I am working on BlueZ git so I am working on lastest version
Click to expand...
Click to collapse
All the changes are listed in post#1.
In line 239 of you link, there is the line:
bt_hal_cbacks->pin_request_cb(addr, name, ev->class_of_dev);
It is a callback. The definition is in cm11 which had changed. That's why we have to add one more argument. (or revert the cm11 commit as you said)
The definition if-bt.c which is a client, is for testing. It has to define the callback which is required in int. Got it?
daniel_hk said:
All the changes are listed in post#1.
In line 239 of you link, there is the line:
bt_hal_cbacks->pin_request_cb(addr, name, ev->class_of_dev);
It is a callback. The definition is in cm11 which had changed. That's why we have to add one more argument. (or revert the cm11 commit as you said)
The definition if-bt.c which is a client, is for testing. It has to define the callback which is required in int. Got it?
Click to expand...
Click to collapse
Get it :good:
Ok, I have a nice bootloop: http://pastebin.com/QcZbEkfx Guys some ideas ?
95A31 said:
Ok, I have a nice bootloop: http://pastebin.com/QcZbEkfx Guys some ideas ?
Click to expand...
Click to collapse
I have checked your logcat. There is no management interface log. The kernel backport on blietooth subsystem is probably failed.
Sent from my Nexus 7 using Tapatalk
daniel_hk said:
I have checked your logcat. There is no management interface log. The kernel backport on blietooth subsystem is probably failed.
Sent from my Nexus 7 using Tapatalk
Click to expand...
Click to collapse
I foud this dependence in my case: WLAN init need that BT chip is initialized because WLAN ask clock to BT. The intoduction of import init.bluetooth.rc broke this dependence. Fu*king details :cyclops: I hope to save debug time to someone
Thanks, very helpful guide. Following this I was able to get BlueZ working on MSM7x27a. However, instead of dropping the backport sources in the kernel tree I followed this documentation to build the backports as external modules, which looks like a cleaner way to me. This requires building the kernel without BT (and, in cases like this, patching the source to remove some dependencies on built-in BT). This leaves the kernel sources (mostly) untouched, and makes adapting the backport sources easier because you can separately build the modules without doing a full kernel build.
The modules can then be built like this:
Code:
# clean output files
make -C kernel/backports ARCH=arm CROSS_COMPILE="arm-eabi-" KLIB=$OUT/obj/KERNEL_OBJ KLIB_BUILD=$OUT/obj/KERNEL_OBJ mrproper
# configure
make -C kernel/backports ARCH=arm CROSS_COMPILE="arm-eabi-" KLIB=$OUT/obj/KERNEL_OBJ KLIB_BUILD=$OUT/obj/KERNEL_OBJ menuconfig
# build
make -C kernel/backports ARCH=arm CROSS_COMPILE="arm-eabi-" KLIB=$OUT/obj/KERNEL_OBJ KLIB_BUILD=$OUT/obj/KERNEL_OBJ
jjm34 said:
Thanks, very helpful guide. Following this I was able to get BlueZ working on MSM7x27a. However, instead of dropping the backport sources in the kernel tree I followed this documentation to build the backports as external modules, which looks like a cleaner way to me. This requires building the kernel without BT (and, in cases like this, patching the source to remove some dependencies on built-in BT). This leaves the kernel sources (mostly) untouched, and makes adapting the backport sources easier because you can separately build the modules without doing a full kernel build.
The modules can then be built like this:
Code:
# clean output files
make -C kernel/backports ARCH=arm CROSS_COMPILE="arm-eabi-" KLIB=$OUT/obj/KERNEL_OBJ KLIB_BUILD=$OUT/obj/KERNEL_OBJ mrproper
# configure
make -C kernel/backports ARCH=arm CROSS_COMPILE="arm-eabi-" KLIB=$OUT/obj/KERNEL_OBJ KLIB_BUILD=$OUT/obj/KERNEL_OBJ menuconfig
# build
make -C kernel/backports ARCH=arm CROSS_COMPILE="arm-eabi-" KLIB=$OUT/obj/KERNEL_OBJ KLIB_BUILD=$OUT/obj/KERNEL_OBJ
Click to expand...
Click to collapse
Yeah! Yours seems better. I was messing with the kernel for a while before backport. Traditional backport kill my WiFi so I did what I knew. I will try yours later.
Any other success would be cheerful.
Sent from my Nexus 7 using Tapatalk
Sucessfully ported on CyanogenMod 11.0 git (using Bluetooth from AOSP).
HOWTO:
Remove CyanogenMod Bluetooth and grab AOSP version by local_manifest:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="kernel"
fetch="git://git.kernel.org/pub/scm/" />
<remote name="googlecode"
fetch="https://code.google.com/" />
<remove-project name="CyanogenMod/android_external_bluetooth_bluedroid" />
<project remote="kernel" path="external/bluetooth/bluez" name="bluetooth/bluez" groups="pdk" revision="master" />
<project remote="kernel" path="external/bluetooth/sbc" name="bluetooth/sbc" groups="pdk" revision="master" />
<project remote="googlecode" path="external/bluetooth/glib" name="p/aosp-bluez.glib" groups="pdk" revision="master" />
<remove-project name="CyanogenMod/android_packages_apps_Bluetooth" />
<remove-project name="CyanogenMod/android_packages_apps_BluetoothExt" />
<project path="packages/apps/Bluetooth" name="platform/packages/apps/Bluetooth" remote="aosp" revision="refs/tags/android-4.4.2_r1" />
<project path="aosp/packages/apps/Settings" name="platform/packages/apps/Settings" remote="aosp" revision="refs/tags/android-4.4.2_r1" />
<project path="aosp/frameworks/base" name="platform/frameworks/base/" remote="aosp" revision="refs/tags/android-4.4.2_r1" />
<project path="aosp/hardware/libhardware" name="platform/hardware/libhardware/" remote="aosp" revision="refs/tags/android-4.4.2_r1" />
</manifest>
Replace CyanogenMod Bluetooth system with AOSP one:
Code:
rm cm-11.0/hardware/libhardware/include/hardware/bluetooth.h
cp aosp/hardware/libhardware/include/hardware/bluetooth.h cm-11.0/hardware/libhardware/include/hardware/bluetooth.h
rm -rf cm-11.0/frameworks/base/core/java/android/bluetooth
cp -r aosp/frameworks/base/core/java/android/bluetooth cm-11.0/frameworks/base/core/java/android
rm cm-11.0/frameworks/base/services/java/com/android/server/BluetoothManagerService.java
cp aosp/frameworks/base/services/java/com/android/server/BluetoothManagerService.java cm-11.0/frameworks/base/services/java/com/android/server/BluetoothManagerService.java
rm -rf cm-11.0/packages/apps/Settings/src/com/android/settings/bluetooth
cp -r aosp/packages/apps/Settings/src/com/android/settings/bluetooth cm-11.0/packages/apps/Settings/src/com/android/settings
Adapt CyanogenMod with this changes:
Code:
diff --git a/frameworks/base/Android.mk b/frameworks/base/Android.mk
index 91338ef..43a87ef 100644
--- a/frameworks/base/Android.mk
+++ b/frameworks/base/Android.mk
@@ -88,10 +88,8 @@ LOCAL_SRC_FILES += \
core/java/android/wipower/IWipower.aidl \
core/java/android/wipower/IWipowerManagerCallback.aidl \
core/java/android/bluetooth/IBluetooth.aidl \
- core/java/android/bluetooth/IQBluetooth.aidl \
core/java/android/bluetooth/IBluetoothA2dp.aidl \
core/java/android/bluetooth/IBluetoothCallback.aidl \
- core/java/android/bluetooth/IQBluetoothAdapterCallback.aidl \
core/java/android/bluetooth/IBluetoothHeadset.aidl \
core/java/android/bluetooth/IBluetoothHeadsetPhone.aidl \
core/java/android/bluetooth/IBluetoothHealth.aidl \
@@ -100,18 +98,12 @@ LOCAL_SRC_FILES += \
core/java/android/bluetooth/IBluetoothPan.aidl \
core/java/android/bluetooth/IBluetoothManager.aidl \
core/java/android/bluetooth/IBluetoothManagerCallback.aidl \
- core/java/android/bluetooth/IQBluetoothManagerCallback.aidl \
core/java/android/bluetooth/IBluetoothPbap.aidl \
core/java/android/bluetooth/IBluetoothMap.aidl \
core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \
- core/java/android/bluetooth/IBluetoothHandsfreeClient.aidl \
- core/java/android/bluetooth/IBluetoothHidDevice.aidl \
- core/java/android/bluetooth/IBluetoothHidDeviceCallback.aidl \
core/java/android/bluetooth/IBluetoothGatt.aidl \
core/java/android/bluetooth/IBluetoothGattCallback.aidl \
core/java/android/bluetooth/IBluetoothGattServerCallback.aidl \
- core/java/android/bluetooth/IBluetoothSap.aidl \
- core/java/android/bluetooth/IBluetoothDun.aidl \
core/java/android/content/IClipboard.aidl \
core/java/android/content/IContentService.aidl \
core/java/android/content/IIntentReceiver.aidl \
@@ -407,7 +399,6 @@ aidl_files := \
frameworks/base/core/java/com/android/internal/view/IInputMethodClient.aidl \
frameworks/base/core/java/com/android/internal/view/IInputMethodManager.aidl \
frameworks/base/core/java/com/android/internal/view/IInputMethodSession.aidl \
- frameworks/base/core/java/android/bluetooth/BluetoothLEServiceUuid.aidl \
frameworks/base/graphics/java/android/graphics/Bitmap.aidl \
frameworks/base/graphics/java/android/graphics/Rect.aidl \
frameworks/base/graphics/java/android/graphics/Region.aidl \

How To Compile Rom From Source full guide step by step by Jai Sharma

How To Compile Rom From Source
We need following things to compile ROM from source
A Computer( Linux or Mac)
Java JDK
Some required Package for building Rom
Rules for Accessing USB devices
Choosing a Branch
Installing Java on the Machine
Here i am using Ubuntu(14.04 LTS) as a Linux machine but it should work for other Linux variant
Open a terminal and type following
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
This command will remove other existing openjdk installation
2. Once java is uninstalled use following command for installing correct version of java
sudo apt-get update
sudo apt-get install openjdk-s8-jdk
Check java version by typing following command
java -version
2. Installing some required packages
Type following in terminal to install some required packages
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 ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
3. Downloading Repo Tool and setting PATH
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now open the bashrc file and so we can include the repo tool:
sudo nano ~/.bashrc
Add following in the end of the file
export PATH=~/bin:$PATH
Now we need to reload bash variables to include the new path:
source ~/.bashrc
4. Initializing a Repo client
Now we need to create a directory where our source code will be downloaded. I am creating a directory AOSP here
mkdir AOSP
cd AOSP
In the following command insert your name and email address
git config --global user.name "Your_Name"
git config --global user.email "Your_EMail"
Now care fully select your branch whether you are downloading aosp or Cyanogenmod
repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.0_r7
type your desired branch name after the -b. This also applies to Cyanogenmod
5. Downloading source code
Now start downloading source code by typing following
repo sync
Note: this may take some time depending upon your internet speed and also please make sure you have enough storage
6. Configuring USB Access
type your username in following command and type enter
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
7. Now building Rom for your device
To build rom we need following
Device tree
Vendor tree
kernel
Finding device tree and Vendor Tree
To find your device tree search on Github or similar sources with your device code name. If you are lucky you will find it there and believe me it is the easiest way to build your rom rather than creating device tree and vendor tree from scratch
Your device tree will go on following location
device/device_manufacturer_name/device_codename
Same for vendor tree
vendor/device_manufacturer_name/device_codename
If you find device tree and vendor tree then how to download it
For device tree
git clone “Github url” -b (branch_tag) device/device_manufacturer_name/device_codename
2. For vendor tree
git clone “Github url” -b (branch_tag) vendor/device_manufacturer_name/device_codename
Note1: You may need to change some files if everything is not working or giving you some error in rom compiling. Look into output to find out error. You can use Google if you can't correct it
Note2: You may be not found your device tree and vendor tree then what to do?. You may need to create them. Please follow my guide
Creating Device tree and vendor tree from scratch
For creating device tree
http://azodik.com/how-to-create-device-tree-for-android-rom-building/
2. For creating Vendor tree
“Coming Soon”
Kernel
For kernel part if you are lucky than you can find your kernel source from Github or similar sources. If not you can use your prebuilt kernel Foolow this to extract your kernel http://azodik.com/how-to-create-device-tree-for-android-rom-building/
Kernel location
/kernel/device_manufacturer_name/device_codename
Downloading your kernel
Manually download it and extract to kernel location or use following command
git clone “Github url” kernel/device_manufacturer_name/device_codename
Note1: You can use your prebuilt kernel. To use your prebuilt kernel edit BoardConfig.mk file in your device tree.
Note2: If you created device tree from scratch following my guide. Use of prebuilt kernel set to default
How to build
Use following command for building your rom
Source build/envsetup.sh
lunch
Now select your device from menu
3. make or mka
I hope you found it usefull. Please follow my website for interesting guide. Please comment here if you face any error.
Thank You
Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective
sohamsen said:
Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective
Click to expand...
Click to collapse
Thank you very much. Sure i will post soon.
jai44 said:
Thank you very much. Sure i will post soon.
Click to expand...
Click to collapse
Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks
thanks
elanglangit said:
Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks
Click to expand...
Click to collapse
You can follow this guide. Read it again and again. I hope soon you will build your own Rom. You can comment here if you face any problem
While compiling pure nexus. I got this error. How to solve thishttp://cloud.tapatalk.com/s/589b479597bc0/tapatalk_1486571095280.jpeg?
@jai44 wow! you make it look so easy! :') I have subscribed to this thread. When I get free time, Ill build my own rom
Thank you so much!
not able to sync rr source...
After i type repo sync it doesnt do anything. I double checked my site direction and it appears to be fine. Any hints??
could you please spare some time and make a post about how to create vendor tree?
can anyone help with this error while porting dotos rom for lenovo a700
/home/ubuntu/android/dotos/out/build-dot_aio_row.ninja is missing, regenerating...
device/lenovo/aio_row/board/ril.mk:4: error: cannot assign to readonly variable: PRODUCT_PROPERTY_OVERRIDES
10:14:07 ckati failed with: exit status 1
and ril.mk script
# RIL
BOARD_PROVIDES_RILD := true
BOARD_RIL_CLASS := ../../../device/lenovo/aio_row/ril
PRODUCT_PROPERTY_OVERRIDES += ro.telephony.sim.count=2
Hy I'm building lineage os 14.1 for SM-J250F
Samsung Galaxy J2 Pro 2018 (SM-J250F) but im not going to giveup .. so I'm started to build roms my self .. fixed some build errors and successfully compiled but it stuck on Samsung logo(no bootanimation) also took pstore logs but it only store recovery logs .. sir can you please help to make it boot? Can u kindly tell me what changes i need to do in sources to make it boot? Or can u fix the issue in my tree? Please I'm hoping your feedback
Source android base : Android 7.1.1
Tried compilation : Lineage OS 14.1
I cant post my tree links due to new account please pm
jai44 said:
How To Compile Rom From Source
We need following things to compile ROM from source
A Computer( Linux or Mac)
Java JDK
Some required Package for building Rom
Rules for Accessing USB devices
Choosing a Branch
Installing Java on the Machine
Here i am using Ubuntu(14.04 LTS) as a Linux machine but it should work for other Linux variant
Open a terminal and type following
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
This command will remove other existing openjdk installation
2. Once java is uninstalled use following command for installing correct version of java
sudo apt-get update
sudo apt-get install openjdk-s8-jdk
Check java version by typing following command
java -version
2. Installing some required packages
Type following in terminal to install some required packages
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 ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
3. Downloading Repo Tool and setting PATH
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now open the bashrc file and so we can include the repo tool:
sudo nano ~/.bashrc
Add following in the end of the file
export PATH=~/bin:$PATH
Now we need to reload bash variables to include the new path:
source ~/.bashrc
4. Initializing a Repo client
Now we need to create a directory where our source code will be downloaded. I am creating a directory AOSP here
mkdir AOSP
cd AOSP
In the following command insert your name and email address
git config --global user.name "Your_Name"
git config --global user.email "Your_EMail"
Now care fully select your branch whether you are downloading aosp or Cyanogenmod
repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.0_r7
type your desired branch name after the -b. This also applies to Cyanogenmod
5. Downloading source code
Now start downloading source code by typing following
repo sync
Note: this may take some time depending upon your internet speed and also please make sure you have enough storage
6. Configuring USB Access
type your username in following command and type enter
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
7. Now building Rom for your device
To build rom we need following
Device tree
Vendor tree
kernel
Finding device tree and Vendor Tree
To find your device tree search on Github or similar sources with your device code name. If you are lucky you will find it there and believe me it is the easiest way to build your rom rather than creating device tree and vendor tree from scratch
Your device tree will go on following location
device/device_manufacturer_name/device_codename
Same for vendor tree
vendor/device_manufacturer_name/device_codename
If you find device tree and vendor tree then how to download it
For device tree
git clone “Github url” -b (branch_tag) device/device_manufacturer_name/device_codename
2. For vendor tree
git clone “Github url” -b (branch_tag) vendor/device_manufacturer_name/device_codename
Note1: You may need to change some files if everything is not working or giving you some error in rom compiling. Look into output to find out error. You can use Google if you can't correct it
Note2: You may be not found your device tree and vendor tree then what to do?. You may need to create them. Please follow my guide
Creating Device tree and vendor tree from scratch
For creating device tree
http://azodik.com/how-to-create-device-tree-for-android-rom-building/
2. For creating Vendor tree
“Coming Soon”
Kernel
For kernel part if you are lucky than you can find your kernel source from Github or similar sources. If not you can use your prebuilt kernel Foolow this to extract your kernel http://azodik.com/how-to-create-device-tree-for-android-rom-building/
Kernel location
/kernel/device_manufacturer_name/device_codename
Downloading your kernel
Manually download it and extract to kernel location or use following command
git clone “Github url” kernel/device_manufacturer_name/device_codename
Note1: You can use your prebuilt kernel. To use your prebuilt kernel edit BoardConfig.mk file in your device tree.
Note2: If you created device tree from scratch following my guide. Use of prebuilt kernel set to default
How to build
Use following command for building your rom
Source build/envsetup.sh
lunch
Now select your device from menu
3. make or mka
I hope you found it usefull. Please follow my website for interesting guide. Please comment here if you face any error.
Thank You
Click to expand...
Click to collapse
how much storage is used to sync sir?
BryanHafidz said:
how much storage is used to sync sir?
Click to expand...
Click to collapse
depend on rom for me los17 took almost 70gb

Categories

Resources