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

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

材料:

香橙派:orangepi PC

TF卡:用原来的三星8G CLASS 10 TF卡装LUBUNTU

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

系统:UBUNTU 14.04LTS 64BIT

内核源码资源

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.sh config

All available chips:

0. sun6i

1. sun8iw6p1

2. sun8iw7p1

3. sun9iw1p1

选择2

3.2:

All available platforms:

0. android

1. dragonboard

2. linux

Choice:

选择 0  android

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

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

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

regenerate rootfs cpio
11282 blocks
12028 blocks
awk: line 2: function strtonum never defined
awk: line 2: function strtonum never defined
ERROR: 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 cpio
11282 blocks
12028 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ... sun8iw7p1 compile Kernel successful INFO: build kernel OK.
INFO: build rootfs ...
INFO: skip make rootfs for android
INFO: 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.sh
including device/lge/hammerhead/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/softwinner/dolphin-fvd-p1/vendorsetup.sh
including device/softwinner/common/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including sdk/bash_completion/adb.bash

4.2

/H3-homlet-1.0/android$ lunch

You're building on Linux

Lunch 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-userdebug Which 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.sh
H3-homlet-1.0/android$ lunch You're building on Linux Lunch 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-userdebug Which would you like? [aosp_arm-eng]

直接回车

Which would you like? [aosp_arm-eng] 

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=aosp_arm
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KOT49H
OUT_DIR=out
============================================

4.5

 可能出现的问题:由于 sun-java6-jdk最终安装在/opt目录下面,在编译android过程中可能出现,找不到jar命令的情况,这时就应当为jar在/usr/bin下面创建一个链接文件。
        5.1解决未发现jar的方法
                             $ cd /usr/bin
             $ sudo ln -s -f /opt/jdk1.6.0_30/bin/jar  
 
        5.2解决未发现javadoc的方法 
            $ cd /usr/bin 
            $ sudo ln -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-dev
sudo 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 tofrodos
sudo apt-get install python-markdown libxml2-utils xsltproc zlib1g-dev:i386

然后编译:

H3-homlet-1.0/android$ source build/envsetup.sh
H3-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.sh
including device/lge/hammerhead/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/softwinner/dolphin-fvd-p1/vendorsetup.sh
including device/softwinner/common/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including sdk/bash_completion/adb.bash
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lunch You're building on Linux Lunch 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-userdebug Which would you like? [aosp_arm-eng] 7 ============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=dolphin_fvd_p1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KOT49H
OUT_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 -j2
make: *** 没有指明目标并且找不到 makefile。 停止。
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ make
make: *** 没有指明目标并且找不到 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$ lunch You're building on Linux Lunch 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-userdebug Which would you like? [aosp_arm-eng] 7 ============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=dolphin_fvd_p1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KOT49H
OUT_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$ ls
abi build development frameworks ndk sdk
art cts device hardware packages system
bionic dalvik docs libcore pdk tools
bootable developers external libnativehelper prebuilts vendor
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ ls
abi build development frameworks ndk sdk
art cts device hardware packages system
bionic dalvik docs libcore pdk tools
bootable developers external libnativehelper prebuilts vendor
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ cd build/
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android/build$ ls
buildspec.mk.default CleanSpec.mk core envsetup.sh libs target tools
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android/build$ make
make: *** 没有指明目标并且找不到 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$ ls
abi build development frameworks ndk sdk
art cts device hardware packages system
bionic dalvik docs libcore pdk tools
bootable developers external libnativehelper prebuilts vendor
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ cd ..
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0$ ls
android lichee
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0$ cd lichee/
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/lichee$ source build/envsetup.sh
bash: build/envsetup.sh: 没有那个文件或目录
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/lichee$ cd ../android/
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ ls
abi build development frameworks ndk sdk
art cts device hardware packages system
bionic dalvik docs libcore pdk tools
bootable developers external libnativehelper prebuilts vendor
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ source build/envsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/softwinner/dolphin-fvd-p1/vendorsetup.sh
including device/softwinner/common/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including sdk/bash_completion/adb.bash
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ lunch You're building on Linux Lunch 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-userdebug Which would you like? [aosp_arm-eng] 7 ============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=dolphin_fvd_p1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KOT49H
OUT_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$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ make -j4
make: *** 没有指明目标并且找不到 makefile。 停止。
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$ make -j2
make: *** 没有指明目标并且找不到 makefile。 停止。
orangepi@orangepi-ubuntu:~/orangepi/H3-homlet-1.0/android$


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

5.打包镜像

6.安装测试android系统镜像

H3 android 系统编译的更多相关文章

  1. Android系统编译与测试

    1.Android系统分析 2.下载Android源代码(不包括Linux内核部分) 下载好了的Android_5.01.tar.gz,通过samba复制到ubuntu里,再解压之. 可以看到Andr ...

  2. Android系统编译时遇到的几个.mk的疑惑。

    在Android4.2的源代码Build/prduct_config.mk里面遇到几个疑惑: # Convert a short name like "sooner" into t ...

  3. Android 系统编译

    最近研究了下Android 的编译系统,下面结合编译我们自己的产品 mobot 来对整个编译系统进行必要的介绍,方便大家今 后对默认编译的修改. 先列出几个觉得重要的Make 文件: build/bu ...

  4. Android系统编译环境及连接工具配置

    首先附上官网上关于环境搭建的地址:https://source.android.com/setup/build/initializing 官网目前建议的还是Ubuntu14.04,下面就是用的Ubun ...

  5. Android系统编译错误Note: Some input files use or override a deprecated API. 解决办法【转】

    本文转载自:http://blog.csdn.net/lilidejing/article/details/46564491 进入系统framework层修改了下MediaPlayer.java的源码 ...

  6. Android系统编译【转】

    本文转载自;http://blog.csdn.net/zirconsdu/article/details/8005415 Android编译系统分析 概要 由于android编译系统的复杂和使用了不熟 ...

  7. Android系统编译环境初始化时Product产品的import-nodes过程

    从运行make -f config,mk文件開始,config,mk作为当前的makefile文件.将会被make解析,一般make解析Makefile文件流程首先是载入当中include的各种其它m ...

  8. Android系统编译脚本理解

    android源码编译步骤: 1. repo sync 代码(下载代码) 2.start branch(用哪个分支,git相关) 3. 到根目录(android目录) $cd android/ 4. ...

  9. android系统编译打开系统蓝牙

    在项目配置文件ProjectConfig.mk中开启蓝牙以后,但是设置菜单中并没有出现蓝牙选项,最后发现是因为ProjectConfig.mk同级目录下没有蓝牙配置文件android.hardware ...

随机推荐

  1. centos搭建OPENldap

    LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X.500标准的,但是简单多了并且可以根据需要定制.与X ...

  2. cetnos 7 增加新的硬盘

    fdisk -l 查看新的硬盘是否挂载 如没有挂载 ls /sys/class/scsi_host/ 查看设备列表 echo "- - - " > /sys/class/sc ...

  3. 微信小程序开发——小程序分享转发

    关于小程序的转发: 最简单的就是点击小程序右上角菜单“转发”按钮直接分享,不过这种分享有点不太友好,实用性也不强. 当然,你可以自定义分享内容,包括标题,简介,图片及分享的小程序页面路径. 再高级一点 ...

  4. ubuntu下安装、破解securtCRT工具

    官网:https://www.vandyke.com/ 下载好的安装包以及破解工具的网盘地址:链接: https://pan.baidu.com/s/1UEKEy-aob7WdfPLR4PNJmg 提 ...

  5. 【centos】centos中添加一个新用户,并授权

    前言 有时候给root用户不太方便,新建一个用于并赋予权限这个做法相对好些 创建新用户 创建一个用户名为:cmj [root@localhost ~]# adduser cmj 为这个用户初始化密码, ...

  6. 【Linux 线程】常用线程函数复习《三》

    1.关于函数pthraed_join与函数pthraed_detach 在任何一个时间点上,线程是可结合的(joinable)或者是分离的(detached).一个可结合的线程能够被其他线程收回其资源 ...

  7. django的csrf

    csrf:跨站请求网站 如果是ajax提交,可以按照下面的方式处理 <script src="/static/jq/jquery-3.3.1.js"></scri ...

  8. 解决 MySQL 比如我要拉取一个消息表中用户id为1的前10条最新数据

    我们都知道,各种主流的社交应用或者阅读应用,基本都有列表类视图,并且都有滑到底部加载更多这一功能, 对应后端就是分页拉取数据.好处不言而喻,一般来说,这些数据项都是按时间倒序排列的,用户只关心最新的动 ...

  9. easyrules

    http://www.easyrules.org/tutorials/hello-world-tutorial.html

  10. 10.16JS日记

    1.parseint() 2.parsefloat() 这两个单词运行的时候遇到第一个非数字就结束了 3.var a="hello word"  a这个变量为字符串,每一个字母为字 ...