开发套件 905D android代码编译烧写教程

官方教程

(767150435) #1

ALL in ONE 开发板 AMLOGIC 905D android代码编译烧写教程

我们使用Google公司的Gerrit系统来管理我们的amlogic sdk源代码。

设置 android 编译环境

64-bit Ubuntu 系统

  1. 安装 Ubuntu (14.04 或者 16.04) 64位系统, 内存至少8G, CPU核数至少4个,单个可用分区至少60G。

  2. 安装编译必须的软件包:

      sudo apt-get install git-core gnupg gperf zip cscope ctags libz-dev libexpat-dev \
      python language-pack-en texinfo zlib1g-dev  x11proto-core-dev  libx11-dev\
      build-essential g++ git bison flex unzip gcc-multilib g++-multilib libgl1-mesa-dev \
      libssl-dev libxml-simple-perl libxml-sax-perl libxml2-dev libxml2-utils xsltproc \
      wget bc ccache curl libc6-dev-i386 lib32ncurses5-dev lib32z-dev
    
  3. 安装java环境并配置java环境变量,安装命令如下:

     sudo add-apt-repository ppa:openjdk-r/ppa
     sudo apt-get update
     sudo apt-get install openjdk-7-jdk 
    

    保证java -version 有以下结果:

    java -version
        java version "1.7.0_121"
    
        OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.3)
        OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode)
    

安装repo 工具

  1. 确保主目录下有一个 bin/ 目录,并且该目录包含在路径中:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
  1. 根据您的办公网络情况,获取 repo 工具。
    • 可以翻墙

      如果您的办公环境可以翻墙访问 Google 网站,您可以使用Google 官方发行的 repo 工具。

      $ curl -Ls -o ~/bin/repo https://storage.googleapis.com/git-repo-downloads/repo 
      $ chmod a+x ~/bin/repo
      
    • 不能翻墙

      如果您的办公环境可以不能访问 Google 网站,您可以使用Rokid 修正版的 repo 工具。

      $ curl -Ls -o ~/bin/repo  http://scm-deps-library.rokid-inc.com/linux/buildroot_dl_aml/tools/repo
      $ chmod a+x ~/bin/repo
      

初始化 repo 客户端

需要根据您的开发板的芯片厂商来选择具体的代码下载库。我们最近在外网代码仓库中加入了权限管理,各位可以参考配置代码权限,申请账号,并配置权限。之后再执行以下命令,同步代码:

注意命令中的user对应的openai的用户名。

以下示例同步的代码仅保证支持Amlogic-905D开发板。

  • 运行repo init

    • repo 是Google官方版本
        repo init -u ssh://{user}@openai.rokid.com:29418/amlogic-sdk-s9xx/manifest -m rokid_sdk_release.xml
    
    • repo 是Rokid 修正版本
        repo init -u ssh://{user}@openai.rokid.com:29418/amlogic-sdk-s9xx/manifest -m rokid_sdk_release.xml --repo-url=ssh://{user}@openai.rokid.com:29418/tools/repo --no-repo-verify
    
  • 下载RokidOS 代码树

	repo sync
  • 编译代码树
    source build/envsetup.sh
    
    lunch nanat2-userdebug-32
    # 或 lunch 对应的id号 
    lunch 69
    make update-api
    make -j4

如果用ubuntu16.04的版本,可能出现以下报错: out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set16_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set16_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set32_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set32_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set_obj_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set_obj_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set64_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set64_instance: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set64_static: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_set64_static: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_proxy_invoke_handler: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_resolution_trampoline: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_resolution_trampoline: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_generic_jni_trampoline: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_to_interpreter_bridge: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_to_interpreter_bridge: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_instrumentation_entry: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_instrumentation_entry: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_instrumentation_exit: error: unsupported reloc 43 out/host/linux-x86/obj32/SHARED_LIBRARIES/libart_intermediates/arch/x86/quick_entrypoints_x86.o:function art_quick_deoptimize: error: unsupported reloc 43 host C++: libinput <= frameworks/native/libs/input/KeyLayoutMap.cpp clang: error: linker command failed with exit code 1 (use -v to see invocation) build/core/host_shared_library_internal.mk:51: recipe for target ‘out/host/linux-x86/obj32/lib/libart.so’ failed make: *** [out/host/linux-x86/obj32/lib/libart.so] Error 1 make: *** Waiting for unfinished jobs… Install: out/host/linux-x86/bin/apicheck ```

需要做以下修改:

It works to me:
in file /art/build/Android.common_build.mk, find out:
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
change to :
# Host.
ART_HOST_CLANG := false
ifeq ($(WITHOUT_HOST_CLANG),false)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif

代码编译成功,可以通过刷机工具刷入系统,具体文档请参考:

开发板初体验

配网

开机启动后第一次开机时间可能较长,需要配网。配网方式需要。

# adb 获取root 权限
adb root
# adb 获取读写权限
adb remount
# adb 登录到设备上
adb shell
# 增加网络,返回id,第一次是0,也可以配置多个。
wpa_cli -g /data/misc/wifi/sockets/wlan0 add_network

# 设置网络SSID, 注意第5个参数是add_network返回的值
wpa_cli -g /data/misc/wifi/sockets/wlan0 set_network 0 ssid '"SSID"'

# 设置密码,第五个参数同上
wpa_cli -g /data/misc/wifi/sockets/wlan0 set_network 0 psk '"xxxxxxxxx"'

# 使能网络
wpa_cli -g /data/misc/wifi/sockets/wlan0 enable_network 0

# 保存网络
wpa_cli -g /data/misc/wifi/sockets/wlan0 save_config

配置openvoice 对应 key ID

进入ROKID开放平台,到此页面注册账号,登录后点选「语音接入」进行设备认证信息申请。

1. 登录后点选「语音接入」进行设备认证信息申请。
2. 具体做法:语音接入 > 创建新设备 > 填写设备名称 > 创建认证文件。之后您将获得:account_id、device_type_id、device_id、secret、key。
3. 修改设备中/system/etc/openvoice_proc.json。

查看语音信息

代码中集成了rokid blacksiren sdk,可以查看语音log,执行以下命令:

logcat -s openvoice_process VoiceService

你会看到如下打印:

11-06 04:48:47.141  3923  4807 V openvoice_process: event : -------------------------101----
11-06 04:48:47.153  3923  5067 V openvoice_process: result : id 	 1 	 	 type 	 2 	 err 	 0
11-06 04:48:47.153  3923  5067 V openvoice_process: result : asr	我要听歌
11-06 04:48:47.155  3923  5067 V openvoice_process: current_status     >>   2
11-06 04:48:47.174  3923  4807 V openvoice_process: event : -------------------------101----
11-06 04:48:47.178  3923  4807 V openvoice_process: event : -------------------------103----
11-06 04:48:47.178  3923  4807 I openvoice_process: VAD_CANCEL		 ID  :   <<-1>> 	  1
11-06 04:48:47.841  3923  5067 V openvoice_process: result : id 	 1 	 	 type 	 3 	 err 	 0
11-06 04:48:47.841  3923  5067 V openvoice_process: result : nlp	{"appId":"R233A4F187F34C94B93EE3BAECFCE2E3","appName":"若琪音乐","asr":"我要听歌","cloud":true,"intent":"play_random","pattern":"^($me)?($very)?($want)?($play2)($keyword)($ah)?$","slots":{"keyword":"{\"type\":\"keyword\",\"value\":\"歌\"}","me":"{\"type\":\"me\",\"value\":\"我\"}","play2":"{\"type\":\"play2\",\"value\":\"听\"}","want":"{\"type\":\"want\",\"value\":\"要\"}"}}
11-06 04:48:47.841  3923  5067 V openvoice_process: result : action  {"appId":"R233A4F187F34C94B93EE3BAECFCE2E3","response":{"action":{"directives":[{"action":"STOP","disableEvent":false,"type":"voice"},{"action":"PLAY","disableEvent":false,"item":{"itemId":"play_random$$ULT$$8279121","offsetInMilliseconds":0,"token":"play_random$$ULT$$8279121","type":"AUDIO","url":"http://tc.97ting.com/content/08/279/8279121-MP3-320K-FTD.mp3?sign=K6S2i3Ojvdr53x8zVuoVXUXzWMhhPTEwMDM5ODY3Jms9QUtJRE1Fdm53SXdwNFlqUlU1NHhxd3VLQlRYMExOOWdJVFNRJmU9MTUxMDExNjUyNyZ0PTE1MDk5NDM3Mjcmcj0xMTUzMzE1NDE0JmY9L2NvbnRlbnQvMDgvMjc5LzgyNzkxMjEtTVAzLTMyMEstRlRELm1wMyZiPXVsdGltYXRl&transDeliveryCode=RK@22776021@1509943727@S"},"type":"media"}],"form":"scene","shouldEndSession":false,"type":"NORMAL","version":"2.0.0"},"resType":"INTENT","respId":"1BAA411BE7444146A7E086352273BED2"},"session":{},"startWithActiveWord":false,"version":"2.0.0"}
11-06 04:48:47.842  4521  4596 E VoiceService: asr	我要听歌
11-06 04:48:47.842  4521  4596 E VoiceService: nlp	{"appId":"R233A4F187F34C94B93EE3BAECFCE2E3","appName":"若琪音乐","asr":"我要听歌","cloud":true,"intent":"play_random","pattern":"^($me)?($very)?($want)?($play2)($keyword)($ah)?$","slots":{"keyword":"{\"type\":\"keyword\",\"value\":\"歌\"}","me":"{\"type\":\"me\",\"value\":\"我\"}","play2":"{\"type\":\"play2\",\"value\":\"听\"}","want":"{\"type\":\"want\",\"value\":\"要\"}"}}

其中asr对应的含义是:Automated Speech Recognition,即自动语音识别技术,它是一种将人的语音转换为文本的技术,对应用户说的话。


如何访问扩展板上的USB口
关于Speech接口的疑问?
Rokid ALL in ONE 开发套件新手教程汇总
(medea) #2

赞一个。可以玩起来了。


(chao.xuc) #3

cool!


(1106926694) #4

下载不下来,repo sync之后经常会中断下载,提示exited sync due to fetch errors


(767150435) #5

请问下 你用的是google 的repo 还是rokid的repo?


(1106926694) #6

谷歌的repo


(767150435) #7

麻烦用rokid对应的repo试下,用Google的repo 目前问题我们的网络工程师还在查。

wget https://scm-deps-library.rokid-inc.com/linux/buildroot_dl_aml/repo > ~/bin/repo

(767150435) #8

ROKID 代码 总共十几个G,下载过程中 网络不稳定, 可能会中断。请耐心多试几次,也可以把报错发出来,我们网络工程师方便定位原因。


(1106926694) #9

中断信息如下:
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
remote: Counting objects: 22910, done
remote: Finding sources: 100% (22910/22910)
fatal: The remote end hung up unexpectedly0 GiB | 1.15 MiB/s
fatal: early EOF
fatal: index-pack failed
remote: Counting objects: 22910, done
remote: Finding sources: 100% (22910/22910)
fatal: The remote end hung up unexpectedly0 GiB | 959.00 KiB/s
fatal: early EOF
fatal: index-pack failed
error: Cannot fetch amlogic-sdk-s9xx/platform/prebuilts/sdk

error: Exited sync due to fetch errors


(767150435) #10

下载报错的问题 我们的网络配置工程师 已经搞定了 ,但是这个代码有十几G,下载过程中网络不稳定,很有可能断掉,请麻烦多试几次


(1106926694) #11

目前我的板子刷软件之后是查看log信息是这样的,哪个环节没有弄好吗
11-11 03:15:47.605 3918 7107 V VoiceService: current_status >> 2
11-11 03:16:46.341 3918 4828 V VoiceService: event : -------------------------107----
11-11 03:16:46.342 4540 4602 E VoiceService: 0 ,sl : 130.0
11-11 03:16:46.342 3918 4828 V VoiceService: VAD_COMING
11-11 03:16:46.342 3918 4828 V VoiceService: event : -------------------------114----
11-11 03:16:46.663 3918 4828 V VoiceService: event : -------------------------109----
11-11 03:16:46.663 4540 4601 E VoiceService: 1 ,sl : 130.0
11-11 03:16:46.664 3918 4828 V VoiceService: VAD_CMD
11-11 03:16:46.664 3918 4828 V VoiceService: event : -------------------------100----
11-11 03:16:46.664 3918 4828 V VoiceService: skill options : {}
11-11 03:16:46.665 4540 4601 E VoiceService: 2 ,sl : 0.0
11-11 03:16:46.665 3918 4828 V VoiceService: VAD_START ID : <<6>>
11-11 03:16:46.665 3918 4828 V VoiceService: event : -------------------------101----


(薯) #12

这个有没有做

1、进入Rokid开放平台申请Rokid账号,已经有Rokid账号的同学可直接登录(但需进行部分信息补全)。
2、登录后点选「语音接入」进行设备认证信息申请。
3、具体做法:语音接入 > 创建新设备 > 填写设备名称 > 创建认证文件。之后您将获得:
account_id、device_type_id、device_id、secret、key

把得到账号填⼊到 system/etc/openvoice_profile.json


(1106926694) #13

这些都做了,就是有个device_id我是自己随便设置的,认证文件里面没有device_id的


(薯) #14

麻烦说个“若琪 你好”,然后截个log看一下


(1106926694) #15

logcat.rar (254.7 KB)
这个是我导出来的一个log文件


(薯) #16

看到了你说的话,就是这个结果


(1106926694) #17

我插着耳机这边没有反应,指示灯也没有反应


(薯) #18

目前只供激活模块,你可以跟据NLP写些skills来控制外围设备


(yhlinter) #19

源码下载不了,输入repo sync后,一点反应都没有


(767150435) #20

你好,你把repo 拷贝到~/bin/这个目录下,请问你把linux 的 PATH 环境变量是否加入 ~/bin/这个目录?