wiki:Devices/HTCDream/InstallGuide

Introduction

This guide applies to the HTC Dream/T-Mobile G1/ADP1 (Android Developer Phone 1)

Recently some official HTC Dream images were built, meaning that you can now install SHR! However, because these images are recent, only shr-unstable is available. This can be tried (boot kernel from fastboot) or installed (kernel in flash).

For reference, and so you know what to expect here's a  detailed status (and comparison with other hardware) of the hardware support.

Installation

You will need

  •  Fastboot (Free and Open Source version available. SHR can build one, and you can too.)
  • For now, a Linux installation on your PC.eg., Ubuntu.
  • Images from  http://build.shr-project.org/shr-unstable/images/htcdream/
    • A fastboot kernel (ends in .fastboot)
    • A root filesystem archive (full-htcdream.tar.gz)
  • A blank MicroSD card (You will lose any data on your MicroSD card)
    • Do not have apps or data on this SD card, you will lose them.
  • A MicroSD card reader (Formatting in the phone does not work.)
  • A compatible phone.
    • HTC Dream (rooted)
    • T-Mobile G1 (rooted)
    • ADP1 (Android Developer Phone version 1)

Formatting your MicroSD card

Put your SD card into your reader, and attach your reader to your PC.

Note: You cannot format your MicroSD card in the phone. Ensure you use a reader.

Basically you will format the card to a single ext2 or ext3 partition.It's easier (less risk of failure) to make only one partition. The kernel image expects the root filesystem to be on the first partition of the SD card which should be ext2 or ext3.

BEWARE: Be very careful to select the SD card as all data on the disk will be lost.

You can use gparted for this or do it from the command line, using fdisk and mkfs.ext3. You should replace SDCARDDEVICE with your actual device, being careful not to choose your hard disk.

    $ sudo fdisk /dev/SDCARDDEVICE

Now, you should see a Command (m for help): prompt. Type 'p<enter>' to show the current partition layout. You should see something similar to this

Disk /dev/SDCARDDEVICE: 1977 MB, 1977614336 bytes
1 heads, 62 sectors/track, 62298 cylinders
Units = cylinders of 62 * 512 = 31744 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/SDCARDDEVICE1      2       62298     1931207    c  W95 FAT32 (LBA)

First, check that this looks right. Here, the device is 1977MB which corresponds to a 2GB MicroSD card.

Now, change the type of the partition to Linux (Id 83). At the command prompt, type 't<enter>' to set the partition type. You should then see

Selected partition 1
Hex code (type L to list codes):

Type '83<enter>'. You should be back at the Command (m for help): prompt. Type 'w<enter>' to write your changes to disk. You should see:

The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Now, being careful to select the SD card (and to include the 1), format your partition with:

sudo mkfs.ext3 /dev/SDCARDDEVICE1

Extracting SHR image into root filesystem

Now the MicroSD card is formatted, simply extract the tarball to it as root (very important) For instance,if the SD Card is mounted to /media/sdcard and that the shr-image was downloaded in /home/user/Downloads/full-htcdream.tar.gz do:

 cd /media/sdcard
 sudo tar xvzpf home/user/Downloads/full-htcdream.tar.gz
 cd

Then unmount the SD card. Ensure that you wait for the SD card to be unmounted before removing it or the reader. Then put the SD card into your phone.

Booting the phone from fastboot

Firstly, if you don't have fastboot installed do:

git clone git://git.freesmartphone.org/utilities.git
cd utilities/android/image-utils
sh autogen.sh
make
cd fastboot 
./fastboot

Now ensure that your phone is in fastboot USB mode: Turn off your phone, plug it into USB on your computer, and whilst holding down the back button, press the power button. It should now show a screen with some text, including the words 'FASTBOOT USB'.

Assuming the kernel image was downloaded in /home/user/Downloads/zImage-2.6.32+r22+gitr013075354e0b533991650ec756605ad4731e6a0c-r22-htcdream.fastboot, you can now boot SHR with:

sudo ./fastboot boot /home/user/Downloads/zImage-2.6.32+r22+gitr013075354e0b533991650ec756605ad4731e6a0c-r22-htcdream.fastboot

Replace the zimage version by the one you downloaded. Note that the image should be a .fastboot image

Now, wait a very long time for SHR post-install configuration screen to come up.

Optional: Installing SHR to flash

If you plan to install shr permanantly,simply flash the kernel image on the boot partition.

There are 3 ways to do it:

  • from an android recovery image like cm-recovery-1.4
  • from shr itself(for instance boot with fastboot)
  • with fastboot itself (require an unlocked bootloader)

You can do this instead of booting from fastboot.

Troubleshooting

My phone is endlessly rebooting (or just reboots itself)

The usual reason is that the kernel couldn't find the root filesystem on the MicroSD card. A common reason for this is formatting the SD card in the phone and not a dedicated reader.

Initial configuration

Right after booting the HTC Dream (so at the first boot), you will have to wait a long time:

  • Before X starts (Most of this will be at the SHR boot logo).
  • At the lock screen, before it loads the initial configuration application (an application that let you configure the phone).

Note that if you don't set a password during the configuration, everyone can ssh into your phone (from wifi, 3G, USB...)

Post-install configuration

GPS

  • GPS should work out of the box.
  • Don't run the "gps" command line program manually(it could make your phone reboot).

Wifi

First note that the htcdream's wifi driver shipped with the kernel we ship doesn't support PSM,that means that you can expect a very short battery life when using wifi,but in another hand it will be very fast and responsive. In order to make wifi work,you need the firmware and the calibration files,  the howto is here

In order to load wifi do:

modprobe wl1251_sdio
modprobe msm_wifi
sleep 4
cd /sys/class/rfkill
cd $(ls |grep -v rfkill0)
echo 1 > state
ifconfig wlan0 up

xorg tweaks

  • to rotate the screen you need to:
    • comment the lines containing
      #comment for disabling rotation
      
    • restart xorg

midori(has been replaced by eve in the images) tweaks

In order to have kinetic scrolling in midori(thanks to always innovating for the trick):

  • add the following line to /usr/share/themes/shr-theme-gtk-e17lookalike/gtk-2.0/gtkrc
    gtk-touchscreen-mode = 1
    
  • add the following file:
    // ==UserScript==
    // @name Gregoire
    // @description Description
    // @include *
    // ==/UserScript==
    
    function mousedown_hook(e) {
    if ( (e.target.nodeName != "INPUT") && (e.target.nodeName != "TEXTAREA") )
     e.preventDefault();
    }
    
    window.addEventListener("mousedown", mousedown_hook, true);
    

to that location:

/home/root/.local/share/midori/scripts/no-selection.js