Building from source-Do You Want To compile cyanogenmod Rom yourself?

Source: Internet
Author: User
Document directory
  • Install cyanogenmod on your phone
  • Take a backup
  • Install Repo
  • Build cyanogenmod
  • Complete the build
  • Obtaining the code
  • Create Build Environment
  • Configure build
  • Get proprietary files from your device
  • Build it
From cyanogenmod Wiki
How do I compile the cyanogenmod kernel from source

The following instructions will enable the build of A cyanogenmod kernel, not the build of the cyanogenmod itself. as a matter of fact you will download the Google's Android source without the cyanogenmod modifications. if you want to build the cyanogenmod itself from source you shoshould look at the following section (2. * of this document) "Building for passion/Nexus One ". even if you don't go for these targets it shoshould be a good help.

Beware! Inexperienced users may brick their phones!

These instructions have only been tested4.2.10.1On25 dec 2009.This information may be out-of-date.

These instructions are forDebian/Ubuntu 32bit System. If you have a different platform, more information can be found here and here.

 

Install cyanogenmod on your phone
  1. Install cyanogenmod on your phone.

Take a backup

Better safe than sorry, boot into recovery and take a backup of your working phone.

Install Repo

  1. Install the various tools you will need.
       sudo aptitude install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

     

    And for 64bit only:

       sudo aptitude install ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib

     

  2. Make sure you have a/bin directory in your/Home Directory
       cd ~/
    mkdir bin
    cd bin
    echo $PATH

     

    You shoshould see something like '...:/home/user_name/bin:...' in a line of text. If you don't see this, try restarting your computer.

  3. Download repo and make it executable
       curl http://android.git.kernel.org/repo >~/bin/repo
    chmod a+x ~/bin/repo

     

  4. Create a directory to hold you working files:
       mkdir ~/mydroid
    cd ~/mydroid

     

  5. Download the latest repo:
       repo init -u git://android.git.kernel.org/platform/manifest.git

     

    If everything was successful, you should see a message like 'repo initialized in/mydroid'

  6. Next, get the latest files:
       repo sync

     

    This step may take a while.

  7. Create an environment variable denoting the location of the android toolchain as follows:
       export CCOMPILER=/home/$USER/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

     

Prepare kernel from source

  1. Create a new directory in which to place the kernel source
       mkdir androkern

     

  2. Enter the kernel directory
       cd androkern

     

  3. Download the kernel
       git clone git://github.com/cyanogen/cm-kernel.git

     

  4. Enter the source directory
       cd cm-kernel

     

  5. Retrieve a kernel. config file. This can be pulled from the phone or from a boot. img
    1. Retrieve a working kernel config from your phone:
           adb pull /proc/config.gz /home/user_name/androkern/cm-kernel/config.gz

       

      1. Unzip the config.gz and rename it to. config
               gunzip config.gz && mv config .config

         

    2. Alternatively, you can pull the. config from the Newest boot. img
      1.        scripts/extract-ikconfig boot.img > .config

         

  6. Run
       make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig

     

    Provide answers to the questions it asks, if any, or just keep pressing enter to accept defaults.

  7. Customize the kernel
       make ARCH=arm CROSS_COMPILE=$CCOMPILER menuconfig

     

  8. Make the build
       make ARCH=arm CROSS_COMPILE=$CCOMPILER

     

    This step may take from minutes to hours.

At this point you shoshould have a kernel stored in cm-kernel/ARCH/ARM/boot/zimage

Build cyanogenmod

  1. cd ~/mydroid
  2. source build/envsetup.sh
  3. Now you need choose which product you want to build, you can list all buildable product
    sed -n -e "s/^add_lunch_combo//gp" vendor/*/vendorsetup.sh
  4. lunch cyanogen_dream_us-eng

    This load cyanogenmod Product

  5. make -j4

    Build process is long... take a pizza, a beer and watch TV. the-J flag specifies how many threads the compiler shocould use. rule of thumb is # of processors + 1 but will vary with who you ask.

Next soon.

Complete the build

You need to merge this file with a working cyanogen ramdisk in order to create a boot image suitable for flashing.

Follow these instructions here in order to do so.

If all goes well, you shoshould now be running your own cym cyanogenmod Kernel on your phone.

If you are building for Nexus One then you shoshould use -- Base 0x20000000 when running mkbootimg.

Building for passion/Nexus One

This will explain how to build cm, using the code from cyanogen's GitHub repository.

Obtaining the code

Read the introduction and how-to on obtaining the source from the http://source.android.com/This is quite similar but won't cover the basics.

We use cyanogens manifest file instead of theirs, it has all the good stuff in it.

Initialize Your repository

  1. mkdir ~/android-cm
  2. cd ~/android-cm
  3. repo init -u git://github.com/cyanogen/android.git -b eclair
  4. repo sync

The sync can take quite some time, it pulls about 2gig of files.

Create Build Environment

  1. cd ~/android-cm
  2. source build/envsetup.sh

Build ADB (only required if you haven't built it yet)

  1.  make -j4 adb

Configure build

  1. Now you need choose which product you want to build, you can list all buildable products
    sed -n -e "s/^add_lunch_combo//gp" vendor/*/vendorsetup.sh
  2. lunch cyanogen_passion-userdebug

    Select a cyanogenmod build type

Get proprietary files from your device

  1.  cd ~/android-cm/vendor/google/passion
  2.  ./extract-files.sh
  3.  cd -

Build it

Looks like we're ready to build

  1. Start building
    make -j4

Now this takes from 30 min to 2 hours, depending on your computer.

Once ready, all files will be placed in

 ~/android-cm/out/target/product/passion 

You can now create a ROM or just flash them with fastboot like this

  1.  cd ~/android-cm/out/target/product/passion
  2.  fastboot flash system system.img
  3.  fastboot flash boot boot.img
  4.  fastboot flash userdata userdata.img
  5.  fastboot reboot

Todo

  • Todo: Explain how to compile WLAN. KO in order to enable wifi.
  • Todo: Explain how to provide other kernel modules for a chroot Debian install on the G1.
  • Todo: Explain how to compile the rest of cyanogenmod
Retrieved from "http://wiki.cyanogenmod.com/index.php/Building_from_source"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.