I’ve talked about how to compile Android variants before, and for the most part, it works the same no matter what variant you build. One caveat to that, however, is OmniRom. When I setup to build OmniRom 6.0.1, I have to set it up differently than the other builds that I do. It took me a while to figure it out (probably because I’m not very smart), so I thought I would share my findings with others, in the event that they couldn’t figure it out either.
So I want to compile OmniRom 6.0.1 for my Samsung Galaxy S4 T-Mobile phone (SGH-M919, JFLTETMO). God has graciously enabled me to build other roms for this phone, and I thought that it would be pretty straightforward to build the ol’ trusty OmniRom. Was I ever wrong! The setup was not intuitive and was unlike the setup for LiquidSmooth, AOKP, CM, PAC, and so forth. So here is what I did, and perhaps by looking at that, if you have the same problem you can fix it too.
Of course, you need to set up your compile environment by getting all the right programs and tools to run the compiler. I have already done this on my machine, but here is how you can do that too:
[CODE]
$ sudo apt-get install bison build-essential bzip2 curl dpkg-dev flex g++-multilib git git-review gnupg gperf lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev openjdk-7-jdk libbz2-1.0 libbz2-dev libc6-dev libghc-bzlib-dev libgl1-mesa-dev libgl1-mesa-glx:i386 libncurses5-dev libreadline6-dev libreadline6-dev:i386 libx11-dev:i386 libxml2-utils lzop maven pngcrush pngquant python-markdown schedtool squashfs-tools tofrodos x11proto-core-dev xsltproc zip zlib1g-dev zlib1g-dev:i386
[/CODE]
This will take a while. Once it is done, do this:
[CODE]
$ mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
$ gedit ~/.bashrc
[/CODE]
Now you should see gedit open up your .bashrc file, to which you should add this at the very end, and save it:
[CODE]
export PATH=~/bin:$PATH
[/CODE]
Now you need to close your terminal and open a new one to get the PATH variables to stick. Actually, it wouldn’t hurt to reboot your system after installing all of those programs we just installed. Your computer should now be primed and ready to go.
So once that is done, you can now get started. First things first, I downloaded the source:
[CODE]
$ cd ~
$ mkdir omni6
$ cd omni6
$ repo init -u git://github.com/omnirom/android.git -b android-6.0
$ repo sync
[/CODE]
As I have pointed out before, this sync takes a long time to download the files. We are talking about 10+ GB of files, so it will depend on your internet connection, but that is a lot of source code!
Next, I download the device trees, kernel source, and vendor blobs. You could choose any source for these that you want, CyanogenMod’s source is usually pretty good. AOKP, Slimroms, and others have trees available also. One group that has been less of a hassle to borrow trees from is DU, and here is how you can do that:
[CODE]
$ cd ~/omni6/
$ cd device
$ mkdir samsung
$ cd samsung
$ git clone https://github.com/DirtyUnicorns/android_device_samsung_jfltetmo -b m-caf jfltetmo
$ git clone https://github.com/DirtyUnicorns/android_device_samsung_jf-common -b m-caf jf-common
$ git clone https://github.com/DirtyUnicorns/android_device_samsung_msm8960-common -b m-caf msm8960-common
$ git clone https://github.com/DirtyUnicorns/android_device_samsung_qcom-common -b m-caf qcom-common
$ cd ..
$ git clone https://github.com/DirtyUnicorns/android_device_qcom_common -b m-caf qcom-common
$ mkdir qcom
$ cd qcom
$ git clone https://github.com/DirtyUnicorns/android_device_qcom_sepolicy -b m-caf sepolicy
$ cd ~/omni6/
$ mkdir -p kernel/samsung
$ cd kernel/samsung
$ git clone https://github.com/DirtyUnicorns/android_kernel_samsung_jf -b m-caf jf
$ cd ~/omni6/vendor/
$ git clone https://github.com/TheMuppets/proprietary_vendor_samsung -b cm-13.0 samsung
[/CODE]
Now you have all of the kernel source for the JFLTETMO/JF cell phones, and you have the device trees and vendor blobs to match! But if you run the build commands now, it will simply error out stating that it cannot find “omni_jfltetmo” and ask you if you have the right repo manifest. So here is what we need to do to make the Dirty Unicorn trees buildable in OmniRom: go to the omni6/device/samsung/jfltetmo folder and rename du.dependencies to omni.dependencies. Now open the file and edit it to say this:
[CODE]
[
]
[/CODE]
Yes, I realize that says nothing. But the file is needed and must be a valid file with those brackets in it. Now rename du.mk to omni_jfltetmo.mk and edit it like so:
[CODE]
$(call inherit-product, device/samsung/jfltetmo/full_jfltetmo.mk)
# Enhanced NFC
# WJH not present in omni $(call inherit-product, vendor/omni/config/nfc_enhanced.mk)
# Inherit some common DU stuff.
$(call inherit-product, vendor/omni/config/common.mk)
PRODUCT_BUILD_PROP_OVERRIDES += \
PRODUCT_NAME=jfltetmo \
TARGET_DEVICE=jfltetmo \
BUILD_FINGERPRINT=”samsung/jfltetmo/jfltetmo:4.4.4/KTU84P/M919UVUFNK2:user/release-keys” \
PRIVATE_BUILD_DESC=”jfltetmo-user 4.4.4 KTU84P M919UVUFNK2 release-keys”
PRODUCT_NAME := omni_jfltetmo
PRODUCT_DEVICE := jfltetmo
[/CODE]
Now make a new file called AndroidProducts.mk and put this in it:
[CODE]
#
# Copyright (C) 2011 The Android Open-Source Project
#
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/omni_jfltetmo.mk
[/CODE]
Now your trees are “pruned” and ready for a build! Let’s give it a try:
First Run:
[CODE]
omni6$ . build/envsetup.sh
including sdk/bash_completion/adb.bash
omni6$ brunch jfltetmo
WARNING: Trying to fetch a device that’s already there
found the jfltetmo device repo
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.1
TARGET_PRODUCT=omni_jfltetmo
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=krait
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.16.0-73-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=MOB30M
OUT_DIR=/home/alaskalinuxuser/Documents/projects/phones/compile/omni6/out
============================================
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.1
TARGET_PRODUCT=omni_jfltetmo
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=krait
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.16.0-73-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=MOB30M
OUT_DIR=/home/alaskalinuxuser/Documents/projects/phones/compile/omni6/out
============================================
including ./abi/cpp/Android.mk …
<<<<<<<<<<EDITED FOR SPACE>>>>>>>>>>>>>
build/core/base_rules.mk:157: *** hardware/qcom/display/msm8960/liblight: MODULE.TARGET.SHARED_LIBRARIES.lights.msm8960 already defined by device/samsung/jf-common/liblights. Stop.
real 2m42.540s
user 0m54.729s
sys 0m24.030s
[/CODE]
Not an uncommon problem, I have run into this before. You cannot have something defined twice, or make will not know who is right or wrong when they differ. So the easy fix here was to edit device/samsung/jf-common/liblights/Android.mk like so:
[CODE]
# WJH LOCAL_PATH:= $(call my-dir)
# HAL module implemenation stored in
# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so
# WJH include $(CLEAR_VARS)
# WJH LOCAL_SRC_FILES := lights.c
# WJH LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
# WJH LOCAL_SHARED_LIBRARIES := liblog
# WJH LOCAL_MODULE := lights.msm8960
# WJH LOCAL_MODULE_TAGS := optional
# WJH include $(BUILD_SHARED_LIBRARY)
[/CODE]
So, now you are off and running! I included this first error, which showed up only 2 minutes into the build to show you that just having all the “right stuff” doesn’t mean that you will have a successfull build. Hopefully this will get you pointed in the right direction though!
Linux – Keep it simple.