http://bbs.ickey.cn/group-topic-id-57981.htmlhtml
【Orange Pi PC試用體驗】11編譯android源碼筆記java
編譯android和編譯linux有點相似,參考 我以前的筆記 http://bbs.ickey.cn/group-topic-id-55607.htmlpython
個人筆記和資料全共享在雲盤:linux
http://pan.baidu.com/s/1dD6T0f3android
沒有密碼,歡迎下載~~~~~~git
材料:ubuntu
香橙派:orangepi PCapi
TF卡:用原來的三星8G CLASS 10 TF卡裝LUBUNTUbash
電源適配器:1A的帶不動,啓動卡死,改用某A10S盒子的5V/2A電源OK(內徑1.7MM 外徑4MM的DC頭)markdown
系統:UBUNTU 14.04LTS 64BIT
內核源碼資源
一、下載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 | 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
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系統鏡像