android的源代码非常庞大 http://android.git.kernel.org/ 官方网站 下面这段话

To clone one of these trees, install git , and run:

git clone git://android.git.kernel.org/ + project path.

To clone the entire platform, install repo , and run:

mkdir mydroid
cd mydroid
repo init -u git://android.git.kernel.org/platform/manifest.git
repo sync

For more information about git , see an overview

打算全部下载回来再说,先下载repo脚本

更多git和repo使用说明看这里:

http://source.android.com/download/using-repo

curl http://android.git.kernel.org/repo >repo

chmod +x repo

[email protected]:~/android/source$ ./repo init -u git://android.git.kernel.org/platform/manifest.git
gpg: keyring `/home/wen/.repoconfig/gnupg/secring.gpg' created
gpg: keyring `/home/wen/.repoconfig/gnupg/pubring.gpg' created
gpg: /home/wen/.repoconfig/gnupg/trustdb.gpg: trustdb created
gpg: key 920F5C65: public key "Repo Maintainer <[email protected] >" imported
gpg: Total number processed: 1
gpg: imported: 1

Getting repo ...
from git://android.git.kernel.org/tools/repo.git

[email protected]:~/android/source$ ./repo sync

和远程服务器同步,过程比较长,全部代码下来好几Gb

打算编译一个vmware虚拟机上能运行的

目前google已经出e pc支持的版本了

切换到cupcake 分支,master分支不是太稳定

$ repo init -u git://android.git.kernel.org/platform/manifest.git -b
cupcake
$ repo sync

同步后,很多的更改会uncommit

建立一个local_manifest.xml
$ vi ./.repo/local_manifest.xml
<manifest>
<project name="platform/vendor/asus/eee_701" path="vendor/asus/
eee_701"/>
</manifest>

$ repo sync
... A new repo command ( 1.8) is available.
... You should upgrade soon:

cp /home/invain/bin_x86/mydroid/.repo/repo/repo /home/invain/bin/
repo

Initializing project platform/vendor/asus/eee_701 ...
remote: Counting objects: 33, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 33 (delta 2), reused 33 (delta 2)
Unpacking objects: 100% (33/33), done.
From git://android.git.kernel.org/platform/vendor/asus/eee_701
* [new branch] cupcake -> korg/cupcake
* [new branch] master -> korg/master

至此代码下载完毕,编译环境得准备一下 需要下面这些库

Ubuntu Linux (32-bit x86)

To set up your Linux development environment, make sure you have the following:
  • Required Packages:
    • Git 1.5.4 or newerand the GNU Privacy Guard.
    • JDK 5.0, update 12 or higher. Java 6 is not supported, because of incompatibilities with @Override.
    • flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev (optional), build-essential, zip, curl.
$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl li b ncurses5-dev zlib1g-dev
  • You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.
$ sudo apt-get install valgrind
  • Intrepid ( 8.10) users may need a newer version of libreadline:
$ sudo apt-get install lib32readline5-dev 更多得到源代码的详细步骤看这里: http://source.android.com/download 先编译内核: 切 到 mydroid/kernel 目錄下,複製 mydroid/vendor/asus/eee_701/kernel.config 為 mydroid/kernel/.config,接著執行 make menuconfig,進入 kernel configuration 選單以後,把這幾個 driver 選為 built-in:
Device drivers / Network device support / Ethernet (10 or 100Mbit) / EISA, VLB, PCI and on board controllers / AMD PCnet32 PCI support
Device drivers / Graphics support / Support for frame buffer devices / VESA VGA graphics support
Device drivers / Graphics support / Console display driver support / Framebuffer Console support
Device drivers / Graphics support / Console display driver support / Select Compiled-in fonts (VGA 8x8 font, VGA 8x16 font)
,再把這些取消:
Device drivers / Real Time Clock / Android alarm driver
Device drivers / Misc devices / Android pmem allocator
,然後重新建置 kernel:make bzImage。
編譯好之後,把 arch/x86/boot/bzImage 複製為 mydroid/vendor/asus/eee_701/kernel。
接下来就可以编译了: TARGET_ARCH=x86 TARGET_PRODUCT=eee_701 DISABLE_DEXPREOPT= true make -j2 installer_img CC=gcc CXX=g++ 出现错误 No rule to make target `vendor/google/frameworks/maps/com.google.android.maps.xml' 把eee_701.mk中的 'generic_with_google.mk'改为 'generic.mk' 编译遇到新错误 其他用户编译会提示没有找到e2fschk 这里不能简单的把文件从sbin目录复制到bin目录 否则会和root用户编译一样 出现下面的错误 Copy: out/target/product/eee_701/installer/root/system/bin/netcfg
Copying installer base files...
Copy: out/target/product/eee_701/obj/lib/libdiskconfig.so -> out/
target/product/eee_701/installer/root/system/lib/libdiskconfig.so
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
Try `cp --help' for more information.
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
Try `cp --help' for more information.
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
Try `cp --help' for more information.
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
Try `cp --help' for more information.
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
Try `cp --help' for more information.
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
Try `cp --help' for more information.
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
Try `cp --help' for more information.
Copy: ->
dirname: missing operand
Try `dirname --help' for more information.
mkdir: missing operand
Try `mkdir --help' for more information.
cp: missing file operand
android目录下的external/e2fsprogs 就是这些工具,没有编译而已 打下面的patch http://code.google.com/p/patch-hosting-for-android-x86-support/downloads/list project external/e2fsprogs/
diff --git a/Android.mk b/Android.mk
index e71cf08..3d39a41 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,3 @@
-ifneq ($(TARGET_SIMULATOR),true)
-# include $(call all-subdir-makefiles)
+ifeq ($(TARGET_ARCH),x86)
+include $(call all-subdir-makefiles)
endif

这样e2fsprogs下面的工具就编译好了,可以在out/target/

更多相关文章

  1. 如何调用android内置图片,比如menu->add的加号图片,search的放大镜
  2. Android真机调试 Android.Util.AndroidRuntimeException: You ca
  3. 修正android cocos2dx项目当点击属性时提示错误的问题
  4. javax.net.ssl.SSLException: hostname in certificate didn't m
  5. Couldn't find meta-data for provider with authority
  6. Android(安卓)项目打包时出现“TaskExecutionException :':app:me
  7. android studio 4.0. gradle 4.0. tinker集成报错
  8. 在mac 上配置AndroidStudio碰到的坑
  9. Android的常见错误及解决办法

随机推荐

  1. Android:textView加载Html,只加载文字
  2. Android消息处理机制4——Looper
  3. Android Gradle Plugin指南(三)----依赖关
  4. Android按键事件发布流程
  5. Android 系统永不休眠
  6. android8.0 launcher改透明
  7. iPhone app 和android app开发环境和语言
  8. android View
  9. Android xutils 登录 注册
  10. cocos2dx编译HelloWorld