编译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
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
然后进入:
终于发现JDK6了,选择下载:
点击英文的 接受协议,然后就选择64位的安装程序了 :
Linux x64 | 68.75 MB | ![]() |
下载完后 改为可执行
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
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
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系统镜像