0%

全志A40I安卓系统编译

简介

最近有项目需求需要使用安卓系统安装APP来实现项目需求,所以就选了全志的A40I平台,符合工业控制的要求,下面是安卓系统的编译过程还有遇到的一些问题,特此记录一下

编译环境我使用的是飞凌嵌入式提供的Docker环境,因此不需要安装过多编译和依赖软件,具体的环境搭建这里先不做介绍,后边我再具体讲一下如何配置Docker环境以及基于Ubuntu搭建编译环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
root@iotts-virtual-machine:/home/iotts# docker start d7986b9eb0ea
d7986b9eb0ea
root@iotts-virtual-machine:/home/iotts# docker exec -it d7986b9eb0ea bin/bash
root@d7986b9eb0ea:~/workspace/allwinner# cd android
root@d7986b9eb0ea:~/workspace/allwinner/android# source build/envsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/google/marlin/vendorsetup.sh
including device/htc/flounder/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/softwinner/a40-OKA40i_C/vendorsetup.sh
including device/softwinner/a40-p1/vendorsetup.sh
including device/softwinner/common/vendorsetup.sh
including device/softwinner/t3-p3/vendorsetup.sh
including sdk/bash_completion/adb.bash
root@d7986b9eb0ea:~/workspace/allwinner/android# lunch 24

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.1
TARGET_PRODUCT=a40_OKA40i_C
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
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-142-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NMF27D
OUT_DIR=out
============================================
root@d7986b9eb0ea:~/workspace/allwinner/android# extract-bsp
/root/workspace/allwinner/android/device/softwinner/a40-OKA40i_C/bImage copied!
/root/workspace/allwinner/android/device/softwinner/a40-OKA40i_C/modules copied!
root@d7986b9eb0ea:~/workspace/allwinner/android# make -j2
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.1
TARGET_PRODUCT=a40_OKA40i_C
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
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-142-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NMF27D
OUT_DIR=out
============================================
...
...
#### make completed successfully (04:48 (mm:ss)) ####
root@d7986b9eb0ea:~/workspace/allwinner/android# pack
No kernel param, parse it from .buildconfig
copying tools file
copying configs file
./out/aultls32.fex
....
....
Dragon execute image.cfg SUCCESS !
----------image is at----------

/root/workspace/allwinner/lichee/tools/pack/sun8iw11p1_androidm_a40-OKA40i_C_uart0-1280x800.img

pack finish

android7.0源码编译问题总结

我使用的是飞凌使用Docker搭建的编译环境,在编译过程中出现一些问题

USER问题(由于运行的 docker 容易没有配置 USER 环境变量)

1
JACK VMCOMMAND =" java - Dfile . encoding = UTF -8-Xms2560m- XX :+ TieredCompilation - jar out / host / linux -x86/framework/ jack - launcher . jar " JACK _ JAR =" out / host / linux -x86/framework/ jack . ja " outhost / linux -x86/bin/ jack - admin start - server out / host / linux -x86/bin/ jack - admin : line 27: USER : unbound variable 

这是由于 docker 没有设置 USER 环境变量导致,手动添加后继续编译即可

1
export USER=$(whoami)

也可以在 docker 构建文件 Dockerfile 中加上如下语句:
1
ENV USER root /或者自己需要的名字

编译android7.0出现的错误ninja: build stopped: subcommand failed.

1
ninja: build stopped: subcommand failed.

解决方法:

1
$ vi prebuilts/sdk/tools/jack-admin

1.找到如下语句:
1
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR 	$JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"

2.将上述语句修改为:
1
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"

主要是添加了-Xmx4096m参数,接下来在源码目录下执行如下命令重启jack-admin服务:
1
2
$ ./prebuilts/sdk/tools/jack-admin stop-server 
$ ./prebuilts/sdk/tools/jack-admin start-server