[Wildfire Android Development] xd.bx:
Direct link to the precompiled ROM: http://www.filefactory.com/file/cfe8147/GWK74-buzz-20111111.zip (please hit thanks if you find this ROM useful :))

Setting up the development environment

Install the current stable Debian: squeeze (6.0) amd64 (not the i386 version, and not the testing/unstable version). Do not ask me for a working Ubuntu version -- I don't know. Use Debian instead ;)

apt-get install python git bzip2 zip unzip lzma patch bison flex \
make gcc g++ gcc-multilib g++-multilib gperf libz-dev lib32z-dev curl \
libncurses5-dev lib32ncurses5-dev libx11-dev openjdk-6-jdk

Downloading the sources and other packages

AOSP 2.3.7r1 (GWK74) is the current version of the AOSP

arco's 2.6.35 kernel is the base for the kernel we will build

koush's vendor files contain the HTC proprietary blobs for buzz

CyanogenMod's device/htc/buzz

git clone https://github.com/arco/buzz-kernel-2.6.35.git
git clone https://github.com/koush/proprietary_vendor_htc
git clone https://github.com/CyanogenMod/android_device_htc_buzz.git -b gingerbread-release

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

mkdir 2.3.7_r1; cd 2.3.7_r1
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
repo sync
mkdir -p vendor/htc
cp -r ../proprietary_vendor_htc/buzz vendor/htc
cp -r ../android_device_htc_buzz device/htc/buzz

The "repo sync" may take a while, so please be patient ;)

Compiling the kernel

cd ../buzz-kernel-2.6.35
make ARCH=arm buzz_defconfig

At this point you can edit .config and change CONFIG_MSM_CPU_FREQ_ONDEMAND_MAX to overclock the CPU, for example setting it to 700 MHz.

make ARCH=arm -j4 CROSS_COMPILE=../2.3.7_r1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
cp arch/arm/boot/zImage ../2.3.7_r1/device/htc/buzz/prebuilt/kernel
cp drivers/net/wireless/bcm4329/bcm4329.ko ../2.3.7_r1/device/htc/buzz/prebuilt/bcm4329.ko

Patching the sources

Several files must be patched. The following patches are from CyanogenMod 7:

armv6j.mk.patch: adds a new architecture (ARMv6J) which targets the MSM7225

browser.patch: provides a small fix to prevent the Browser from crashing

camera.patch: enables the use of Froyo (2.2) libcamera.so

dalvik-armv6j.patch: adds a new ARMv6J target for JIT compilation by the Dalvik runtime environment

gpsshim.patch: enables the use of Froyo (2.2) libgps.so

libagl.patch: enables the use of copybit to make software OpenGL support a bit faster (I think)

surfaceflinger.patch: another cool patch from CM7 when transparency is not supported

The following patches were made by myself:

config.xml.patch: several values which are present in CM7 but not AOSP must be disabled

LOCAL_MODULE_TAGS.patch: a bunch of Android.mk in hardware/msm7k lack this variable

ota-no-recovery.patch: prevent ota_from_target_files from flashing the recovery (we like our ClockworkMod better ;))

vendork-blobs.mk.patch: adds library libOmxCore.so which is needed by mediaserver

The following patches are from Google:

apns-conf.xml.patch: adds a bunch of APNs that are not present in the default AOSP file

For your convenience, I have included all the patches in a single file, which is attached to this post (patch-buzz.zip).

cd ../2.3.7_r1
wget -O patch-buzz.zip "http://xdaforums.com/attachment.php?attachmentid=779411"
unzip patch-buzz.zip; ./patch-buzz/apply.sh
ln -s full.mk build/target/product/full_base.mk
rm -rf device/htc/buzz/overlay/packages

Setting up a custom vendor

At this point you may want to add a number of custom additions, for example:

a simple boot animation: http://forum.cyanogenmod.com/topic/19198-simple-generic-boot-animation/

Superuser root package: http://xdaforums.com/showthread.php?t=682828

Torch from CyanogenMod: http://download.cyanogenmod.com/?type=stable&device=buzz

Talk and Android Market: http://wiki.cyanogenmod.com/wiki/Latest_Version

Google Maps for WildFire: http://xdaforums.com/showpost.php?p=15218646&postcount=4

mkdir vendor/xdbg; cd vendor/xdbg
wget http://duck.at.shangtai.net/files/android/bootanimation.zip
wget -O su-2.3.6.1-ef-signed.zip http://dl.dropbox.com/u/6408470/su-releases/su-2.3.6.1-ef-signed.zip
wget http://download.cyanogenmod.com/get/update-cm-7.1.0-buzz-signed.zip

Also download gapps from http://goo-inside.me/gapps/gapps-gb-20110828-signed.zip , put it in 2.3.7_r1/vendor/xdbg and run:

unzip su-2.3.6.1-ef-signed.zip
wget -O system/app/Maps.apk http://xdaforums.com/attachment.php?attachmentid=641716
unzip update-cm-7.1.0-buzz-signed.zip system/lib/libOmxCore.so
unzip update-cm-7.1.0-buzz-signed.zip system/app/Torch.apk
unzip -o gapps-gb-20110828-signed.zip
mv system/lib/libOmxCore.so ../htc/buzz/proprietary

I haven't tried it, but you can try to include the LatinIME.apk from CM7 in order to get the dictionaries (not included by default in AOSP).

Now we'll create the Makefile that specifies which files are to be copied in the ROM. Be careful when copy-pasting to not truncate the last line which is quite long:

echo "\$(call inherit-product, vendor/xdbg/xdbg.mk)" >>../../device/htc/buzz/buzz.mk
cat >xdbg.mk <<"EOF"
PRODUCT_COPY_FILES += \
vendor/xdbg/bootanimation.zip:system/media/bootanimation.zip \
vendor/xdbg/system/bin/su:system/xbin/su \
vendor/xdbg/system/lib/libvoicesearch.so:system/lib/libvoicesearch.so \
vendor/xdbg/system/app/Superuser.apk:system/app/Superuser.apk \
vendor/xdbg/system/app/Torch.apk:system/app/Torch.apk \
vendor/xdbg/system/app/Talk.apk:system/app/Talk.apk \
vendor/xdbg/system/app/Vending.apk:system/app/Vending.apk \
vendor/xdbg/system/app/GenieWidget.apk:system/app/GenieWidget.apk \
vendor/xdbg/system/app/Maps.apk:system/app/Maps.apk \
vendor/xdbg/system/app/NetworkLocation.apk:system/app/NetworkLocation.apk \
vendor/xdbg/system/app/GoogleServicesFramework.apk:system/app/GoogleServicesFramework.apk \
vendor/xdbg/system/app/GoogleContactsSyncAdapter.apk:system/app/GoogleContactsSyncAdapter.apk \
vendor/xdbg/system/app/GoogleCalendarSyncAdapter.apk:system/app/GoogleCalendarSyncAdapter.apk \
vendor/xdbg/system/framework/com.google.android.maps.jar:system/framework/com.google.android.maps.jar \
vendor/xdbg/system/etc/permissions/com.google.android.maps.xml:system/etc/permissions/com.google.android.maps.xml
EOF

Building the ROM

cd ../..
. build/envsetup.sh
lunch [I](choose htc_buzz-userdebug)[/I]
make -j5 otapackage WITH_DEXPREOPT=true[I]
(5 is for a quad-core with 4GB of RAM. you can decrease it if you have less RAM)[/I]

Remove WITH_DEXPREOPT=true above to generate a de-odexed ROM.

Advantage of a de-odexed ROM: you can easily replace APKs or JARs in /system.

Disadvantages: the first boot takes a while because all APKs must be odexed. Also the dalkvik cache takes a significant amount of space (up to 50 MB) in /data (CM7 uses /cache so this is not a problem).

Note that you will not need the Android SDK since adb and other tools will be present in the PATH after you run lunch and the out/host part is compiled.

The generated ROM is out/target/product/buzz/htc_buzz-ota-*.zip. Wiping the whole data partition in ClockworkMod is required if your previous ROM was built with different signing keys.

Finally, I'd like to thank everyone who made this possible: cyanogen, arco, koush, HDCRJacob, schiznik, _thalamus & AdamG, ben1066, nhnt11 and everyone else who contributed on porting the AOSP on the WildFire. You guys are awesome :)