HTC Desire HD

Table of Contents

1 Overview

2 A high-level DHD/Inspire manual S-OFF hack concept for advanced users

3 Building for HTC Desire HD(ICS)

3.1 set up

cd work
mkdir bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > bin/repo
chmod a+x bin/repo
mkdir android/system
cd android/system/
repo init -u git://github.com/CyanogenMod/android.git -b ics

Before starting the long first sync, we need to add some extra repositories to the build as presently the Desire HD isn’t included “out of the box”.

3.2 set htc

Create a file, .repo/localmanifest.xml with the following contents

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="CyanogenMod/android_device_htc_ace"
           path="device/htc/ace" remote="github" />
  <project name="CyanogenMod/android_device_htc_common"
           path="device/htc/common"
           revision="refs/heads/gingerbread"/>
  <project name="CyanogenMod/android_device_htc_msm7x30-common"
           path="device/htc/msm7x30-common" remote="github" />
  <project name="koush/proprietary_vendor_htc"
           path="vendor/htc" />
</manifest>

3.3 repo sync

repo sync -j16
# get some prebuilt files
cd vendor/cm/
./get-prebuilts
cd ../..

3.4 patches

At this point the codebase will build but will not boot. To fix this, you need to edit the file device/htc/ace/mediaprofiles.xml as follows.

Insert @ line 77:
< !ATTLIST VideoEditorCap maxPrefetchYUVFrames CDATA #REQUIRED>
Change line 250 from
        maxOutputFrameHeight="720"/>
to
        maxOutputFrameHeight="720" maxPrefetchYUVFrames="10"/>

3.5 build

. build/envsetup.sh
brunch ace

4 CM10.1 JellyBean

http://forum.xda-developers.com/showthread.php?t=2093845

mkdir cm10
cd cm10/
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
mkdir -p .repo/local_manifests
wget https://github.com/Mustaavalkosta/android/raw/cm-10.1/local_manifest.xml -O .repo/local_manifests/cm_ace.xml
repo sync
cd vendor/cm/
./get-prebuilts
cd ../../
. build/envsetup.sh
lunch cm_ace-userdebug
mka bacon

5 How to Build CyanogenMod for Desire HD / Inspire 4G (codename: ace)

5.2 Install the Build Packages

For 32-bit & 64-bit systems, you'll need:
sudo apt-get install 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 xsltproc

For 64-bit only systems, get these:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-4.7-multilib g++-4.5-multilib

5.3 Create the directories

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

5.4 Install the repo command

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

5.5 Initialize the CyanogenMod source repository

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

5.6 Download the source code

$ repo sync

5.7 Get prebuilt Rom Manager

$ cd ~/android/system/vendor/cyanogen
$ ./get-rommanager

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

5.8 Prepare the device-specific code

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

$ source build/envsetup.sh
$ lunch

You should see a list of devices, including something like cmace-userdebug. Select it by typing its number. It is possible that lunch does not display your device. In that case try

$ lunch cm_ace-userdebug
or
$ lunch full_ace-userdebug

If all goes well, you should see that ace-specific directories are downloaded automatically.

5.9 Extract proprietary blobs

Now ensure that your Desire HD / Inspire 4G is connected to your computer via the USB cable and that you are in the ~/android/system/device/htc/ace directory (you can cd ~/android/system/device/htc/ace 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.

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!

5.10 Turn on caching to speed up build

If you want to speed up subsequent builds after this one, type:
$ export USE_CCACHE=1

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.

5.11 Start the build

$ croot
$ brunch ace

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 ace should 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.

5.12 If the build breaks…

If you experience this not-enough-memory-related error… ERROR: signapk.jar failed: return code 1make: *** [out/target/product/ace/cm_ace-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).

5.13 Install the build

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.

5.14 Install CyanogenMod

5.15 FAQ

5.15.1 Duplicate device 'CyanogenMod/androiddevicehtcace' found in local manifest

lunch htc_ace-eng

Device ace not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Found repository: android_device_htc_ace
Duplicate device 'CyanogenMod/android_device_htc_ace' found in local manifest
build/core/product_config.mk:196: *** _nic.PRODUCTS.[[vendor/cyanogen/products/cyanogen_anzu.mk]]: "device/semc/anzu/device_anzu.mk" does not exist.  Stop.

6 install

You need to extract boot.img from the zip and flash it via fastboot. You need to repeat this everytime you flash new version of this rom to ensure everything will work fluently as long as you have just basic HTC Dev unlock.

fastboot flash boot boot.img

7 Development by SHI

mkdir cm10
cd cm10/
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
mkdir -p .repo/local_manifests
wget   -O .repo/local_manifests/cm_ace.xml
repo sync
cd vendor/cm/
./get-prebuilts
cd ../../
. build/envsetup.sh
lunch cm_ace-userdebug
mka bacon

Author: Shi Shougang

Created: 2015-03-05 Thu 23:20

Emacs 24.3.1 (Org mode 8.2.10)

Validate