本文主要是介绍RK3399平台Android7系统编译及问题解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
【Android系统编译】
平台:
Android编译:
烧写固件路径:
【android版本号查看】
【RK3399开发环境搭建】
4.1 JDK 安装
4.2 Linux 服务器开发环境搭建
4.2.1 发布包使用 Linux 服务器系统版本
4.2.2 网络环境搭建
4.2.3 软件包安装
4.2.4 交叉编译工具链介绍
4.3 编译模式
【代码编译】
4.4.1挖掘机编译
uboot 编译步骤:
kernel 编译步骤:
android 编译步骤:
android 升级包:
一键编译命令:
【编译问题汇总】
解决如下:
(1)修改/root/.jack-settings文件
(2)修改/root/.jack-server/config.properties文件
(3)注释文件”...TLSv1, TLSv1.1...”行,重启jack服务。
查看jack启动是失败日志:
【Android7源码编译】
【编译c程序】
【刷机或烧写固件说明】
【Android系统编译】
平台:
系统android7.1 硬件平台:RK3399
裁剪剩余App路径:
android7\out\target\product\rk3399_xxx\system\app
Android编译:
# source build/envsetup.sh
# lunch rk3399_xxx-userdebug
# make clean
# make -j20
烧写固件路径:
~android7\out\target\product\rk3399_xxx\
【android版本号查看】
>adb shell "getprop ro.build.version.sdk"
adb server version (31) doesn't match this client (41); killing...
* daemon started successfully
【RK3399开发环境搭建】
4.1 JDK 安装
Android7.1 系统编译依赖于 JAVA 8。编译之前需安装 OpenJDK。
安装命令如下。
sudo apt-get install openjdk-8-jdk
配置 JAVA 环境变量,例如,安装路径为/usr/lib/jvm/java-8-openjdk-amd64,可在终
端执行如下命令配置环境变量。
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
4.2 Linux 服务器开发环境搭建
Rockchip Buildroot Linux SDK 是在 Ubuntu 16.04 上开发测试的。因此,我们推荐使用
Ubuntu 16.04 的系统进行编译。其他版本没有具体测试,可能需要对软件包做相应调整。
除了系统要求外,还有其他软硬方面的要求。
l 硬件要求:64 位系统,硬盘空间大于 40G。如果您进行多个构建,将需要更大的硬盘空间。
l 软件包依赖:除了 python 2.7,make 3.8,git 1.7 之外,还需要安装一些额外的软件
包,将在软件包安装章节中列出。
4.2.1 发布包使用 Linux 服务器系统版本
本 SDK 开发环境安装如下版本 Linux 系统,SDK 默认均以此 Linux 系统进行编译:Rockchip Buildroot Linux 软件开发指南 4 开发环境搭建
Copyright 2019 @Fuzhou Rockchip Electronics Co., Ltd. 4-2
Ubuntu 16.04.2 LTS
Linux version 4.4.0-62-generic (buildd@lcy01-30) (gcc version 5.4.0 20160609
(Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017
4.2.2 网络环境搭建
请用户自行配置网络,并安装 nfs,samba,ssh 等网络组件。
4.2.3 软件包安装
操作系统安装好后,且用户已自行配置好网络环境,则可继续如下步骤完成相关软件包的安装。
1. apt-get update
$ sudo apt-get update
2. 安装 Kernel 及 U-Boot 编译需要依赖的软件包
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl
zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev
x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils
xsltproc unzip device-tree-compiler liblz4-tool
3. 安装 Buildroot 编译需要依赖的软件包
sudo apt-get install libfile-which-perl sed make binutils gcc g++ bash patch gzip
bzip2 perl tar cpio python unzip rsync file bc libmpc3 git repo texinfo pkg-config cmake
tree texinfo
若编译遇到报错,可以视报错信息,安装对应的软件包。
4.2.4 交叉编译工具链介绍
鉴于 Rockchip Buildroot SDK 目前只在 Linux 下编译,我们也仅提供了 Linux 下的交叉编译
工具链。其中 U-Boot 及 Kernel 使用的编译工具链预置目录在 prebuilt/gcc 下,buildroot 使用
该开源软件中编译出来的工具链。
U-Boot 及 Kernel 编译工具链
prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux
-gnu/bin/aarch64-linux-gnu对应版本
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
Buildroot 编译工具链
buildroot/output/rockchip_rk3308_release/host/bin/aarch64-rockchip-linux-gnu对应版本
gcc version 6.4.0 (Buildroot 2018.02-rc3-00017-g9c68ede
如果需要其他平台或版本的工具链,需自行编译。
上述环境准备好后,Linux 服务器开发环境搭建已完成,可以下载编译源代码了。
4.3 编译模式
SDK 默认以 userdebug 模式编译。
使用 adb 时,需要先执行 adb root ,adb disable-verity 关闭 system 分区的 verity
特性,重启后再执行 adb root, adb remount,进而进行 push 操作来 debug。
【代码编译】
4.4.1挖掘机编译
uboot 编译步骤:
# cd u-boot
# make rk3399_defconfig
# make ARCHV=aarch64
kernel 编译步骤:
# cd kernel
# make ARCH=arm64 rockchip_defconfig -j8
# make ARCH=arm64 rk3399-sapphire-excavator-edp.img -j12
android 编译步骤:
# source build/envsetup.sh
# lunch rk3399_xxx-userdebug
# make -j20
# ./mkimage.sh
完成编译后,执行 SDK 根目录下的 mkimage.sh 后在 rockdev/Image-xxx/目录生成完整
的固件包(xxx 是具体 lunch 的产品名)。
android 升级包:
# make otapackage -j20
# ./mkimage.sh ota -j20
一键编译命令:
一键编译前删除多余app:
#rm -rf out/target/product/rk3399_xxx/system/priv-app/*
#rm -rf out/target/product/rk3399_xxx/system/app/*
./build-rk3399-xxx.sh -o -u -v 0.0.0.4
编译输出路径:T:\xxx\android7\IMAGE\RK3399-SAPPHIRE-EXCAVATOR-EDP_7.1.2_20211008.1630_1.0.0.1\IMAGES
【编译问题汇总】
# make rk3399_defconfig
:~/xxx/android7/u-boot$ make rk3399_defconfig
HOSTCC scripts/basic/fixdep
/bin/sh: 1: cc: not found
scripts/Makefile.host:118: recipe for target 'scripts/basic/fixdep' failed
make[1]: *** [scripts/basic/fixdep] Error 127
Makefile:416: recipe for target 'scripts_basic' failed
make: *** [scripts_basic] Error 2
# make -j12
Jack server already installed in "/root/.jack-server"
Communication error with Jack server (35), try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'
[ 0% 21/29024] target C++: libskia_static ...external/skia/src/core/SkBitmapProcState.cpp
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (59 seconds) ####
解决如下:
(1)修改/root/.jack-settings文件
$/root/.jack-settings
# Server settings
SERVER_HOST=127.0.0.1
# (修改) //默认8076
SERVER_PORT_SERVICE=8016
# (修改) //默认8077
SERVER_PORT_ADMIN=8017
# Internal, do not touch
SETTING_VERSION=4
继续报错:
Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'
[ 46% 23797/50840] target Prebuilt: webview (o...01/obj/APPS/webview_intermediates/package.apk
Archive: out/target/product/rk3399_xxx/obj/APPS/webview_intermediates/package.apk
inflating: out/target/product/rk3399_xxx/obj/APPS/webview_intermediates/uncompressedlibs/lib/arm64-v8a/libwebviewchromium.so
inflating: out/target/product/rk3399_xxx/obj/APPS/webview_intermediates/uncompressedlibs/lib/armeabi-v7a/libwebviewchromium.so
deleting: lib/arm64-v8a/libwebviewchromium.so
deleting: lib/armeabi-v7a/libwebviewchromium.so
adding: lib/arm64-v8a/libwebviewchromium.so (stored 0%)
adding: lib/armeabi-v7a/libwebviewchromium.so (stored 0%)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (16:26 (mm:ss)) ####
(2)修改/root/.jack-server/config.properties文件
$vim /root/.jack-server/config.properties
#
#Wed Dec 08 07:43:36 UTC 2021
jack.server.max-jars-size=104857600
jack.server.max-service=6
jack.server.service.port=8016
jack.server.max-service.by-mem=1\=2147483648\:2\=3221225472\:3\=4294967296
jack.server.admin.port=8017
jack.server.config.version=2
jack.server.time-out=7200
继续报错:
hardware/rockchip/camera/CameraHal/CameraHal.cpp:747:63: warning: unused parameter 'arg2' [-Wunused-parameter]
int CameraHal::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
^
hardware/rockchip/camera/CameraHal/CameraHal.cpp:783:25: warning: unused parameter 'fd' [-Wunused-parameter]
int CameraHal::dump(int fd)
^
13 warnings generated.
[ 37% 7943/21396] target StaticLib: libv8_32...TATIC_LIBRARIES/libv8_intermediates/libv8.a)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (06:48 (mm:ss)) ####
(3)注释文件”...TLSv1, TLSv1.1...”行,重启jack服务。
$vim /etc/java-8-openjdk/security/java.security
# Example:
# jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
# jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
# DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
# include jdk.disabled.namedCurves
# Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)
- Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms in /etc/java-8-openjdk/security/java.security file
- Restart the jack server: cd /prebuilts/sdk/tools/ ./jack-admin kill-server ./jack-admin start-server
#cd /prebuilts/sdk/tools/
#./jack-admin kill-server
#./jack-admin start-server
#make -j20
#./mkimage.sh
编译完成:
system/core/libpixelflinger/tests/codegen/../../codeflinger/ARMAssemblerProxy.h:42:21: note: hidden overloaded virtual function 'android::ARMAssemblerProxy::reset' declared here: different number of parameters (0 vs 1)
virtual void reset();
^
1 warning generated.
[ 93% 9921/10637] host Java: ahat-tests (out/host/common/obj/JAVA_LIBRARIES/ahat-tests_intermediates/classes)
Note: art/tools/ahat/test/SortTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 97% 10342/10637] host Java: android-icu4j-host (out/host/common/obj/JAVA_LIBRARIES/android-icu4j-host_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: external/icu/android_icu4j/src/main/java/android/icu/impl/Relation.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 99% 10629/10637] host Java: android-icu4j-tests-host (out/host/common/obj/JAVA_LIBRARIES/android-icu4j-tests-host_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[100% 10637/10637] Checking build with Jack: out/host/common/obj/JAVA_LIBRARIES/ahat-test-dump_intermediates/jack.check.timestamp
查看jack启动是失败日志:
#cat /root/.jack-server/logs/jack-server-0-0.log
02:06:47.635: SEVERE: com.android.jack.launcher.ServerLauncher: Server 1 Exception
com.android.jack.server.api.v01.ServerException: './config.properties' must have permission rw------- but have rw-rwxrwx
at com.android.jack.server.JackServerImpl.run(JackServerImpl.java:65)
at com.android.jack.launcher.ServerLauncher$3.run(ServerLauncher.java:391)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: './config.properties' must have permission rw------- but have rw-rwxrwx
at com.android.jack.server.JackHttpServer.checkAccess(JackHttpServer.java:696)
at com.android.jack.server.JackHttpServer.loadConfig(JackHttpServer.java:513)
at com.android.jack.server.JackHttpServer.<init>(JackHttpServer.java:379)
at com.android.jack.server.JackServerImpl.run(JackServerImpl.java:61)
... 2 more
解决办法:
# chmod 600 /root/.jack-server/config.properties
问题:
out/target/common/obj/PACKAGING/system-api.txt:47262: error 4: Added public method android.view.WindowManager.registerPointerEventListener(MPointerEventListener) out/target/common/obj/PACKAGING/system-api.txt:47264: error 4: Added public method android.view.WindowManager.unregisterPointerEventListener(MPointerEventListener) out/target/common/obj/PACKAGING/system-api.txt:47419: error 3: Added class WindowManager.MPointerEventListener to package android.view ****************************** 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. ******************************
解决办法:
make update-api
【Android7源码编译】
u-boot编译步骤
$ cd u-boot
$ make rk3399_defconfig
$ make ARCHV=aarch64
kernel编译步骤
$ cd kernel
$ make ARCH=arm64 rockchip_defconfig -j20
$ make ARCH=arm64 rk3399-sapphire-excavator-edp.img -j20
android编译步骤
$ source build/envsetup.sh
$ lunch rk3399_xxx-userdebug
$ make -j20
$ ./mkimage.sh
U盘、SD卡启动盘烧写镜像制作
一键编译前删除多余app(暂时发现没有作用):
$rm -rf out/target/product/rk3399_xxx/system/priv-app/*
$rm -rf out/target/product/rk3399_xxx/system/app/*
$./build-rk3399-xxx.sh -o -u -v 1.0.1.19-cangjie2
【编译c程序】
source build/envsetup.sh
lunch rk3399_xxx-userdebug
mmm splash/
Android.mk文件:
LOCAL_PATH := $(call my-dir)
################################################################################
include $(CLEAR_VARS)
LOCAL_MODULE_PATH := splash
LOCAL_SHARED_LIBRARIES := libc libutils libcutils liblog
# LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:= splash.c
LOCAL_MODULE := splash
include $(BUILD_EXECUTABLE)
################################################################################
编译完成后bin文件位置:
splash/splash
【刷机或烧写固件说明】
以上编译完毕,线刷固件生成路径Android_source/android7/rockdev/Image-rk3399_xxx
U盘刷机包:
M:xxx\android7\IMAGE\RK3399-SAPPHIRE-EXCAVATOR-EDP_7.1.2_20220315.0132_0.0.0.4\IMAGES\rk3399_xxx-target_files-eng.root.zip改名为update.zip放置U盘根目录即可。
SD卡刷机包:
M:xxx\android7\IMAGE\RK3399-SAPPHIRE-EXCAVATOR-EDP_7.1.2_20220315.0132_0.0.0.4\IMAGES\update.img改名为sdupdate.img放置SD卡根目录即可。
这篇关于RK3399平台Android7系统编译及问题解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!