Build for i9300 windows
WORK IN PROGRSS !! DON'T USE YET !!
This is a detailed guide for windows developers that would like to build omnirom with as little linux knowledge as possible.
- Download, install and setup a virtual machine using virtualbox
- Install and configure ubuntu to interact with windows
- Initializing the repository
- Making your first build
You will need a pretty recent computer to get everything up and running. In my case, I'm using a i7 with 16GB of RAM.
Getting windows ready
Let's start by installing chocolatey. This is a tool that helps installing all the needed packages:
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
Now let's install a couple of packages:
cinst git cinst python -Version 2.7.6
Now let's make python "linux" compatible. Open the os.py and add the following lines at the end:
from nt import rename as nt_rename def rename(old, new): if os.path.exists(new): os.remove(new) return nt_rename(old, new) import subprocess, os.path def symlink(source, destination): source = os.path.normpath(os.path.join(os.path.dirname(destination), source)) destination = os.path.abspath(destination) return subprocess.call(["ln", source, destination])
And add "fcntl.py" file in the same python lib directory:
def fcntl(fd, op, arg=None): pass def ioctl(fd, op, arg=None, mutate_flag=None): pass def flock(fd, op): pass def lockf(fd, operation, length=None, start=None, whence=None): pass
Now, let's make symbolic links work just link in linux. Start by downloading ln-win for "https://neosmart.net/Symlinks/". This is an open-source project (https://github.com/neosmart/ln-win). After you downloaded the zip file, extract the correct ln.exe (x84 or x86) and replace the ln.exe in the git installation.
Since the entire build is very sensitive to line endings, we will need to change the way git handles CRLF. Configure core.autocrlf to false.
Now create the following directory structure:
inside "c:\omnirom" execute the following command:
Now let's fetch the manifests from omnirom:
repo init -u https://github.com/omnirom/android.git -b android-4.4 --no-repo-verify
Small notice: The repo app will link a bunch of files/folders. Windows will display a size of 0bytes for the linked files. That is normal.
Download, install and setup a virtual machine using virtualbox
We will first need to download virtualbox. Navigate to [Download Page] and download the "VirtualBox for Windows host". As of this writing it was version 4.3.8. After the download has finished, run the installer. Choose all the options when asked for what to install. During the installation of virtualbox the local network will temporarily disconnect you from the network; make sure you don't have anything important open during that time. While installing, a lot a drivers will be installed; accept them all :). If you are asked to reboot the machine, please do so.
Now start up virtualbox. Let's create the virtual machine (VM) in which the actual build will be running by pressing the "New" button. We are asked to give a name, type and version of our VM. We're going to use "Omnirom Builder", "Linux" and "Ubuntu (64 bit)". Please double-check that you haven't selected "Ubuntu (32 bit)". For the memory size we will use "4096MB" of RAM. For the hard drive: "Create a virtual hard drive now" -> "VDI (VirtualBox Disk Image)" -> "Dynamically allocated" -> "200 GB".
Create a folder in the root of your C-Drive called "android\omni\out".
We will need to reconfigure the VM details a bit more. Go back into the settings by pressing the "Settings" button. Make the following configuration changes:
- General -> Advanced -> Shared Clipboard: Bidirectional
- Shared Folders -> Add new folder -> Folder Path: "c:\android" / Folder Name: "android" / Read-only: unchecked / Auto-mount: checked
Perfect! Now we're ready to start our VM! :)
Install and configure ubuntu to interact with windows
We'll need to download ubuntu 13.10 from []. Make sure you download the 64-bit version! This iso image is both an installer for ubuntu as well as a stand-alone version. For our purpose we will want to install it. So before we start our VM, we need to "insert" the ubuntu image into our virtual DVD-ROM drive. For that, go back into the VM settings and open the storage section. You will find in the storage tree an IDE controller with a CD icon; click on the CD. To the right (under attributes) you will have a small CD icon with a tiny arrow; click it and choose "Choose a virtual CD/DVD disk file...". Go to the location you downloaded the ubuntu image and select it. Confirm the new settings by pressing OK and.... start the VM by pressing the "Start" button.
If the VM cannot start (e.g. virtualbox cannot access the kernel drivers), then simply select "repair" when restarting the original installation package.
All right. If your VM has started, you should be greeted with a "welcome" screen asking you to choose you language and what you want to do. Select "english" and press the "Install Ubuntu" button. On the next screen select "Download updates while installing" and continue. On the next screen, the installer correctly detected that you don't have an operating system installed on the virtual disk (hihi). Select "Erase disk and install Ubuntu" and press "Install Now". Select your location and the correct keyboard layout on the next two screens. When asked "Who are you?", type in your name (real or fake; doesn't matter), choose a password (and remember it! You'll need it later) and select "Log in automatically". When asked about Ubuntu One account, simply select "Log in later". At this stage, ubuntu will be installed on your virtual hard disk. Once you get the "installation complete" dialog, confirm by pressing "Restart Now". You'll drop back to console-like prompt asking you to press "Enter" where you'll naturally press it :). After the reboot you'll be starting ubuntu from the virtual hard disk.
Now it's time to make ubuntu a bit more "virtualbox aware". In the VM menu, select "Devices->Insert Guest Additions CD image...". After a couple of seconds a dialog will pop up asking you if you want to run the virtualbox additions. Select "Run". It will ask you a password; enter the password you (hopefully) remember when you installed ubuntu and press "Authenticate". A console will pop up and do a bunch of "stuff". Once you get the prompt "Press Return to close this window..." press Enter. You will need to reboot ubuntu at this stage by pressing the "Power" icon at the very top-left corner of the screen and select "Restart.." and then the restart button again. Now that the additions are installed, you will be able to resize the VM screen window and ubuntu will automatically resize the desktop.
Although not necessary, I would recomend to clean up the launcher bar on the left by right-clicking on the following applications and selecting "Unlock from Launcher": "LibreOffice Writer", "LibreOffice Calc", "LibreOffice Impress", "Ubuntu One", "Amazon" and "Ubuntu One Music". But there is one application that we will be using a lot that it not yet on it: a terminal (what would a linux be without a terminal :)). Go to the top icon on the launcher (Search your computer and online sources) and click it. In the "search your computer and online sources", type "terminal" and you should soon see in the applications section an application called terminal. Select it and a terminal will open. You will see in the launcher the terminal icon. Right click it and select "Lock to Launcher".
Another optional thing that can be configured is to disable the screen lock. For that locate the system settings icon on the launcher (the wheel with the wrench) and open it. Locate "Brightness & Lock" and open that. In the "Turn screen off when inactive" select "Never", toggle the lock setting to "off" and unselect "Required my password when waking from suspend".
All right, time to make WinBuntu :). Open up a terminal (if not yet open) and type in the following (you know what to type in when asked for a password):
mkdir ~/android mkdir ~/android/omni mkdir ~/android/omni/out sudo mount.vboxsf -w android_omni_out ~/android/omni/out
This will create a link in your ubuntu home folder and the c:\android folder.
Installing all the tools
Now would be a good time to install all the necessary tools that we will need to build omnirom. The list is long, but save you some time, you can install everything at once by executing the following in a terminal:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl \ libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools libncurses5-dev \ zlib1g-dev pngcrush schedtool libxml2 libxml2-utils xsltproc lzop libc6-dev \ g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib
You will also need openjdk7. You might have seen at other places that you need openjdk6 or oracle's jdk6; well to be honest, I never got it to work except with openjdk7. So... let's install that as well:
sudo apt-get install openjdk-7-jre openjdk-7-jdk
There is just one more tool (and a small configuration) that we need to install before the fun stuff starts. So let's get it. In the same terminal type:
mkdir -p ~/bin curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo echo "export PATH=~/bin:$PATH" >> ~/.bashrc
Now for the last step. We need to tell git who we are. Again in a console type in the following but replace "firstname.lastname@example.org" with your email address (but keep the quotes!) and "Your Name" with your name (and keep the quotes here too!)
git config --global user.email "email@example.com" git config --global user.name "Your Name"
Important: The repo tool that we just installed in not yet available in the current terminal since we just added it to the path. So let's close the terminal.
Initializing the repository
Since we want to build the latest and greatest omnirom (as of this writing), we will build the android 4.4 branch. In a new terminal type in the following:
cd ~/android/omni repo init -u https://github.com/omnirom/android.git -b android-4.4
(This should take a bit less than a minute or two) You will be asked of you want to enable color display in this user account; answer "y"es.
The last step before building will be to enable caching for the compiler. Type the following in the terminal window:
echo "export USE_CCACHE=1" >> ~/.bashrc echo "export CCACHE_DIR=~/android/.ccache" >> ~/.bashrc ~/android/omni/prebuilts/misc/linux-x86/ccache/ccache -M 30G
The above command will set 30GB of cache for the compiler, but once you got everything working you can always change it to a different value. Recommended values are between 30 and 50GB.
Now, let's get all the common sources by typing the following in the terminal:
This will download a multitude of additional git repositories (around 10GB!), hence get yourself a coffee.
Making your first build