[Galaxy S 4 Mini General] k2wl:
Hello friends!!!

I have been compiling and making roms since 2 yrs now.

I am posting here the building and compiling guide of s4 mini.

There are already similar guides for other phones on XDA.

This guide has following parts

A.Preparation

B.Downloading the source

C.Compiling and building

A. Preparation

First and foremost is use 64bit operating system

you can use UBUNTU 14.04LTS, MINT, BBQLINUX or any variant of Ubuntu or debian .

I use UBUNTU 14.04LTS and BBQ LINUX

this guide is based on ubuntu 14.04 lts

I assume that you are familiar with linux and its basic commands.

Things to be done before downloading actual android source code. (to be done once only!!!!)

1. Installing Proper version of java

Open terminal, type and install following

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

This will remove current java installations

2. Install oracle java 6 by following command (say OK to prompts)

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update && sudo apt-get install oracle-java6-installer

java -version

3.After that we need to install developer utilities for building android source

sudo apt-get install git gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z1-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libreadline6-dev lib32readline-gplv2-dev libncurses5-dev bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev squashfs-tools pngcrush schedtool dpkg-dev

4. After installation of above do following

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

5. Install repo

Repo is a program which downloads and helps in syncing the source

mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo

6.Use your favorite text editor to open ~/.bashrc - I like nano:

sudo nano ~/.bashrc

7. At the very bottom (use the Page Down key) paste this code to a new (empty) line:

export PATH=~/bin:$PATH

8. Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:

source ~/.bashrc

B. Downloading the source

We are now going to download the source code for cyanogenmod kitkat cm-11.0

1. make a directory where you want to download the code

for guide purpose i use cm11

mkdir ~/cm11 && cd ~/cm11

2. initialise the repo for cm-11.0

repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

3. make local manifest for downloading extra repositories for building for s4 mini

cd .repo
mkdir local_manifests
sudo nano s4mini.xml

copy and paste following to s4mini.xml

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_samsung_msm8930-common" path="device/samsung/msm8930-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_serrano-common" path="device/samsung/serrano-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_serrano3gxx" path="device/samsung/serrano3gxx" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_serranoltexx" path="device/samsung/serranoltexx" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_samsung_msm8930-common" path="kernel/samsung/msm8930-common" remote="github" revision="cm-11.0" />
<project name="k2wl/android_device_samsung_serranodsdd" path="device/samsung/serranodsdd" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-11.0" />
</manifest>

Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt.

now its time to download the sources

4. Syncing the sources

repo sync

now sit back and enjoy all the other things.

the source is around 12 to 15 gb.

so it is going to be a while before it gets downloaded.

(recommended 2mbps and above net speed for this)

you can speed up the process by adding following remove.xml in your local_manifests folder along with s4mini.xml

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- Useless Stuff -->
<remove-project name="platform/prebuilts/clang/darwin-x86/3.1"/>
<remove-project name="platform/prebuilts/clang/darwin-x86/3.2"/>
<remove-project name="platform/prebuilts/clang/darwin-x86/arm/3.3"/>
<remove-project name="platform/prebuilts/clang/darwin-x86/host/3.3"/>
<remove-project name="platform/prebuilts/clang/darwin-x86/mips/3.3"/>
<remove-project name="platform/prebuilts/clang/darwin-x86/x86/3.3"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.7"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/headers"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.6"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.7"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.6"/>
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.7"/>
<remove-project name="platform/prebuilts/python/darwin-x86/2.7.5"/>
</manifest>

this will remove mac related prebuilts from downloading. so saving the time and bandwidth.

During initialising repo the repo tool may ask you your name and email

make one username with github

this will be your name and your_username@github.com is your email address.

C. compiling and building from source

Now you have all the source you want for building your own cm-11.0 for your s4mini.

Open terminal in cm11 directory.

1.building for serrano3gxx i9190

. build/envsetup.sh && brunch serrano3gxx

2.building for serranoltexx i9195

. build/envsetup.sh && brunch serranoltexx

3.building for serranodsdd i9192

for this we need to patch some things for ril and other things to work.

cd device/samsung/serranodsdd/patches

./install-all.sh

cd

. build/envsetup.sh && brunch serranodsdd

happy building

post your queries here .

i will keep updating this thread for some more tips and tricks.