Tiny4412_android5.0.2编译

源码导入android

参考
参考2
1, . setenv
2, lunch (choose 14. full_tiny4412-eng)
3, mmm development/tools/idegen/
4, sh ./development/tools/idegen/idegen.sh
这行命令的意思是生成对应的文件:android.iws, android.ipr, android.iml
生成对应的文件后,打开Android Studio,选择打开一个现有的Android Studio项目,选择Android源码的根目录,导入即可(起作用的是android.irp文件).在配置sdk版本之后就可以查看Android 源码了.

报错:

    Exception in thread "main" java.io.FileNotFoundException: ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java (Is a directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileReader.<init>(FileReader.java:72)
    at Configuration.parsePackageName(Configuration.java:204)
    at Configuration.rootOf(Configuration.java:180)
    at Configuration.traverse(Configuration.java:140)
    at Configuration.traverse(Configuration.java:167)
    at Configuration.traverse(Configuration.java:167)
    at Configuration.traverse(Configuration.java:167)
    at Configuration.traverse(Configuration.java:167)
    at Configuration.traverse(Configuration.java:167)
    at Configuration.traverse(Configuration.java:167)
    at Configuration.traverse(Configuration.java:167)
    at Configuration.<init>(Configuration.java:72)
    at Main.main(Main.java:37)      

解决办法是将

./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java

修改为:

./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.j
准备文件:

tar xzf android-5.0.2-fs-20150325.tar.gz
tar xzf linux-3.0.86-20150324.tgz

安装环境(ubuntu 16.04):
sudo ./install-devel-packages.sh
make -v / 4.1
gcc /g++ -v/5.4
arm-linux-gcc -v/
java -v /openjdk-7
编译kernel
cd linux-3.0.86
cp tiny4412_android_defconfig.config
make zInmage
编译android

版本选择

cd android-5.0.2
. setenv
lunch
choose full_tiny4412-eng
make -j4
打包
./gen-img.sh
# if get err : ./gen-img.sh: line 31: mkimage: command not found
tar xzf uboot_tiny4412-20130729.tgz
cd uboot_tiny4412
make tiny4412_config
make
sudo cp tools/mkimage /usr/bin

碰到的错误:
1, Unable to locate package mingw32
处理:

sudo vim /etc/apt/sources.list
//在sources.list末尾添加,保存
deb http://us.archive.ubuntu.com/ubuntu trusty main universe
sudo apt-get update
sudo apt-get install mingw32

2, 编译kernel报错

  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
arm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory
/home/arte/work/driver/tiny4412/source/linux-3.0.86/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:997: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
处理=============================================
没有指定arm-linux-gcc版本,需要在.bashrc中将toolschain加入export 
export PATH=$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin/

3, 编译android报错, java版本不对

============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
 
Your version is: openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.16.04.1-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode).
The required version is: "1.7.x"
 
Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:167: *** stop。 停止。

#### make failed to build some targets (6 seconds) ####

解决:
切换java版本到openjdk7
sudo update-alternatives --config java
如果且不过来 , 检查一下~/.bashrc是不是配置了固定java_home
如果还是不行 , 退出termial 在进, 最后不行就重启.

4, clang问题

clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libnativehelper.so' failed
make: *** [out/host/linux-x86/obj32/lib/libnativehelper.so] Error 1

重新make 不加-j参数 .

external/libcxx/include/thread:149: error: unsupported reloc 43
clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libc++.so' failed
make: *** [out/host/linux-x86/obj32/lib/libc++.so] Error 1
#### make failed to build some targets (04:12 (mm:ss)) ####

从log看都和clang有关,参考
1.修改
cd <source_android>/art/build/
vim Android.common_build.mk //修改第119行
修改前:

# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
修改后:
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),false)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif

2.修改
经过第一次修改之后发现编译还是报同样的错误,执行下面:
cp /usr/bin/ld.gold <source_android>/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
3.修改过上述代码后,最好执行一次make update-api,再make

5, 报错如下


You have tried to change the API from what has been previously approved.

To make these errors go away, you have two choices:

  1. You can add “@hide” javadoc comments to the methods, etc. listed in the
    errors above.

  2. You can update current.txt by executing the following command:
    make update-api

    To submit the revised current.txt to the main Android repository,
    you will need approval.


build/core/tasks/apicheck.mk:57: recipe for target ‘out/target/common/obj/PACKAGING/checkapi-current-timestamp’ failed
make: *** [out/target/common/obj/PACKAGING/checkapi-current-timestamp] Error 38

解决:参考
make update-api

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值