Jun Sun's Notes on Android Development Phone 1 (ADP1)
Jun Sun
jsun@junsun.net
My environment
fastboot cannot flash images when the host is a VM image. In my case, I have tried with an VM image that runs on vmserver. Flashing will hang forever.
If you have got a regular T-mobile G1 phone, please follow this guide to unlock and root the device so that it basically becomes a dev phone.
Connect to the device
- Build or install adb to your host. Make sure it is in your execution path.
- Create /etc/udev/rules.d/51-android.rules as follows:
SUBSYSTEM=="usb",SYSFS{idVendor}=="0bb4",SYMLINK+="android_adb",MODE="0666"
- Reload the rules: udevcontrol reload_rules
- Plug in device, and you will see something like
[jsun@jessica ~]$ adb devices
List of devices attached
HT845GZ51672 device
- Typing "adb shell" will give a shell to the phone.
Note:
adb will be created under <android_root>/out/host/linux-x86/bin in the following step. However, you might need it now for testing and extracting purpose. You can download the Android pre-built SDK or just my pre-built version for Fedora 10 at here. It should work for all recent Linux distros.
Install busybox
If you would like to have some conenienve while you are inside android phone, you will definitely need to install busybox.
- Download a pre-built busybox binary and the installation script. (Yes, unfortunately the self-installation does not work because it likes to install at /bin/ and /sbin etc)
- adb push them to the phone's /data/bin/ directory
- adb shell: cd /data/bin; chmod 755 ./busybox; sh install-busybox
- Optionally, add /data/bin to your path. (TODO: basically modify init.rc file in the root/boot image).
Apparently, the JF hacked images already have busybox installed. So you may skip this step with those community images.
Get around activation and registration
You can find a link below that covers this topic in depths. Here is a quick gist of some of the steps.
- To work around "No SIM card found" screen, run this command from adb shell console with root previlidge:
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO system (name, value) VALUES ('device_provisioned', 1);"
- To set up wifi, run this command from adb shell:
am start -a android.intent.action.MAIN -n com.android.settings/.Settings
- To avoid Android market registeration, do "vi /data/system/packages.xml" (vi comes with busybox), search for "<package name="com.android.setupwizard" ..." line, add the following before "</package>":
<disabled-components>
<item name="com.android.setupwizard.SetupWizardActivity" />
</disabled-components>
so that the whole section will look like:
<package name="com.android.setupwizard" codePath="/system/app/SetupWizard.apk" system="true" ts="1217592000000" userId="10010">
<sigs count="1">
<cert index="0" />
</sigs>
<disabled-components>
<item name="com.android.setupwizard.SetupWizardActivity" />
</disabled-components>
</package>
Change boot-up picture
Refer to http://forum.xda-developers.com/showthread.php?t=456071 for details.
Here are the quick steps for changing to netspectrum logo picture:
- Download the iamge file
- Connect the phone to the PC with fastboot executable installed.
- Reboot the phone to fastboot mode. Press camera button while pressing power button.
- Once it is up with "serial0", press return button a couple of times until you see "fastboot".
- Type on PC
fastboot devices
fastboot flash splash1 netspectrum-splash.raw565
fastboot reboot
The first command is to check the connection with the device.
Build from the source
- Obtain and install Sun's JDK 5 from here (Just JDK is sufficient)
- Prepare generic Android source according to Google's instruction. Note you may stop before "repo sync" step which pulls all the sources. The next step will pull the source again.
- Get additional sources for HTC devices based on another Google's doc
- Follow the remaining steps mentioned in the above link (i.e., extrace binary files, create buildspec.mk and type make)
- If you don't have the Android phone with you, you can grab the extracted files from this tarball and just untar from the root of your Android build directory.
Re-Build the kernel
- Prepare kernel source (TODO)
- Obtain a config file (TODO)
- make ARCH=arm CROSS_COMPILE=/home/jsun/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- zImage
- Use arch/arm/boot/zImage to make a new boot image (TODO)
Enable USB networking
This hack does the job. However, It is not cleaned up at all. Use at your own risk. Also, the credit really goes back to one engr in Google who did the work for 2.6.27. I just backported to the release kernel.
Note you will lose adb feature if you enable usbnet.
(TODO)
Get rid of "System Update" reminder
For some reasons, a reminder starts to pop up that asks you to update. If you do, then you may loose some of the stuff you did. Not sure if the update comes from JF, or comes from T-mobile. In any case, it is very annoying. Here is the the workaround.
You need to log in as a root.
/ # mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
/ # cd /system
/system # cd app
/system/app # mv SystemUpdater.apk SystmeUpdater.apk.orig
/system/app # mv SystemUpdater.odex SystemUpdater.odex.orig
/system/app # cd /
/ # mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
References