November 17, 2011

Upgrading G1 from CM4.2 to CM7.1

It is not difficult to compile a CM7.1 rom by yourself. It is not fun to follow instructions to compile and flash the rom, what is really fun is the process of finding out why other people's rom works well but your rom make your G1 brick.

Initially, I just checkout the code from github, compile the code, pack my own rom and then flash it to my phone. Then the phone "brick"(It is not brick actually because it still boot into bootoloader mode and use fastboot), stuck at splash screen and ADB not yet started(no debug message) !!! Now it becomes fun.

After googling, I find that HTC released new bootloader and radio that give my G1 15MB extra RAM, I need a patched kernel to work with the new firmware and ezterry published his rom GINGERBREAD-DS-Gamma-20111107 which works properly on g1.

I boot into bootloader mode and flash the following images using fastboot:
  • New bootloader: Hboot 1.33.0013d 
  • New radio: 2.22.27.08 
  • New recovery: RA-dream-v1.7.0 cyan 
and then reboot into recovery mode and flash my CM7.1 rom and ez-nightly271-cm-2708port_S kernel.

This time, much better since I can view debug message using logcat although it still stuck at splash screen.

The logcat shows that something wrong with the propriety libcamera.so(the file is copied from cm4.2), it cannot locate the symbol "_ZN7android16CameraParametersC1Ev".

Let's find out what happen to libcamera.so and compare with libraries in GINGERBREAD-DS-Gamma-20111107 rom.
The readelf command show that libcamera.so linked to the following libraris:

[jason@jasonpc tmp]$ readelf -a old-libcamera.so|grep "Shared library"
0x00000001 (NEEDED) Shared library: [libutils.so]
0x00000001 (NEEDED) Shared library: [libui.so]
0x00000001 (NEEDED) Shared library: [liblog.so]
0x00000001 (NEEDED) Shared library: [libcamera_client.so]
0x00000001 (NEEDED) Shared library: [libbinder.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libc.so]
0x00000001 (NEEDED) Shared library: [libstdc++.so]
0x00000001 (NEEDED) Shared library: [libm.so]


[jason@jasonpc tmp]$ readelf -a ezgingerbread-libcamera.so|grep "Shared library"
0x00000001 (NEEDED) Shared library: [libutils.so]
0x00000001 (NEEDED) Shared library: [libui.so]
0x00000001 (NEEDED) Shared library: [liblog.so]
0x00000001 (NEEDED) Shared library: [libcamera_client.so]
0x00000001 (NEEDED) Shared library: [libbinder.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libc.so]
0x00000001 (NEEDED) Shared library: [libstdc++.so]
0x00000001 (NEEDED) Shared library: [libm.so]

ezgingerbread's libcamera.so needs libcamera_client.so while my old-libcamera.so does not.
Let's look into libui.so and libcamera_client.so.

The nm command shows the symbol in the dynamic library.
[jason@jasonpc tmp]$ nm -D old-libui.so |grep _ZN7android16CameraParametersC1Ev
000177e9 T _ZN7android16CameraParametersC1Ev

[jason@jasonpc tmp]$ nm -D ezgingerbread-libui.so |grep _ZN7android16CameraParametersC1Ev
[jason@jasonpc tmp]$

[jason@jasonpc tmp]$ nm -D ezgingerbread/system/lib/libcamera_client.so |grep _ZN7android16CameraParametersC1Ev
0000d155 T _ZN7android16CameraParametersC1Ev

git log shows that the CameraParameter class has been moved from libui.so to libcamera_client.so since Froyo. That is why the old libcamera.so cannot find the symbol and the new library linked to libui.so.

Since I dont have a workable libcamera.so, I just copied the one from GINGERBREAD-DS-Gamma-20111107 rom. After using the new libcamera.so, the phone boot up successfully though there still few other errors.



References:
ezterry 's post on xda-developers

No comments:

Post a Comment