Build CyanogenMod in Linux for HTC Dream/Sapphire.

Well, why create a new page when you’ve already got a wiki page specifically for that?

Because that page is well outdated, no longer works, and HTC Dream/Sapphire is no longer officially supported. Additionally, it’s not a proper place to include any personal experience.

The steps described in that page are still valid, issues are that you will encounter building errors and broken links when you try to build.

Following are the specific changes I have made to make the building work. I have not tested the image on my shiny Rogers Post-911 Dream yet, which I bought recently on Amazon. Spec wise HTC Dream is a bit outdated but the build quality is solid and I really do not have $500 for a smart phone.

If you’d like to follow what I have done, please be aware that it is assumed that you’ve already had a rooted Dream running stock CyanogenMod 6.1.0-DS release.

Following are the changes you need to make for a successful build:

1. The revision information for some of the packages in the CyanogenMod repositories no longer works. I have forked the ‘android’ project to fix the manifests. So use the following command lines to set up the repo:

$cd ~/android/system/
$repo init -u git:// -b froyo-stable
$repo sync -j16

2. The ROM Manager download link in the wiki page is broken. Fortunately, the rooted phone has a copy, so it can be pulled directly from the phone. What I did was to modify the script vendor/cyanogenmod/get-rommanager, and make it looks like this:

mkdir -p `dirname $0`/proprietary
adb pull /system/app/RomManager.apk `dirname $0`/proprietary/RomManager.apk

3. There is error message complaining about missing rule for ddmlib-prebuilt.jar, etc. I do not understand why this was not set up properly, but anyway I downloaded the CTS package, and extracted the said JAR archives into out/host/linux-x86/framework/.

4. When I ran the ‘mka’ script the building appears to stuck at this line:

APK certs list: out/target/product/dream_sapphire/obj/PACKAGING/apkcerts_intermediates/openeclair_dream_sapphire-apkcerts-eng.jadecolour.txt

To enable better visibility, I changed the command line to this:

$VERBOSE=1 mka bacon

Now I can see that the build is stuck at waiting for kernel configuration for new options. After I completed typing in several ‘n’s, it’s working fine to the end and spit out the final image.

Here is the output log I got:

find: `drm/java’: No such file or directory
find: `drm/java’: No such file or directory
build/core/ warning: overriding commands for target `out/target/product/dream_sapphire/recovery/root/sbin/tune2fs’
bootable/recovery/ warning: ignoring old commands for target `out/target/product/dream_sapphire/recovery/root/sbin/tune2fs’
build/core/ warning: overriding commands for target `out/target/product/dream_sapphire/kernel’
build/core/Makefile:19: warning: ignoring old commands for target `out/target/product/dream_sapphire/kernel’
No private recovery resources for TARGET_DEVICE dream_sapphire
Install: out/target/product/dream_sapphire/recovery/root/sbin/tune2fs
make[1]: Entering directory `/home/jadecolour/Projects/android/system/kernel-msm’
GEN     /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/obj/kernel/Makefile
scripts/kconfig/conf -o arch/arm/Kconfig
# configuration written to .config
make[1]: Leaving directory `/home/jadecolour/Projects/android/system/kernel-msm’
make[1]: Entering directory `/home/jadecolour/Projects/android/system/kernel-msm’
GEN     /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/obj/kernel/Makefile
scripts/kconfig/conf -s arch/arm/Kconfig
GEN     /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/obj/kernel/Makefile
CHK     include/linux/version.h
CHK     include/generated/utsrelease.h
Using /home/jadecolour/Projects/android/system/kernel-msm as source for kernel
make[3]: `include/generated/mach-types.h’ is up to date.
CALL    /home/jadecolour/Projects/android/system/kernel-msm/scripts/
CHK     include/generated/compile.h
GZIP    kernel/config_data.gz
IKCFG   kernel/config_data.h
CC      kernel/configs.o
LD      kernel/built-in.o
LD      vmlinux.o
MODPOST vmlinux.o
WARNING: modpost: Found 3 section mismatch(es).
To see full details build your kernel with:
GEN     .version
CHK     include/generated/compile.h
UPD     include/generated/compile.h
CC      init/version.o
LD      init/built-in.o
LD      .tmp_vmlinux1
KSYM    .tmp_kallsyms1.S
AS      .tmp_kallsyms1.o
LD      .tmp_vmlinux2
KSYM    .tmp_kallsyms2.S
AS      .tmp_kallsyms2.o
LD      vmlinux
OBJCOPY arch/arm/boot/Image
Building modules, stage 2.
Kernel: arch/arm/boot/Image is ready
GZIP    arch/arm/boot/compressed/piggy.gzip
SHIPPED arch/arm/boot/compressed/lib1funcs.S
AS      arch/arm/boot/compressed/lib1funcs.o
MODPOST 24 modules
AS      arch/arm/boot/compressed/piggy.gzip.o
LD      arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
make[1]: Leaving directory `/home/jadecolour/Projects/android/system/kernel-msm’
make[1]: Entering directory `/home/jadecolour/Projects/android/system/kernel-msm’
INSTALL drivers/net/wireless/tiwlan1251/wlan.ko
INSTALL drivers/staging/ramzswap/ramzswap.ko
INSTALL fs/cifs/cifs.ko
INSTALL fs/fuse/fuse.ko
INSTALL fs/lockd/lockd.ko
INSTALL fs/nfs/nfs.ko
INSTALL fs/nfs_common/nfs_acl.ko
INSTALL net/ipv4/tunnel4.ko
INSTALL net/ipv6/ah6.ko
INSTALL net/ipv6/esp6.ko
INSTALL net/ipv6/ip6_tunnel.ko
INSTALL net/ipv6/ipcomp6.ko
INSTALL net/ipv6/ipv6.ko
INSTALL net/ipv6/mip6.ko
INSTALL net/ipv6/sit.ko
INSTALL net/ipv6/tunnel6.ko
INSTALL net/ipv6/xfrm6_mode_beet.ko
INSTALL net/ipv6/xfrm6_mode_transport.ko
INSTALL net/ipv6/xfrm6_mode_tunnel.ko
INSTALL net/ipv6/xfrm6_tunnel.ko
INSTALL net/sunrpc/auth_gss/auth_rpcgss.ko
INSTALL net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
INSTALL net/sunrpc/sunrpc.ko
INSTALL net/xfrm/xfrm_ipcomp.ko
make[1]: Leaving directory `/home/jadecolour/Projects/android/system/kernel-msm’
Copying /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/system/lib/modules/ -> /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/system/lib/modules/wlan.ko
**** KERNEL BUILT ****
Target boot image: out/target/product/dream_sapphire/boot.img
Transforming out/target/product/dream_sapphire/recovery_kernel to out/target/product/dream_sapphire/kernel
target Prebuilt:  (out/target/product/dream_sapphire/recovery_kernel)
Finding NOTICE files: out/target/product/dream_sapphire/obj/NOTICE_FILES/hash-timestamp
out/target/product/dream_sapphire/boot.img total size is 2283520
—– Making recovery image ——
mkdir -p out/target/product/dream_sapphire/recovery
mkdir -p out/target/product/dream_sapphire/recovery/root
mkdir -p out/target/product/dream_sapphire/recovery/root/etc
mkdir -p out/target/product/dream_sapphire/recovery/root/tmp
echo Copying baseline ramdisk…
Copying baseline ramdisk…
cp -R out/target/product/dream_sapphire/root out/target/product/dream_sapphire/recovery
echo Modifying ramdisk contents…
Modifying ramdisk contents…
cp -f bootable/recovery/etc/init.rc out/target/product/dream_sapphire/recovery/root/
cp -f out/target/product/dream_sapphire/obj/EXECUTABLES/recovery_intermediates/recovery out/target/product/dream_sapphire/recovery/root/sbin/
rm -f out/target/product/dream_sapphire/recovery/root/init.*.rc
mkdir -p out/target/product/dream_sapphire/recovery/root/system/bin
cp -rf bootable/recovery/res out/target/product/dream_sapphire/recovery/root/
cp out/target/product/dream_sapphire/obj/PACKAGING/ota_keys_intermediates/keys out/target/product/dream_sapphire/recovery/root/res/keys
cat out/target/product/dream_sapphire/root/default.prop out/target/product/dream_sapphire/system/build.prop \
> out/target/product/dream_sapphire/recovery/root/default.prop
out/host/linux-x86/bin/mkbootfs out/target/product/dream_sapphire/recovery/root | out/host/linux-x86/bin/minigzip > out/target/product/dream_sapphire/ramdisk-recovery.img
Combining NOTICE files: out/target/product/dream_sapphire/obj/NOTICE.html
out/host/linux-x86/bin/mkbootimg  –kernel out/target/product/dream_sapphire/recovery_kernel –ramdisk out/target/product/dream_sapphire/ramdisk-recovery.img –cmdline “no_console_suspend=1 console=null” –output out/target/product/dream_sapphire/recovery.img
—– Made recovery image ——– out/target/product/dream_sapphire/recovery.img
out/target/product/dream_sapphire/recovery.img total size is 3387392
Target system fs image: out/target/product/dream_sapphire/obj/PACKAGING/systemimage_unopt_intermediates/system.img
Install system fs image: out/target/product/dream_sapphire/system.img
out/target/product/dream_sapphire/system.img+ total size is 94262784
Package target files: out/target/product/dream_sapphire/obj/PACKAGING/target_files_intermediates/
Package OTA: out/target/product/dream_sapphire/
unzipping target target-files…
using device-specific extensions in device/htc/common
warning: no radio image in input target_files; not flashing radio
Sanitizing environment…
Unpacking /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/…
Optimizing framework-res.apk…
Optimizing VpnServices.apk…
Optimizing SpareParts.apk…
Optimizing CMStats.apk…
Optimizing LiveWallpapersPicker.apk…
Optimizing DownloadProvider.apk…
Optimizing Development.apk…
Optimizing PicoTts.apk…
Optimizing VoiceDialer.apk…
Optimizing PackageInstaller.apk…
Optimizing Camera.apk…
Optimizing DefaultContainerService.apk…
Optimizing TtsService.apk…
Optimizing CMUpdateNotify.apk…
Optimizing Mms.apk…
Optimizing Settings.apk…
Optimizing QuickSearchBox.apk…
Optimizing ContactsProvider.apk…
Optimizing Term.apk…
Optimizing SettingsProvider.apk…
Optimizing HTMLViewer.apk…
Optimizing Superuser.apk…
Optimizing ADWLauncher.apk…
Optimizing Contacts.apk…
Optimizing CMPartsHelper.apk…
Optimizing TelephonyProvider.apk…
Optimizing FileManager.apk…
Optimizing CertInstaller.apk…
Optimizing RomManager.apk…
Optimizing Email.apk…
Optimizing SoundRecorder.apk…
Optimizing UserDictionaryProvider.apk…
Optimizing CMParts.apk…
Optimizing Protips.apk…
Optimizing DSPManager.apk…
Optimizing Stk.apk…
Optimizing DrmProvider.apk…
Optimizing Music.apk…
Optimizing Calendar.apk…
Optimizing AccountAndSyncSettings.apk…
Optimizing Phone.apk…
Optimizing LatinIME.apk…
Optimizing CMWallpapers.apk…
Optimizing MediaProvider.apk…
Optimizing Calculator.apk…
Optimizing DeskClock.apk…
Optimizing Browser.apk…
Optimizing ApplicationsProvider.apk…
Optimizing CalendarProvider.apk…
Optimizing Gallery3D.apk…
Optimizing Provision.apk…
Optimizing Bluetooth.apk…
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/repack.d/_xbin.sqf, block size 131072.

Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments, compressed xattrs
duplicates are removed
Filesystem size 4092.68 Kbytes (4.00 Mbytes)
55.82% of uncompressed filesystem size (7331.98 Kbytes)
Inode table size 1349 bytes (1.32 Kbytes)
18.67% of uncompressed inode table size (7225 bytes)
Directory table size 1943 bytes (1.90 Kbytes)
63.98% of uncompressed directory table size (3037 bytes)
Number of duplicate files found 0
Number of inodes 224
Number of files 60
Number of fragments 12
Number of symbolic links  163
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 1
Number of ids (unique uids + gids) 1
Number of uids 1
jadecolour (1000)
Number of gids 1
jadecolour (1000)
Zipping package…
Signing package…
Cleaning up…

Package complete: /home/jadecolour/Projects/android/system/out/target/product/dream_sapphire/

About jadecolour

One of the seven billion on this planet.


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s