initial commit
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..eff3f6a
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,48 @@
+LOCAL_PATH := $(call my-dir)
+
+# kernel binary
+#
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel
+endif
+
+file := $(INSTALLED_KERNEL_TARGET)
+ALL_PREBUILT += $(file)
+$(file): $(TARGET_PREBUILT_KERNEL) | $(ACP)
+ $(transform-prebuilt-to-target)
+
+# keyboard layouts
+#
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/trout-keypad-v3.kl:system/usr/keylayout/trout-keypad-v3.kl \
+ $(LOCAL_PATH)/trout-keypad-qwertz.kl:system/usr/keylayout/trout-keypad-qwertz.kl \
+ $(LOCAL_PATH)/h2w_headset.kl:system/usr/keylayout/h2w_headset.kl
+
+# keyboard maps
+#
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := trout-keypad-v3.kcm
+include $(BUILD_KEY_CHAR_MAP)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := trout-keypad-qwertz.kcm
+include $(BUILD_KEY_CHAR_MAP)
+
+# board specific init.rc
+#
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/init.trout.rc:root/init.trout.rc
+
+# htc proprietary code
+#
+proprietary := $(LOCAL_PATH)/proprietary
+
+PRODUCT_COPY_FILES += \
+ $(proprietary)/libhtc_ril.so:system/lib/libhtc_ril.so \
+ $(proprietary)/akmd:system/bin/akmd \
+ $(proprietary)/AudioFilter.csv:system/etc/AudioFilter.csv
+
+PRODUCT_COPY_FILES += \
+ $(proprietary)/AudioPara4.csv:system/etc/AudioPara4.csv \
+ $(proprietary)/gps.conf:system/etc/gps.conf
+
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
new file mode 100644
index 0000000..b0eaba3
--- /dev/null
+++ b/AndroidProducts.mk
@@ -0,0 +1,3 @@
+
+PRODUCT_MAKEFILES := \
+ $(LOCAL_DIR)/htc_dream.mk
diff --git a/BoardConfig.mk b/BoardConfig.mk
new file mode 100644
index 0000000..d5fce70
--- /dev/null
+++ b/BoardConfig.mk
@@ -0,0 +1,21 @@
+
+# Dream uses HTC's bootloader, not one from source
+#
+TARGET_NO_BOOTLOADER := true
+
+# Kernel/Bootloader machine name
+#
+TARGET_BOOTLOADER_BOARD_NAME := trout
+
+BOARD_USES_GENERIC_AUDIO := true
+
+# Flash Partition size limits for build sanity checking
+#
+BOARD_BOOTIMAGE_MAX_SIZE := 2621440
+BOARD_RECOVERYIMAGE_MAX_SIZE := 5242880
+BOARD_SYSTEMIMAGE_MAX_SIZE := 70778880
+BOARD_USERDATAIMAGE_MAX_SIZE := 78381056
+
+# Erase Unit size
+#
+BOARD_FLASH_BLOCK_SIZE := 131072
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..e2ebcd0
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,21 @@
+
+---- build configuration ----
+
+You can configure to build for HTC Dream (aka T-Mobile G1) by putting
+the following in your buildspec.mk file at the root of the source tree:
+
+TARGET_PRODUCT := htc_dream
+TARGET_PREBUILD_KERNEL := /path/to/kernel/arch/arm/boot/zImage
+
+---- proprietary files ----
+
+The HTC Dream device includes a small number of proprietary binary
+files that are necessary for Android to work correctly on it.
+
+They can be obtained from your Dream device by running the
+extract-files.sh script in this directory. It will create the
+proprietary subdirectory, and use adb (which will need to be in
+your path) to copy the files from your device. You will need to
+enable USB Debugging (under Settings/Applications/Development)
+for this to work.
+
diff --git a/extract-files.sh b/extract-files.sh
new file mode 100755
index 0000000..fa30812
--- /dev/null
+++ b/extract-files.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+mkdir -p proprietary
+adb pull /system/etc/AudioFilter.csv proprietary/AudioFilter.csv
+adb pull /system/etc/AudioPara4.csv proprietary/AudioPara4.csv
+adb pull /system/etc/gps.conf proprietary/gps.conf
+adb pull /system/bin/akmd proprietary/akmd
+adb pull /system/lib/libhtc_ril.so proprietary/libhtc_ril.so
+chmod 755 proprietary/akmd
+
diff --git a/h2w_headset.kl b/h2w_headset.kl
new file mode 100644
index 0000000..8702475
--- /dev/null
+++ b/h2w_headset.kl
@@ -0,0 +1 @@
+key 226 HEADSETHOOK WAKE
diff --git a/htc_dream.mk b/htc_dream.mk
new file mode 100644
index 0000000..125e417
--- /dev/null
+++ b/htc_dream.mk
@@ -0,0 +1,9 @@
+
+# Superclass
+$(call inherit-product, build/target/product/generic.mk)
+
+# Overrides
+PRODUCT_NAME := htc_dream
+PRODUCT_DEVICE := dream
+PRODUCT_MANUFACTURER := htc
+
diff --git a/init.trout.rc b/init.trout.rc
new file mode 100644
index 0000000..de41a72
--- /dev/null
+++ b/init.trout.rc
@@ -0,0 +1,68 @@
+on early-init
+ device mtd@misc 0460 radio diag
+
+on boot
+# unmap left alt to avoid console switch
+ setkey 0x0 0x38 0x0
+# dream reset SEND+MENU+END
+ setkey 0x0 0xe7 0x706
+ setkey 0x0 0x8b 0x707
+
+ setkey 0x40 0xe7 0x706
+ setkey 0x40 0x8b 0x707
+
+ setkey 0x80 0xe7 0x706
+ setkey 0x80 0x8b 0x707
+
+ setkey 0xc0 0xe7 0x706
+ setkey 0xc0 0x8b 0x707
+ setkey 0xc0 0x6b 0x20c
+
+ mkdir /data/misc/wifi 0770 wifi wifi
+ mkdir /data/misc/wifi/sockets 0770 wifi wifi
+ mkdir /data/misc/dhcp 0770 dhcp dhcp
+ chown dhcp dhcp /data/misc/dhcp
+
+ #TODO: remove these two once we switch kernel to rfkill interface
+ chown bluetooth bluetooth /sys/module/board_trout/parameters/bluetooth_power_on
+ chmod 0660 /sys/module/board_trout/parameters/bluetooth_power_on
+
+ # bluetooth power up/down interface
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
+ chmod 0660 /sys/class/rfkill/rfkill0/state
+
+on property:init.svc.wpa_supplicant=stopped
+ stop dhcpcd
+
+# compass/accelerometer daemon
+service akmd /system/bin/akmd
+ user compass
+ group compass misc input
+
+service wlan_loader /system/bin/wlan_loader \
+ -f /system/etc/wifi/Fw1251r1c.bin -e /proc/calibration \
+ -i /system/etc/wifi/tiwlan.ini
+ disabled
+ oneshot
+
+service wpa_supplicant /system/bin/wpa_supplicant \
+ -Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf
+ user wifi
+ group wifi inet
+ socket wpa_tiwlan0 dgram 660 wifi wifi
+ disabled
+ oneshot
+
+# for the moment, while debugging dhcpcd, logwrapper is
+# used to get its output to appear in the logs. This will
+# be removed before shipping.
+service dhcpcd /system/bin/logwrapper dhcpcd -d -X tiwlan0
+ disabled
+ oneshot
+
+service hciattach /system/bin/hciattach \
+ -n -s 115200 /dev/ttyMSM0 texas 115200 flow
+ user bluetooth
+ group bluetooth net_bt_admin
+ disabled
diff --git a/system.prop b/system.prop
new file mode 100644
index 0000000..b231f25
--- /dev/null
+++ b/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for dream
+#
+
+rild.libpath=/system/lib/libhtc_ril.so
+wifi.interface = tiwlan0
diff --git a/trout-keypad-qwertz.kcm b/trout-keypad-qwertz.kcm
new file mode 100644
index 0000000..3244f11
--- /dev/null
+++ b/trout-keypad-qwertz.kcm
@@ -0,0 +1,67 @@
+[type=QWERTY]
+
+# keycode display number base caps fn caps_fn
+
+A 'A' '2' 'a' 'A' 0x00E4 0x00C4
+B 'B' '2' 'b' 'B' '>' 'B'
+C 'C' '2' 'c' 'C' ']' 0x00E7
+D 'D' '3' 'd' 'D' '\' 0x00
+E 'E' '3' 'e' 'E' 0x20AC 0x0301
+F 'F' '3' 'f' 'F' '{' 0x00A5
+G 'G' '4' 'g' 'G' '}' '_'
+H 'H' '4' 'h' 'H' 0x00D7 '{'
+I 'I' '4' 'i' 'I' '-' 0x0302
+J 'J' '5' 'j' 'J' ':' '}'
+K 'K' '5' 'k' 'K' '+' '~'
+L 'L' '5' 'l' 'L' ''' '`'
+M 'M' '6' 'm' 'M' '"' 0x00
+N 'N' '6' 'n' 'N' ';' 0x0303
+O 'O' '6' 'o' 'O' 0x00F6 0x00D6
+P 'P' '7' 'p' 'P' '=' 0x00
+Q 'Q' '7' 'q' 'Q' 0x9 0x0300
+R 'R' '7' 'r' 'R' '_' 0x00
+S 'S' '7' 's' 'S' 0x00DF 'S'
+T 'T' '8' 't' 'T' 0x00A3 0x00A3
+U 'U' '8' 'u' 'U' 0x00FC 0x00DC
+V 'V' '8' 'v' 'V' '<' 'V'
+W 'W' '9' 'w' 'W' '`' 0x00
+X 'X' '9' 'x' 'X' '[' 0xEF00
+Y 'Y' '9' 'y' 'Y' '|' 0x00
+Z 'Z' '9' 'z' 'Z' 0x00F7 0x00A1
+
+COMMA ',' ',' ',' '?' '?' ','
+PERIOD '.' '.' '.' '/' '/' 0x2026
+AT '@' 0x00 '@' '~' '~' 0x2022
+SLASH '/' '/' '/' '?' '?' '\'
+
+SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
+ENTER 0xa 0xa 0xa 0xa 0xa 0xa
+
+0 '0' '0' '0' ')' ')' ')'
+1 '1' '1' '1' '!' '!' '!'
+2 '2' '2' '2' '@' '@' '@'
+3 '3' '3' '3' '#' '#' '#'
+4 '4' '4' '4' '$' '$' '$'
+5 '5' '5' '5' '%' '%' '%'
+6 '6' '6' '6' '^' '^' '^'
+7 '7' '7' '7' '&' '&' '&'
+8 '8' '8' '8' '*' '*' '*'
+9 '9' '9' '9' '(' '(' '('
+
+
+# these are not actually on the Dream keypad... remove?
+TAB 0x9 0x9 0x9 0x9 0x9 0x9
+GRAVE '`' '`' '`' '~' '`' '~'
+MINUS '-' '-' '-' '_' '-' '_'
+EQUALS '=' '=' '=' '+' '=' '+'
+LEFT_BRACKET '[' '[' '[' '{' '[' '{'
+RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
+BACKSLASH '\' '\' '\' '|' '\' '|'
+SEMICOLON ';' ';' ';' ':' ';' ':'
+APOSTROPHE ''' ''' ''' '"' ''' '"'
+STAR '*' '*' '*' '*' '*' '*'
+POUND '#' '#' '#' '#' '#' '#'
+PLUS '+' '+' '+' '+' '+' '+'
+
+
+
diff --git a/trout-keypad-qwertz.kl b/trout-keypad-qwertz.kl
new file mode 100644
index 0000000..abd264a
--- /dev/null
+++ b/trout-keypad-qwertz.kl
@@ -0,0 +1,87 @@
+key 399 GRAVE
+key 2 1 WAKE_DROPPED
+key 3 2 WAKE_DROPPED
+key 4 3 WAKE_DROPPED
+key 5 4 WAKE_DROPPED
+key 6 5 WAKE_DROPPED
+key 7 6 WAKE_DROPPED
+key 8 7 WAKE_DROPPED
+key 9 8 WAKE_DROPPED
+key 10 9 WAKE_DROPPED
+key 11 0 WAKE_DROPPED
+key 158 BACK WAKE_DROPPED
+key 230 SOFT_RIGHT WAKE
+key 60 SOFT_RIGHT WAKE
+key 107 ENDCALL WAKE_DROPPED
+key 62 ENDCALL WAKE_DROPPED
+key 229 MENU WAKE_DROPPED
+key 59 MENU WAKE_DROPPED
+key 139 MENU WAKE_DROPPED
+key 127 SEARCH WAKE_DROPPED
+key 228 POUND WAKE_DROPPED
+key 227 STAR
+key 231 CALL WAKE_DROPPED
+key 61 CALL WAKE_DROPPED
+key 232 DPAD_CENTER WAKE_DROPPED
+key 108 DPAD_DOWN WAKE_DROPPED
+key 103 DPAD_UP WAKE_DROPPED
+key 102 HOME WAKE
+key 105 DPAD_LEFT WAKE_DROPPED
+key 106 DPAD_RIGHT WAKE_DROPPED
+key 115 VOLUME_UP WAKE
+key 114 VOLUME_DOWN WAKE
+key 116 POWER WAKE
+key 211 FOCUS
+key 212 CAMERA
+
+key 16 Q WAKE_DROPPED
+key 17 W WAKE_DROPPED
+key 18 E WAKE_DROPPED
+key 19 R WAKE_DROPPED
+key 20 T WAKE_DROPPED
+key 21 Z WAKE_DROPPED
+key 22 U WAKE_DROPPED
+key 23 I WAKE_DROPPED
+key 24 O WAKE_DROPPED
+key 25 P WAKE_DROPPED
+key 26 LEFT_BRACKET WAKE_DROPPED
+key 27 RIGHT_BRACKET WAKE_DROPPED
+key 43 BACKSLASH WAKE_DROPPED
+
+key 30 A WAKE_DROPPED
+key 31 S WAKE_DROPPED
+key 32 D WAKE_DROPPED
+key 33 F WAKE_DROPPED
+key 34 G WAKE_DROPPED
+key 35 H WAKE_DROPPED
+key 36 J WAKE_DROPPED
+key 37 K WAKE_DROPPED
+key 38 L WAKE_DROPPED
+key 39 SEMICOLON WAKE_DROPPED
+key 40 APOSTROPHE WAKE_DROPPED
+key 14 DEL WAKE_DROPPED
+
+key 44 Y WAKE_DROPPED
+key 45 X WAKE_DROPPED
+key 46 C WAKE_DROPPED
+key 47 V WAKE_DROPPED
+key 48 B WAKE_DROPPED
+key 49 N WAKE_DROPPED
+key 50 M WAKE_DROPPED
+key 51 COMMA WAKE_DROPPED
+key 52 PERIOD WAKE_DROPPED
+key 53 SLASH WAKE_DROPPED
+key 28 ENTER WAKE_DROPPED
+
+key 56 ALT_LEFT WAKE
+key 100 ALT_RIGHT WAKE
+key 42 SHIFT_LEFT WAKE
+key 54 SHIFT_RIGHT WAKE
+key 15 TAB WAKE_DROPPED
+key 57 SPACE WAKE_DROPPED
+key 150 EXPLORER
+key 155 ENVELOPE
+
+key 12 MINUS WAKE_DROPPED
+key 13 EQUALS WAKE_DROPPED
+key 215 AT WAKE_DROPPED
diff --git a/trout-keypad-v3.kcm b/trout-keypad-v3.kcm
new file mode 100644
index 0000000..af13ef2
--- /dev/null
+++ b/trout-keypad-v3.kcm
@@ -0,0 +1,67 @@
+[type=QWERTY]
+
+# keycode display number base caps alt caps_alt
+
+A 'A' '2' 'a' 'A' 'a' 'A'
+B 'B' '2' 'b' 'B' ']' ']'
+C 'C' '2' 'c' 'C' 'c' 0x00E7
+D 'D' '3' 'd' 'D' '\' '\'
+E 'E' '3' 'e' 'E' '_' 0x0301
+F 'F' '3' 'f' 'F' '{' '{'
+G 'G' '4' 'g' 'G' '}' '}'
+H 'H' '4' 'h' 'H' ':' ':'
+I 'I' '4' 'i' 'I' '-' 0x0302
+J 'J' '5' 'j' 'J' ';' ';'
+K 'K' '5' 'k' 'K' '"' '"'
+L 'L' '5' 'l' 'L' ''' '''
+M 'M' '6' 'm' 'M' '>' '>'
+N 'N' '6' 'n' 'N' '<' 0x0303
+O 'O' '6' 'o' 'O' '+' '+'
+P 'P' '7' 'p' 'P' '=' '='
+Q 'Q' '7' 'q' 'Q' 0x9 0x09
+R 'R' '7' 'r' 'R' 0x00A3 0x00A3
+S 'S' '7' 's' 'S' '|' 0x00DF
+T 'T' '8' 't' 'T' 0x20AC 0x20AC
+U 'U' '8' 'u' 'U' 0xd7 0x0308
+V 'V' '8' 'v' 'V' '[' '['
+W 'W' '9' 'w' 'W' '`' 0x0300
+X 'X' '9' 'x' 'X' 'x' 0xEF00
+Y 'Y' '9' 'y' 'Y' 0xf7 0x00A5
+Z 'Z' '9' 'z' 'Z' 'z' 'Z'
+
+COMMA ',' ',' ',' '?' '?' 0x00BF
+PERIOD '.' '.' '.' '/' '/' 0x2026
+AT '@' 0x00 '@' '~' '~' 0x2022
+
+SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
+ENTER 0xa 0xa 0xa 0xa 0xa 0xa
+
+0 '0' '0' '0' ')' ')' ')'
+1 '1' '1' '1' '!' '!' 0x00A1
+2 '2' '2' '2' '@' '@' '@'
+3 '3' '3' '3' '#' '#' '#'
+4 '4' '4' '4' '$' '$' 0x00A2
+5 '5' '5' '5' '%' '%' '%'
+6 '6' '6' '6' '^' '^' '^'
+7 '7' '7' '7' '&' '&' '&'
+8 '8' '8' '8' '*' '*' '*'
+9 '9' '9' '9' '(' '(' '('
+
+
+# these are not actually on the Dream keypad... remove?
+TAB 0x9 0x9 0x9 0x9 0x9 0x9
+GRAVE '`' '`' '`' '~' '`' '~'
+MINUS '-' '-' '-' '_' '-' '_'
+EQUALS '=' '=' '=' '+' '=' '+'
+LEFT_BRACKET '[' '[' '[' '{' '[' '{'
+RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
+BACKSLASH '\' '\' '\' '|' '\' '|'
+SEMICOLON ';' ';' ';' ':' ';' ':'
+APOSTROPHE ''' ''' ''' '"' ''' '"'
+STAR '*' '*' '*' '*' '*' '*'
+POUND '#' '#' '#' '#' '#' '#'
+PLUS '+' '+' '+' '+' '+' '+'
+SLASH '/' '/' '/' '?' '?' '\'
+
+
+
diff --git a/trout-keypad-v3.kl b/trout-keypad-v3.kl
new file mode 100644
index 0000000..3fdbd97
--- /dev/null
+++ b/trout-keypad-v3.kl
@@ -0,0 +1,87 @@
+key 399 GRAVE
+key 2 1 WAKE_DROPPED
+key 3 2 WAKE_DROPPED
+key 4 3 WAKE_DROPPED
+key 5 4 WAKE_DROPPED
+key 6 5 WAKE_DROPPED
+key 7 6 WAKE_DROPPED
+key 8 7 WAKE_DROPPED
+key 9 8 WAKE_DROPPED
+key 10 9 WAKE_DROPPED
+key 11 0 WAKE_DROPPED
+key 158 BACK WAKE_DROPPED
+key 230 SOFT_RIGHT WAKE
+key 60 SOFT_RIGHT WAKE
+key 107 ENDCALL WAKE_DROPPED
+key 62 ENDCALL WAKE_DROPPED
+key 229 MENU WAKE_DROPPED
+key 59 MENU WAKE_DROPPED
+key 139 MENU WAKE_DROPPED
+key 127 SEARCH WAKE_DROPPED
+key 228 POUND WAKE_DROPPED
+key 227 STAR
+key 231 CALL WAKE_DROPPED
+key 61 CALL WAKE_DROPPED
+key 232 DPAD_CENTER WAKE_DROPPED
+key 108 DPAD_DOWN WAKE_DROPPED
+key 103 DPAD_UP WAKE_DROPPED
+key 102 HOME WAKE
+key 105 DPAD_LEFT WAKE_DROPPED
+key 106 DPAD_RIGHT WAKE_DROPPED
+key 115 VOLUME_UP WAKE
+key 114 VOLUME_DOWN WAKE
+key 116 POWER WAKE
+key 211 FOCUS
+key 212 CAMERA
+
+key 16 Q WAKE_DROPPED
+key 17 W WAKE_DROPPED
+key 18 E WAKE_DROPPED
+key 19 R WAKE_DROPPED
+key 20 T WAKE_DROPPED
+key 21 Y WAKE_DROPPED
+key 22 U WAKE_DROPPED
+key 23 I WAKE_DROPPED
+key 24 O WAKE_DROPPED
+key 25 P WAKE_DROPPED
+key 26 LEFT_BRACKET WAKE_DROPPED
+key 27 RIGHT_BRACKET WAKE_DROPPED
+key 43 BACKSLASH WAKE_DROPPED
+
+key 30 A WAKE_DROPPED
+key 31 S WAKE_DROPPED
+key 32 D WAKE_DROPPED
+key 33 F WAKE_DROPPED
+key 34 G WAKE_DROPPED
+key 35 H WAKE_DROPPED
+key 36 J WAKE_DROPPED
+key 37 K WAKE_DROPPED
+key 38 L WAKE_DROPPED
+key 39 SEMICOLON WAKE_DROPPED
+key 40 APOSTROPHE WAKE_DROPPED
+key 14 DEL WAKE_DROPPED
+
+key 44 Z WAKE_DROPPED
+key 45 X WAKE_DROPPED
+key 46 C WAKE_DROPPED
+key 47 V WAKE_DROPPED
+key 48 B WAKE_DROPPED
+key 49 N WAKE_DROPPED
+key 50 M WAKE_DROPPED
+key 51 COMMA WAKE_DROPPED
+key 52 PERIOD WAKE_DROPPED
+key 53 SLASH WAKE_DROPPED
+key 28 ENTER WAKE_DROPPED
+
+key 56 ALT_LEFT WAKE
+key 100 ALT_RIGHT WAKE
+key 42 SHIFT_LEFT WAKE
+key 54 SHIFT_RIGHT WAKE
+key 15 TAB WAKE_DROPPED
+key 57 SPACE WAKE_DROPPED
+key 150 EXPLORER
+key 155 ENVELOPE
+
+key 12 MINUS WAKE_DROPPED
+key 13 EQUALS WAKE_DROPPED
+key 215 AT WAKE_DROPPED