DeprecatedBuildAndroid » History » Version 31
Denis 'GNUtoo' Carikli, 11/04/2010 09:54 PM
| 1 | 16 | Denis 'GNUtoo' Carikli | Edit: |
|---|---|---|---|
| 2 | We have now a temporary git repository at gitorious: |
||
| 3 | http://gitorious.org/replicant |
||
| 4 | |||
| 5 | 18 | Denis 'GNUtoo' Carikli | == Before starting == |
| 6 | 25 | Aaron Williamson - | * Root your phone |
| 7 | 1 | Denis 'GNUtoo' Carikli | * Backup your current system!!! |
| 8 | 25 | Aaron Williamson - | * Install git |
| 9 | 1 | Denis 'GNUtoo' Carikli | |
| 10 | 25 | Aaron Williamson - | == Setting up the build environment and getting source code == |
| 11 | 1 | Denis 'GNUtoo' Carikli | |
| 12 | 25 | Aaron Williamson - | These instructions assume that you are building replicant in your home directory (~). If you are building it in another directory, modify path names accordingly. |
| 13 | |||
| 14 | === Get the repo tool === |
||
| 15 | repo is a front-end to git which is used to manage several git repositories. |
||
| 16 | 15 | Aaron Williamson - | {{{ |
| 17 | 20 | Denis 'GNUtoo' Carikli | mkdir bin |
| 18 | 1 | Denis 'GNUtoo' Carikli | cd bin |
| 19 | wget http://android.git.kernel.org/repo |
||
| 20 | chmod a+x repo |
||
| 21 | cd .. |
||
| 22 | 25 | Aaron Williamson - | }}} |
| 23 | |||
| 24 | === Check out the Replicant repository === |
||
| 25 | This step will download the Android source (minus the kernel) and the Replicant patches. |
||
| 26 | {{{ |
||
| 27 | 1 | Denis 'GNUtoo' Carikli | mkdir replicant |
| 28 | cd replicant |
||
| 29 | 29 | Denis 'GNUtoo' Carikli | ../bin/repo init -u git://gitorious.org/replicant/manifest.git -b replicant |
| 30 | 1 | Denis 'GNUtoo' Carikli | ../bin/repo sync |
| 31 | }}} |
||
| 32 | 25 | Aaron Williamson - | |
| 33 | == Optional: building the kernel and wireless LAN driver == |
||
| 34 | |||
| 35 | By default, the Android build system uses a pre-compiled kernel and wireless driver rather than compiling these components from scratch. If you want to compile your own copy of either of these components, you have to compile both: the wireless driver sources included with Android are incompatible with the pre-compiled kernel. |
||
| 36 | |||
| 37 | === Get the kernel source === |
||
| 38 | |||
| 39 | To download the kernel sources, create a file in your replicant/.repo directory called "local_manifest.xml" containing the following: |
||
| 40 | {{{ |
||
| 41 | <?xml version="1.0" encoding="UTF-8"?> |
||
| 42 | <manifest> |
||
| 43 | <project path="kernel" name="kernel/msm" revision="refs/heads/android-msm-2.6.27"/> |
||
| 44 | </manifest> |
||
| 45 | }}} |
||
| 46 | |||
| 47 | Then from the ~/replicant/ directory, run: |
||
| 48 | {{{ |
||
| 49 | ../bin/repo sync |
||
| 50 | }}} |
||
| 51 | |||
| 52 | This will create a directory called replicant/kernel and download the kernel sources to it. |
||
| 53 | |||
| 54 | === Build the kernel === |
||
| 55 | |||
| 56 | To build the kernel: |
||
| 57 | |||
| 58 | {{{ |
||
| 59 | cd ~/replicant/kernel |
||
| 60 | export ARCH=arm |
||
| 61 | export CROSS_COMPILE=arm-eabi- |
||
| 62 | export PATH=$PATH:~/replicant/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin |
||
| 63 | cp arch/arm/configs/msm_defconfig .config |
||
| 64 | make oldconfig && make |
||
| 65 | }}} |
||
| 66 | |||
| 67 | Wait several hours. |
||
| 68 | |||
| 69 | === Point the build system to your kernel === |
||
| 70 | |||
| 71 | Create a file called `~/replicant/buildspec.mk` containing the following: |
||
| 72 | {{{ |
||
| 73 | TARGET_PRODUCT:=htc_dream |
||
| 74 | TARGET_PREBUILT_KERNEL:=kernel/arch/arm/boot/zImage |
||
| 75 | }}} |
||
| 76 | |||
| 77 | This will instruct the build process to use your kernel rather than the pre-compiled kernel. |
||
| 78 | |||
| 79 | === Build the wifi module === |
||
| 80 | |||
| 81 | To build the wifi module: |
||
| 82 | {{{ |
||
| 83 | cd ~/replicant/system/wlan/ti/sta_dk_4_0_4_32 |
||
| 84 | export KERNEL_DIR=~/replicant/kernel/ |
||
| 85 | make |
||
| 86 | }}} |
||
| 87 | |||
| 88 | (If make can't find your compiler, re-run same PATH export command you ran before compiling the kernel.) |
||
| 89 | |||
| 90 | Replace the pre-built wifi module with the one you just built: |
||
| 91 | {{{ |
||
| 92 | cp wlan.ko ~/replicant/vendor/htc/dream-open |
||
| 93 | }}} |
||
| 94 | |||
| 95 | == Build the firmware == |
||
| 96 | |||
| 97 | === Change the build scripts to include some important missing packages === |
||
| 98 | |||
| 99 | ''(This section will be removed once these changes are committed to the replicant repository)'' |
||
| 100 | |||
| 101 | Open the file {{{~/replicant/vendor/htc/dream-open/htc_dream.mk}}} and at the following text to the beginning of the file: |
||
| 102 | {{{ |
||
| 103 | PRODUCT_PACKAGES := \ |
||
| 104 | Calculator \ |
||
| 105 | Email \ |
||
| 106 | ImProvider \ |
||
| 107 | SdkSetup \ |
||
| 108 | VoiceDialer |
||
| 109 | }}} |
||
| 110 | |||
| 111 | This will include packages in the build which would otherwise be missing (including the SdkSetup package, which will enable incoming calls). |
||
| 112 | |||
| 113 | {{{ |
||
| 114 | cd ~/replicant |
||
| 115 | make |
||
| 116 | }}} |
||
| 117 | |||
| 118 | Wait and wait and wait. |
||
| 119 | |||
| 120 | 26 | Aaron Williamson - | == Flashing the new firmware == |
| 121 | |||
| 122 | [to be written] |
||
| 123 | |||
| 124 | == Building individual pieces == |
||
| 125 | |||
| 126 | === Each time you want to build something === |
||
| 127 | 22 | Denis 'GNUtoo' Carikli | * open a new console |
| 128 | * Then type: |
||
| 129 | 5 | Denis 'GNUtoo' Carikli | {{{ |
| 130 | cd ~/replicant |
||
| 131 | 28 | Denis 'GNUtoo' Carikli | source build/envsetup.sh |
| 132 | 5 | Denis 'GNUtoo' Carikli | export ANDROID_JAVA_HOME=$JAVA_HOME |
| 133 | lunch htc_dream-eng |
||
| 134 | make |
||
| 135 | 1 | Denis 'GNUtoo' Carikli | }}} |
| 136 | * The files to flash are in ~/replicant/out/target/product/dream,flash them and then clear the cache |
||
| 137 | * boot and push the wifi firmware if you want it |
||
| 138 | |||
| 139 | |||
| 140 | 26 | Aaron Williamson - | === If you want to build a particular project === |
| 141 | 24 | Denis 'GNUtoo' Carikli | * open a new console |
| 142 | * build everything if it was not done before |
||
| 143 | * Then type: |
||
| 144 | {{{ |
||
| 145 | cd ~/replicant |
||
| 146 | source build/envsetup.sh |
||
| 147 | export ANDROID_JAVA_HOME=$JAVA_HOME |
||
| 148 | lunch htc_dream-eng |
||
| 149 | #go into the directory containing an Android.mk |
||
| 150 | mm |
||
| 151 | 1 | Denis 'GNUtoo' Carikli | }}} |
| 152 | 30 | Denis 'GNUtoo' Carikli | |
| 153 | == error workarrounds == |
||
| 154 | === hyts_Foo.c === |
||
| 155 | if you have: |
||
| 156 | {{{ |
||
| 157 | target Java: SettingsProvider (out/target/common/obj/APPS/SettingsProvider_intermediates/classes) |
||
| 158 | target Java: Settings (out/target/common/obj/APPS/Settings_intermediates/classes) |
||
| 159 | java.util.zip.ZipException: duplicate entry: hyts_Foo.c |
||
| 160 | at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:192) |
||
| 161 | at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109) |
||
| 162 | at sun.tools.jar.Main.addFile(Main.java:731) |
||
| 163 | at sun.tools.jar.Main.update(Main.java:585) |
||
| 164 | at sun.tools.jar.Main.run(Main.java:220) |
||
| 165 | at sun.tools.jar.Main.main(Main.java:1167) |
||
| 166 | make: *** [out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar] Error 1 |
||
| 167 | make: *** Deleting file `out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar' |
||
| 168 | make: *** Waiting for unfinished jobs.... |
||
| 169 | Note: frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java uses or overrides a deprecated API. |
||
| 170 | Note: Recompile with -Xlint:deprecation for details. |
||
| 171 | Note: Some input files use or override a deprecated API. |
||
| 172 | Note: Recompile with -Xlint:deprecation for details. |
||
| 173 | Note: Some input files use or override a deprecated API. |
||
| 174 | Note: Recompile with -Xlint:deprecation for details. |
||
| 175 | Note: Some input files use unchecked or unsafe operations. |
||
| 176 | Note: Recompile with -Xlint:unchecked for details. |
||
| 177 | Note: Some input files use or override a deprecated API. |
||
| 178 | Note: Recompile with -Xlint:deprecation for details. |
||
| 179 | Note: Some input files use unchecked or unsafe operations. |
||
| 180 | Note: Recompile with -Xlint:unchecked for details. |
||
| 181 | }}} |
||
| 182 | 31 | Denis 'GNUtoo' Carikli | |
| 183 | 30 | Denis 'GNUtoo' Carikli | do that: |
| 184 | {{{ |
||
| 185 | 31 | Denis 'GNUtoo' Carikli | rm -f dalvik/libcore/luni/src/test/resources/hyts_Foo.c |
| 186 | 1 | Denis 'GNUtoo' Carikli | }}} |
| 187 | And it will continue to build |
||
| 188 | 31 | Denis 'GNUtoo' Carikli | {{{ |
| 189 | rm -rf dalvik/libcore/dom/src/test/resources/* |
||
| 190 | rm -rf dalvik/libcore/xml/src/test/resources/* |
||
| 191 | }}} didn't work |
||
| 192 | The workarround came from [http://groups.google.com/group/android-porting/browse_thread/thread/c51d436b2b1edc8d/b320ee78b2ddd0e4 here] and [http://lazyhack.net/tag/emulator/ here] |