来源:http://wiki.cyanogenmod.org/w/Build_for_endeavoru#What_you.E2.80.99ll_need

How to Build CyanogenMod for One X (codename: endeavoru)

Note:

This CyanogenMod build walkthrough is auto-generated specifically for the One X based on the device template at Template:device_endeavoru. You can find similar build instructions for every officially supported device. See here for more info.

Contents

[hide

Introduction

These instructions will hopefully assist you to start with a stock One X, unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyangenMod and ClockworkMod recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there-- maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device-- or maybe you’ll never build again-- it’s all really up to you.

What you’ll need

Add a comment to this section
  • One X
  • A relatively recent computer (Linux, OS X, or Windows) w/a reasonable amount of RAM and about 35 GB of free storage. The less RAM you have, the longer the build will take. Using SSDs results in faster builds than traditional hard drives.
  • A micro USB cable
  • A decent Internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with what a recovery image such as ClockworkMod is, for example. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux-- this is an excellent chance to learn. It’s free-- just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu. Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. According to Google, 32-bit Linux environment will only work if you are building older versions prior to Gingerbread (2.3.x)/CyanogenMod 7.

Using a VM allows Linux to run as a guest inside your host computer-- a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Build CyanogenMod and ClockworkMod Recovery

Prepare the Build Environment

Add a comment to this section

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

Add a comment to this section
If you have not previously installed adb and fastboot, install the Android SDK. "SDK" stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more-- all from your computer.

Helpful Tip

While the SDK contains lots of different things-- the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Add a comment to this section

Several "build packages" are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you'll need:

git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jre openjdk-6-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc

In addition to the above, for 64-bit systems, get these:

g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

Add a comment to this section

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Add a comment to this section

Enter the following to download the "repo" binary and make it executable (runnable):

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

Make sure that the ~/bin directory you just created is in your path of execution so that you can easily run the repo command even when you're not in ~/bin. Assuming you are using theBASH shell, the default in recent versions of Ubuntu, you can set it like this:

$ export PATH=${PATH}:~/bin

Helpful Tip

You can make this change to the path permanent for all future Terminal sessions:

$ gedit ~/.bashrc

This will launch a graphical text editor. Enter

export PATH=${PATH}:~/bin

on its own line, then save the file.

Initialize the CyanogenMod source repository

Add a comment to this section

Enter the following to initialize the repository:

$ cd ~/android/system/
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1

Download the source code

Add a comment to this section

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e., don't add any options to sync). For reference, our current default values are -j4, and-c. The “-j4” part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j3 or -j2. “-c” will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps

Add a comment to this section

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won't see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Add a comment to this section

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast endeavoru

This will download the device specific configuration and kernel source for your device.

Note:

You MUST be using the newest version of repo or you will encounter errors with breakfast! Run repo selfupdate to update to the latest.

Helpful Tip

If you want to know more about what "$ source build/envsetup.sh" does or simply want to know more about the breakfastbrunch and lunch commands, you can head over to the Envsetup_help page

Extract proprietary blobs

Read comments on this section

Now ensure that your One X is connected to your computer via the USB cable and that you are in the ~/android/system/device/htc/endeavoru directory (you can cd ~/android/system/device/htc/endeavoru if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the right place in the vendor directory. If you see errors about adb being unable to pull the files, adbmay not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with "command not found" errors.

Note:

Your device should already be running the branch of CyanogenMod you wish to build your own version of for the extract-files.sh script to function properly. If you are savvy enough to pull the files yourself off the device by examining the script, you may do that as well without flashing CyanogenMod first.

Note:

It’s important that these proprietary files are properly extracted and moved to the vendor directory. Without them, CyanogenMod will build without error, but you’ll be missing important functionality, such as the ability to see anything!

Turn on caching to speed up build

Add a comment to this section

If you want to speed up subsequent builds after this one, type:

$ export USE_CCACHE=1

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot . To use this command, as with brunch, you must first do “. build/envsetup.sh” from ~/android/system. Notice there is a period and space (“”) in that command.

Start the build

Add a comment to this section

Time to start building! So now type:

$ croot
$ brunch endeavoru

The build should begin.

Helpful Tip

If the build doesn't start, try lunch and choose your device from the menu. If that doesn't work, try breakfast and choose from the menu. The command make endeavorushould then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot or brunch or lunch, be sure you’ve done the “ . build/envsetup.sh” command in this Terminal session from the ~/android/system directory.

If the build breaks...

Add a comment to this section
  • If you experience this not-enough-memory-related error...
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/endeavoru/cm_endeavoru-ota-eng.root.zip] Error 1

...you may want to make the following change to:

$ system/build/tools/releasetools/common.py

Change: java -Xmx2048m to java -Xmx1024m or java -Xmx512m

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Add a comment to this section

Assuming the build completed without error (it will be obvious when it finishes), type:

# cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called... kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains ClockworkMod recovery, and (2) cm-[something].zip, which contains CyanogenMod.

Install CyanogenMod

Add a comment to this section

Back to the $OUT directory on your computer-- you should see a file that looks something like:

cm-10.1-20130806-UNOFFICIAL-endeavoru.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a "KANG" rather thanUNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. (Be sure you have backed up any previous installation before trying your new build.)

Success! So....what's next?

You've done it! Welcome to the elite club of self-builders. You've built your operating system from scratch, from the ground up. You are the master/mistress of your domain... and hopefully you've learned a bit on the way and had some fun too.

Now that you've succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what's in the source code directoriessubmitting your own contributionsporting CyanogenMod to new devices, and a lot more.

Congrats again!

To get assistance

Add a comment to this section
  • #cyanogenmod-dev - A helpful, real-time chat room (or “channel”) on IRC- the Internet Relay Chat.

How to Build CyanogenMod for One X (codename: endeavoru)的更多相关文章

  1. Android & CM build basics

    [CM source code folders] bootable/Among other things, the source for ClockworkMod recovery is in her ...

  2. android手机状态解释,比方android.os.Build.VERSION.SDK

    //BOARD 主板 String phoneInfo = "BOARD: " + android.os.Build.BOARD; phoneInfo += ", BOO ...

  3. NEXUS7 学习

    一.编译环境搭建 (更细节的环境搭建请参考:How to Build CyanogenMod for Nexus 7 (Wi-Fi, 2012 version) (codename: grouper) ...

  4. 编译可在Nexus5上运行的CyanogenMod13.0 ROM(基于Android6.0)

    编译可在Nexus5上运行的CyanogenMod13.0 ROM (基于Android6.0) 作者:寻禹@阿里聚安全 前言 下文中无特殊说明时CM代表CyanogenMod的缩写. 下文中说的“设 ...

  5. 支持不同Android设备,包括:不同尺寸屏幕、不同屏幕密度、不同系统设置

    Some of the important variations that you should consider include different languages, screen sizes, ...

  6. Android 获取手机内部信息,内核版本、基带版本、内部版本等

    TextView text = (TextView) findViewById(R.id.textView1); String phoneInfo = "Product: " + ...

  7. 12.UiAutomator 获取系统信息

    一.Build构建信息 1.build类: Build类提供了硬件厂商.编号.序列号.SDK版本等重要信息. 类名:android.os.Build 常量名 说明 BOARD 底层板名称 BOOTLO ...

  8. DEPLOYING NATIVE UWP (UNIVERSAL WINDOWS PLATFORM) APPS FOR JAVA DEVELOPERS & PUBLISHING THEM TO THE MICROSOFT STORE

    原文: DEPLOYING NATIVE UWP (UNIVERSAL WINDOWS PLATFORM) APPS FOR JAVA DEVELOPERS & PUBLISHING THEM ...

  9. repo: 创建local manifest以及如何添加app到CM/Android build系统中

    The local manifest Creating a local manifest allows you to customize the list of repositories on you ...

随机推荐

  1. Smarty 模板引擎 fetch()和display()函数的区别?

    Smarty模板函数里面有这样一个方法:fetch("template.htm"),他和display("template.htm");最大的不同就是fetch ...

  2. 其实,SSL也不是配通了就什么都不管的~~

    其中太多的中间人攻击需要去加强加固~~ 测试过A级是必须的!! https://www.ssllabs.com/ssltest/ 这网址两年前,我写过的哈

  3. [Android] hid设备按键流程简述

    hexdump /dev/hidraw0就能看到usbhid设备传输过来的裸流 如:按下Input键 003ae60 0000 0096 8000 006b 0000 0000 0000 0000 * ...

  4. mysql中lock tables与unlock tables

    官网:https://dev.mysql.com/doc/refman/5.0/en/lock-tables.html LOCK TABLES tbl_name [[AS] alias] lock_t ...

  5. 7.2 Database Backup Methods 数据备份方法:

    7.2 Database Backup Methods 数据备份方法: 本节总结了一些常用的备份方法: 使用MySQL Enterprise Backup 进行Hot Backup MySQL Ent ...

  6. NEW关键字的三种用法

    最近面试中有一道题是写new关键字的几种用法,想了下写下我知道的两种用法 第一种 创建对象.调用构造函数,这就不用讲了 ClassA  A=new ClassA(); 第二种 是作为修饰符,显示隐藏继 ...

  7. 【用PS3手柄在安卓设备上玩游戏系列】FC(任天堂NES/FC主机)模拟器

    NESoid 是安卓系统下公认最好的FC模拟器.据我所知,现在安卓系统下面的绝大部分的FC模拟器,都是基于 NESoid 的内核来开发的. 官方网站:http://www.nesoid.com NES ...

  8. hihocoder1236(北京网络赛J):scores 分块+bitset

    北京网络赛的题- -.当时没思路,听大神们说是分块+bitset,想了一下发现确实可做,就试了一下,T了好多次终于过了 题意: 初始有n个人,每个人有五种能力值,现在有q个查询,每次查询给五个数代表查 ...

  9. Mina笔记

    1.MINA框架简介 MINA(Multipurpose Infrastructure for Network Applications)是用于开发高性能和高可用性的网络应用程序的基础框架.通过使用M ...

  10. iOS UIImage扩展方法(category):放大、旋转、合并UIImage、增加渐变层、添加阴影、调节透明度、保存到相册

    一有用的 UIImage 扩展,支持(等比例)放大和旋转可在许多 App 中使用. UIImage-Extensions.h #import <Foundation/Foundation.h&g ...