http://bbs.ickey.cn/group-topic-id-57981.html

【Orange Pi PC试用体验】11编译android源码笔记

编译android和编译linux有点类似,参考 我之前的笔记http://bbs.ickey.cn/group-topic-id-55607.html

我的笔记和资料全共享在云盘:

http://pan.baidu.com/s/1dD6T0f3

没有密码,欢迎下载~~~~~~

材料:

香橙派:orangepiPC

TF卡:用原来的三星8GCLASS10TF卡装LUBUNTU

电源适配器:1A的带不动,启动卡死,改用某A10S盒子的5V/2A电源OK(内径1.7MM外径4MM的DC头)

系统:UBUNTU14.04LTS64BIT

内核源码资源

1、下载H3的linux源码资源

http://www.orangepi.org/downloadresourcescn/ 这是页面

直接点就是

http://www.orangepi.org/downloadresourcescn/orangepipc/oragepipc_2dfcb470cbf2347de2dbc33e5e.html

选择orangepiPC 的源码名称为H3-homlet-1.0.tar.gz

android sdk source code 更新:2015-05-21 UBUNTU下解压,双击压缩包,然后直接把文件夹用鼠标拖到你需要的文件夹里面即完成解压H3-homlet-1.0

2. 编译前先安装可能需要的工具,编译错误时根据提示单独安装密令工具

sudo apt-get install fakeroot

3.开始编译 H3-homlet-1.0/lichee 内核

3.1 :

#./build.shconfig

Allavailablechips:

0.sun6i

1.sun8iw6p1

2.sun8iw7p1

3.sun9iw1p1

选择2

3.2:

Allavailableplatforms:

0.android

1.dragonboard

2.linux

Choice:

选择 0 android

于是就开始编译android的内核了.期间我是出现了一个密令fakeroot没找到,所以提前告诉大家要安装

sudo apt-get install fakeroot
经过漫长的等待,写这个帖子时 孩子编译,估计要一段时间才能编译完成! 淡定淡定!!!

3.3悲剧的是还是出现错误了:

regenerate rootfs cpio11282 blocks12028 blocksawk: line 2: function strtonum never definedawk: line 2: function strtonum never definedERROR: build kernel Failed

于是百度之:得到答案:http://blog.csdn.net/mcgrady_tracy/article/details/39262117

#sudo dpkg-reconfigure dash

sudo apt-get install gawk

选择no即可

3.4 于是重新编译

H3-homlet-1.0/lichee$ ./build.sh

成功!!!

regenerate rootfs cpio11282 blocks12028 blocksbuild_ramfsCopy boot.img to output directory ...Copy modules to target ...sun8iw7p1 compile Kernel successfulINFO: build kernel OK.INFO: build rootfs ...INFO: skip make rootfs for androidINFO: build rootfs OK.----------------------------------------build sun8iw7p1 android  lichee OK----------------------------------------

4.编译android

参考http://weikaile123.blog.163.com/blog/static/1168846382013111193652487/

4.1

/H3-homlet-1.0/android$ source build/envsetup.shincluding device/lge/hammerhead/vendorsetup.shincluding device/lge/mako/vendorsetup.shincluding device/softwinner/dolphin-fvd-p1/vendorsetup.shincluding device/softwinner/common/vendorsetup.shincluding device/asus/flo/vendorsetup.shincluding device/asus/grouper/vendorsetup.shincluding device/asus/deb/vendorsetup.shincluding device/asus/tilapia/vendorsetup.shincluding device/samsung/manta/vendorsetup.shincluding device/generic/x86/vendorsetup.shincluding device/generic/armv7-a-neon/vendorsetup.shincluding device/generic/mips/vendorsetup.shincluding sdk/bash_completion/adb.bash

4.2

/H3-homlet-1.0/android$ lunchYou're building on LinuxLunch menu... pick a combo:     1. aosp_arm-eng     2. aosp_x86-eng     3. aosp_mips-eng     4. vbox_x86-eng     5. aosp_hammerhead-userdebug     6. aosp_mako-userdebug     7. dolphin_fvd_p1-eng     8. aosp_flo-userdebug     9. aosp_grouper-userdebug     10. aosp_deb-userdebug     11. aosp_tilapia-userdebug     12. aosp_manta-userdebug     13. mini_x86-userdebug     14. mini_armv7a_neon-userdebug     15. mini_mips-userdebugWhich would you like? [aosp_arm-eng] 

选择:

1. aosp_arm-eng

出现错误:

build/core/config.mk:365: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com。 停止。** Don't have a product spec for: 'aosp_arm'** Do you have the right repo manifest?

解决:安装JDK6

4.3:下载JDK6 去java.sun.com

找了很多,终于百度得到下面链接

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html

然后进入:

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR

终于发现JDK6了,选择下载:

点击英文的 接受协议,然后就选择64位的安装程序了 :

Linux x64 68.75 MB jdk-6u45-linux-x64.bin

麻烦,期间还要我注册账号,没办法照做,然后下载,等下把他上传网盘分享:

下载完后 改为可执行

sudo chmod 777 jdk-6u45-linux-x64.bin #并安装:orangepi$ ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /opt$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.6.0_45/bin/java" 1$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.6.0_45/bin/javac" 1$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/opt/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk1.6.0_45/bin/javaws" 1
$ sudo update-alternatives --install /usr/bin/javap javap  /opt/jdk1.6.0_45/bin/javap 300


4.4重新编译:

#

H3-homlet-1.0/android$ source build/envsetup.shH3-homlet-1.0/android$ lunch You're building on LinuxLunch menu... pick a combo:     1. aosp_arm-eng     2. aosp_x86-eng     3. aosp_mips-eng     4. vbox_x86-eng     5. aosp_hammerhead-userdebug     6. aosp_mako-userdebug     7. dolphin_fvd_p1-eng     8. aosp_flo-userdebug     9. aosp_grouper-userdebug     10. aosp_deb-userdebug     11. aosp_tilapia-userdebug     12. aosp_manta-userdebug     13. mini_x86-userdebug     14. mini_armv7a_neon-userdebug     15. mini_mips-userdebugWhich would you like? [aosp_arm-eng] 
  

直接回车

Which would you like? [aosp_arm-eng] ============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=4.4.2TARGET_PRODUCT=aosp_armTARGET_BUILD_VARIANT=engTARGET_BUILD_TYPE=releaseTARGET_BUILD_APPS=TARGET_ARCH=armTARGET_ARCH_VARIANT=armv7-aTARGET_CPU_VARIANT=genericHOST_ARCH=x86HOST_OS=linuxHOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trustyHOST_BUILD_TYPE=releaseBUILD_ID=KOT49HOUT_DIR=out============================================

4.5

可能出现的问题:由于sun-java6-jdk最终安装在/opt目录下面,在编译android过程中可能出现,找不到jar命令的情况,这时就应当为jar在/usr/bin下面创建一个链接文件。
5.1解决未发现jar的方法
$ cd /usr/bin
$ sudoln-s-f/opt/jdk1.6.0_30/bin/jar
 
5.2解决未发现javadoc的方法 
$ cd /usr/bin 
$ sudoln-s-f/opt/jdk1.6.0_45/bin/javadoc

4.6 安装一些工具密令,

sudo apt-get install git gnupg flex bison gperf build-essential sudo apt-get install zip curl libc6-dev libncurses5-dev:i386 x11proto-core-devsudo apt-get install libx11-dev:i386 sudo apt-get install libreadline6-dev:i386 #sudo apt-get install libgl1-mesa-glx:i386  #失败安装,暂时不安装sudo apt-get install libgl1-mesa-dev g++-multilib mingw32 tofrodossudo apt-get install python-markdown libxml2-utils xsltproc zlib1g-dev:i386

然后编译:

H3-homlet-1.0/android$ source build/envsetup.shH3-homlet-1.0/android$ lunch 然后回车选择默认 7  . dolphin_fvd_p1-eng
选择7是从  H3-homlet-1.0/android/device/softwinner/dolphin-fvd-p1  看到的
$ extract-bsp  
# //拷贝内核和模块到android中;  make -j2
编译时出现没有makefile 的错误,待查原因...
卡在这里:
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ source build/envsetup.shincluding device/lge/hammerhead/vendorsetup.shincluding device/lge/mako/vendorsetup.shincluding device/softwinner/dolphin-fvd-p1/vendorsetup.shincluding device/softwinner/common/vendorsetup.shincluding device/asus/flo/vendorsetup.shincluding device/asus/grouper/vendorsetup.shincluding device/asus/deb/vendorsetup.shincluding device/asus/tilapia/vendorsetup.shincluding device/samsung/manta/vendorsetup.shincluding device/generic/x86/vendorsetup.shincluding device/generic/armv7-a-neon/vendorsetup.shincluding device/generic/mips/vendorsetup.shincluding sdk/bash_completion/adb.bashorangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lunchYou're building on LinuxLunch menu... pick a combo:     1. aosp_arm-eng     2. aosp_x86-eng     3. aosp_mips-eng     4. vbox_x86-eng     5. aosp_hammerhead-userdebug     6. aosp_mako-userdebug     7. dolphin_fvd_p1-eng     8. aosp_flo-userdebug     9. aosp_grouper-userdebug     10. aosp_deb-userdebug     11. aosp_tilapia-userdebug     12. aosp_manta-userdebug     13. mini_x86-userdebug     14. mini_armv7a_neon-userdebug     15. mini_mips-userdebugWhich would you like? [aosp_arm-eng] 7============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=4.4.2TARGET_PRODUCT=dolphin_fvd_p1TARGET_BUILD_VARIANT=engTARGET_BUILD_TYPE=releaseTARGET_BUILD_APPS=TARGET_ARCH=armTARGET_ARCH_VARIANT=armv7-a-neonTARGET_CPU_VARIANT=cortex-a7HOST_ARCH=x86HOST_OS=linuxHOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trustyHOST_BUILD_TYPE=releaseBUILD_ID=KOT49HOUT_DIR=out============================================orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ extract-bsp/home/orangepi/orangepi/H3-homlet-1.0/android/device/*/dolphin-fvd-p1/bImage copied!/home/orangepi/orangepi/H3-homlet-1.0/android/device/*/dolphin-fvd-p1/modules copied!orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ make -j2make: *** 没有指明目标并且找不到 makefile。 停止。orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ makemake: *** 没有指明目标并且找不到 makefile。 停止。orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lunchYou're building on LinuxLunch menu... pick a combo:     1. aosp_arm-eng     2. aosp_x86-eng     3. aosp_mips-eng     4. vbox_x86-eng     5. aosp_hammerhead-userdebug     6. aosp_mako-userdebug     7. dolphin_fvd_p1-eng     8. aosp_flo-userdebug     9. aosp_grouper-userdebug     10. aosp_deb-userdebug     11. aosp_tilapia-userdebug     12. aosp_manta-userdebug     13. mini_x86-userdebug     14. mini_armv7a_neon-userdebug     15. mini_mips-userdebugWhich would you like? [aosp_arm-eng] 7============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=4.4.2TARGET_PRODUCT=dolphin_fvd_p1TARGET_BUILD_VARIANT=engTARGET_BUILD_TYPE=releaseTARGET_BUILD_APPS=TARGET_ARCH=armTARGET_ARCH_VARIANT=armv7-a-neonTARGET_CPU_VARIANT=cortex-a7HOST_ARCH=x86HOST_OS=linuxHOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trustyHOST_BUILD_TYPE=releaseBUILD_ID=KOT49HOUT_DIR=out============================================orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lsabi       build       development  frameworks       ndk        sdkart       cts         device       hardware         packages   systembionic    dalvik      docs         libcore          pdk        toolsbootable  developers  external     libnativehelper  prebuilts  vendororangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lsabi       build       development  frameworks       ndk        sdkart       cts         device       hardware         packages   systembionic    dalvik      docs         libcore          pdk        toolsbootable  developers  external     libnativehelper  prebuilts  vendororangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ cd build/orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android/build$ lsbuildspec.mk.default  CleanSpec.mk  core  envsetup.sh  libs  target  toolsorangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android/build$ makemake: *** 没有指明目标并且找不到 makefile。 停止。orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android/build$ cd ..orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lsabi       build       development  frameworks       ndk        sdkart       cts         device       hardware         packages   systembionic    dalvik      docs         libcore          pdk        toolsbootable  developers  external     libnativehelper  prebuilts  vendororangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ cd ..orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0$ lsandroid  licheeorangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0$ cd lichee/orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/lichee$ source build/envsetup.shbash: build/envsetup.sh: 没有那个文件或目录orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/lichee$ cd ../android/orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lsabi       build       development  frameworks       ndk        sdkart       cts         device       hardware         packages   systembionic    dalvik      docs         libcore          pdk        toolsbootable  developers  external     libnativehelper  prebuilts  vendororangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ makemake: *** 没有指明目标并且找不到 makefile。 停止。orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ source build/envsetup.shincluding device/lge/hammerhead/vendorsetup.shincluding device/lge/mako/vendorsetup.shincluding device/softwinner/dolphin-fvd-p1/vendorsetup.shincluding device/softwinner/common/vendorsetup.shincluding device/asus/flo/vendorsetup.shincluding device/asus/grouper/vendorsetup.shincluding device/asus/deb/vendorsetup.shincluding device/asus/tilapia/vendorsetup.shincluding device/samsung/manta/vendorsetup.shincluding device/generic/x86/vendorsetup.shincluding device/generic/armv7-a-neon/vendorsetup.shincluding device/generic/mips/vendorsetup.shincluding sdk/bash_completion/adb.bashorangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lunchYou're building on LinuxLunch menu... pick a combo:     1. aosp_arm-eng     2. aosp_x86-eng     3. aosp_mips-eng     4. vbox_x86-eng     5. aosp_hammerhead-userdebug     6. aosp_mako-userdebug     7. dolphin_fvd_p1-eng     8. aosp_flo-userdebug     9. aosp_grouper-userdebug     10. aosp_deb-userdebug     11. aosp_tilapia-userdebug     12. aosp_manta-userdebug     13. mini_x86-userdebug     14. mini_armv7a_neon-userdebug     15. mini_mips-userdebugWhich would you like? [aosp_arm-eng] 7============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=4.4.2TARGET_PRODUCT=dolphin_fvd_p1TARGET_BUILD_VARIANT=engTARGET_BUILD_TYPE=releaseTARGET_BUILD_APPS=TARGET_ARCH=armTARGET_ARCH_VARIANT=armv7-a-neonTARGET_CPU_VARIANT=cortex-a7HOST_ARCH=x86HOST_OS=linuxHOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trustyHOST_BUILD_TYPE=releaseBUILD_ID=KOT49HOUT_DIR=out============================================orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ extract-bsp/home/orangepi/orangepi/H3-homlet-1.0/android/device/*/dolphin-fvd-p1/bImage copied!/home/orangepi/orangepi/H3-homlet-1.0/android/device/*/dolphin-fvd-p1/modules copied!orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ makemake: *** 没有指明目标并且找不到 makefile。 停止。orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ make -j4make: *** 没有指明目标并且找不到 makefile。 停止。orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ make -j2make: *** 没有指明目标并且找不到 makefile。 停止。orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ 

  
$ pack#//完全打包 //在licheetoolspack路径下生成了固件

5.打包镜像

6.安装测试android系统镜像

更多相关文章

  1. Android notification点击跳转到Activity,点击返回跳转,前一条消息
  2. Android 内核源代码交叉编译(创建自己的模拟器内核,哈哈终于搞定
  3. 索骥馆-编程语言之《Android内核剖析》扫描版[PDF]
  4. 基于Android的Linux内核的电源管理
  5. 在Ubuntu上为Android增加硬件抽象层(HAL)模块访问Linux内核驱动程
  6. [转]android的Goldfish内核概述
  7. Android内核的大致分析
  8. linux内核启动android文件系统过程分析

随机推荐

  1. Android 之 下拉框(Spinner)的使用
  2. Unity3D - AssetBundle 在Android机子上
  3. 简单的通过request判断客户端设备类型
  4. java基础 注解 android中的实现
  5. Android 友盟
  6. Android获取屏幕分辨率和dpi
  7. Android之日期时间选择器使用方法
  8. mtk android 背光设置
  9. 实现调用Android手机的拍照功能
  10. Android客户端上传文件到服务器端