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:
$ 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
This will take a while. Once it is done, do this:
$ mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
$ gedit ~/.bashrc
Now you should see gedit open up your .bashrc file, to which you should add this at the very end, and save it:
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:
$ cd ~
$ mkdir omni6
$ cd omni6
$ repo init -u git://github.com/omnirom/android.git -b android-6.0
$ repo sync
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:
$ 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
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:
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:
$(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 += \
PRIVATE_BUILD_DESC=”jfltetmo-user 4.4.4 KTU84P M919UVUFNK2 release-keys”
PRODUCT_NAME := omni_jfltetmo
PRODUCT_DEVICE := jfltetmo
Now make a new file called AndroidProducts.mk and put this in it:
# 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
# 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 := \
Now your trees are “pruned” and ready for a build! Let’s give it a try:
omni6$ . build/envsetup.sh
omni6$ brunch jfltetmo
WARNING: Trying to fetch a device that’s already there
found the jfltetmo device repo
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.
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:
# WJH LOCAL_PATH:= $(call my-dir)
# HAL module implemenation stored in
# 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)
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.