[TUTORIAL] Compiling N7000 CM10 for us Dummies
Compiling CM from source is hard, right? Wrong!
All you need is
- a semi decent PC
- a decent Interweb connection
- a bit of patience
a) semi decent PC - compiling a Rom from source entails some data crunching, so the better the box you have, the quicker it gets done
b) doing a repo sync means that you have to download CM10 repository to your machine. It contains some 6-7 Gbs of data, so attempting to do it on a 0.5 megabit connection might take forever and a day. For instance, I'm on a 20 megabit connection and the sync takes about 90 minutes.
c) some patience to read the following tutorial
And that's all.
First things first: you need to download and install 64-bit version of Ubuntu 12.04. A 32-bit one won't cut it. You'll want to have about 80-100 Gb partition for Ubuntu and compiling, and it wouldn't hurt to use another smaller partition (cca 30-40Gb) for swap. For instance, Anti uses a 120 Gb SSD for his compiling, I use 100+40 swap prehistoric SATA 2.
Installed it? Good, let's move on.
Now do a system update; click that little switch icon in the top right hand corner and you'll get a menu. Launch Update Manager and install everything it finds.
Now that your Ubuntu is up to speed you need to download and install some more stuff. Launch the terminal (Ctrl + Alt + T).
Copy the below code and paste it (right-click and paste, Ctrl + V doesn't work) in the terminal, hit enter.
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev libxml2-utils
If 'lib32ncurses5-dev' fails, delete it from the list, install everything else.
Now you need to add the following repos, again copy/paste each line into the terminal, hit enter. Repeat for each line of the code below.
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
Now you are going to install Synaptic.
sudo apt-get install synaptic
Click the 'Dash Home' button (top left hand corner of your desktop), find and launch Synaptic Package Manager. Search for 'Sun Java6 JDK' and install it will all the dependencies except sun-java6-demo and sun-java6-doc.
Now go to http://developer.android.com/sdk/index.html
and download the linux version of the Android SDK. It provides the API libraries and developer tools necessary to build. When your download is done, open it with Archive Manager, extract it somewhere, and move the extracted folder to your Home folder. Rename it to 'SDK' for simplicity.
Now you need to download and install Android SDK Platform Tools. Use file manager to navigate to your SDK sub-folder Tools. Find 'android' and double-click to run it. You'll be asked what you want to download. Choose the 'Platform Tools' and the Android 4.1.2 SDK Level 16 and the Android 4.2 SDK level 17 Dev tools and hit install. Let it download; it might take some time, depending on your download speed.
Now the time is ripe for you to setup your Android repos. Copy/paste the following commands into the terminal, hit enter after each one.
mkdir -p ~/android/system
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
You have to reboot after this for changes to take effect. Once back at your desktop, relaunch the terminal and copy/paste the following commands (with Enter).
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
Basically, what you're doing here is downloading the CM repo to your machine. This will take quite some time, so go grab a cup of coffee and watch some telly.
After the sync has gone through with no problems (knock on wood), you need to create a local manifest to pull TeamHacksung’s fork for N7000.
Launch File Manager, navigate to /android/system and click Ctrl + H for your hidden folders and files to appear. Enter the /.repo folder, right-click and choose 'Create New Document'. Name the empty document 'local_manifest.xml'. Open the document and paste the below code into it. Save and exit Gedit.
<?xml version="1.0" encoding="UTF-8"?>
<project name="teamhacksung/buildscripts" path="buildscripts" remote="github" revision="jellybean">
<copyfile dest="build.sh" src="build.sh" />
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="jellybean" />
<project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" revision="jellybean" />
<project name="CyanogenMod/android_device_samsung_n7000" path="device/samsung/n7000" remote="github" revision="jellybean" />
<project name="CyanogenMod/android_device_samsung_galaxys2-common" path="device/samsung/galaxys2-common" remote="github" revision="jellybean" />
<project name="CyanogenMod/android_kernel_samsung_smdk4210" path="kernel/samsung/smdk4210" remote="github" revision="jellybean" />
<project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="jellybean" />
Now another repo sync needs to be done to pull in the changes in the local manifest. This sync will be considerably shorter than the first one.
Launch the terminal and copy/paste
Everything went well? Fine, it's time for you to start your first build. It will also take some time; it lasts about 80-90 minutes on my Intel i3-3220 CPU @ 3.30GHz × 4 with SATA 2 drives.
Take a stiff drink, say a brief prayer, and enter the following commands into the terminal.
If all goes well (no errors), once it is done you will have a flashable CM10 zip in /android/system/out/target/product/n7000 folder.
Not so hard, and it's great fun.
I'd like to say a great big THANK YOU to utacka and anti for helping me navigate the murky waters of my first compile.