目标 : i.MX8M EVK board 编译出 Alexa SDK (AVS) image , 详细步骤可以参考Build Alexa SDK (AVS) image for i.MX8M EVK board (with Yocto Morty, Kernel4.9)
$ cd
$ repo init -u https://source.codeaurora.org/external/imxsupport/meta-avs-demos -b master -m imx-alexa-sdk-4.9.51-8mq_ga.xml
$ repo sync
配置环境 MACHINE=imx8mqevk DISTRO=fsl-imx-xwayland source avs-setup-demo.sh -b
编译 bitbake avs-image , 一段时间后编译qemu-native/2.7.0 的时候报错
bitbake avs-image
WARNING: Host distribution "Ubuntu-18.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |###############################################################################################################################################################################| Time: 0:00:01
Loaded 3080 entries from dependency cache.
Parsing recipes: 100% |#############################################################################################################################################################################| Time: 0:00:53
Parsing of 2345 .bb files complete (1282 cached, 1063 parsed). 3080 targets, 492 skipped, 12 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.32.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "Ubuntu-18.04"
TARGET_SYS = "aarch64-poky-linux"
MACHINE = "imx8mqevk"
DISTRO = "fsl-imx-wayland"
DISTRO_VERSION = "4.9.51-mx8-ga"
TUNE_FEATURES = "aarch64"
TARGET_FPU = ""
meta
meta-poky = "HEAD:8298428c032ec9bc5b514d0c194a16cf371475ea"
meta-oe
meta-multimedia = "master:b40116cf457b88a2db14b86fda9627fb34d56ae6"
meta-freescale = "HEAD:05681fdf8298bb441c15135eae424c7601b07e98"
meta-freescale-3rdparty = "HEAD:e55167c3c2770c07a475342f99cc2a3a23fbfa0c"
meta-freescale-distro = "HEAD:cd5c7a2539f40004f74126e9fdf08254fd9a6390"
meta-bsp
meta-sdk = "HEAD:0649ff215e8f9b79ecd3b813d672547aa45c086b"
meta-browser = "HEAD:678706cb43fb8576ff7b88bfb612993b8542724d"
meta-gnome
meta-networking
meta-python
meta-filesystems = "master:b40116cf457b88a2db14b86fda9627fb34d56ae6"
meta-qt5 = "HEAD:ff073f04109900fc07bf81e2f1df63c626caf342"
meta-avs-demos = "HEAD:fe76db339872033dcc76beea28bfa2c9e9cfb3f4"
Initialising tasks: 100% |##########################################################################################################################################################################| Time: 0:00:56
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: qemu-native-2.7.0-r1 do_compile: oe_runmake failed
ERROR: qemu-native-2.7.0-r1 do_compile: Function failed: do_compile (log file is located at xxx/tmp/work/x86_64-linux/qemu-native/2.7.0-r1/temp/log.do_compile.11705)
ERROR: Logfile of failure stored in: xxx/tmp/work/x86_64-linux/qemu-native/2.7.0-r1/temp/log.do_compile.11705
CC qga/channel-posix.o
CC qga/qapi-generated/qga-qapi-types.o
CC qga/qapi-generated/qga-qapi-visit.o
CC qga/qapi-generated/qga-qmp-marshal.o
CC qmp-introspect.o
CC qapi-types.o
CC qapi-visit.o
CC qapi-event.o
CC util/memfd.o
CC util/path.o
xxx/tmp/work/x86_64-linux/qemu-native/2.7.0-r1/qemu-2.7.0/util/memfd.c:40:12: error: static declaration of ‘memfd_create’ follows non-static declaration
static int memfd_create(const char *name, unsigned int flags)
^~~~~~~~~~~~
参考 stackoverflow 找到对应的答案:
Description: Building 2.8b2 and earlier fails on Ubuntu 18.04 LTS.
Workaround: It works on Ubuntu 16.04 LTS.
意思应该是Qemu 2.8b2以及更早版本在 Ubuntu 18.04 构建失败,但是在 Ubuntu 16.04 可以的。说的应该是对的,构建的时候本机为Ubuntu 18.04 , 最快捷的办法是在Docker 上构建就可以了。
方案2的思路就是如何在Ubuntu 18.04上编译qemu-native-2.7.0
最快速的办法是下载官网qemu-3.1.0的包,看看其中util/memfd.c怎么实现的。
也可以参考static declaration of memfd_create follows non-static declaration
# check if memfd is supported
memfd=no
cat > $TMPC << EOF
-#include //删除
+#include // 增加
int main(void)
{
diff --git a/util/memfd.c b/util/memfd.c
index 4571d1a..412e94a 100644 (file)
#include "qemu/memfd.h"
-#ifdef CONFIG_MEMFD
-#include // 删除
-#elif defined CONFIG_LINUX // 删除
+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD //增加
#include
#include
../../git/debugfs/../misc/create_inode.c:291:13: warning: In the GNU C Library, "minor" is defined
by . For historical compatibility, it is
currently defined by as well, but we plan to
remove this soon. To use "minor", include
directly. If you did not intend to use a system-defined macro
"minor", you should undefine it after including .
devminor = minor(st->st_rdev);
^~~~~~~~~~~~~~~~~~~~
../../git/debugfs/../misc/create_inode.c: At top level:
../../git/debugfs/../misc/create_inode.c:395:18: error: conflicting types for ‘copy_file_range’
static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
^~~~~~~~~~~~~~~
In file included from ../../git/debugfs/../misc/create_inode.c:19:0:
/usr/include/unistd.h:1110:9: note: previous declaration of ‘copy_file_range’ was here
ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
^~~~~~~~~~~~~~~
Makefile:412: recipe for target 'create_inode.o' failed
make[2]: *** [create_inode.o] Error 1
将yocto_code/build/tmp/work/x86_64-linux/e2fsprogs-native/1.43-r1/git/misc/create_inode.c中的头文件注释掉
//#include
ERROR: avs-device-sdk-git-r0 do_fetch: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export PATH="/home2/mike/nxp-avs_20190526/sources/poky/scripts:/home2/mike/nxp-avs_20190526/build-avs/tmp/work/aarch64-poky-linux/avs-device-sdk/git-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux:/home2/mike/nxp-avs_20190526/build-avs/tmp/work/aarch64-poky-linux/avs-device-sdk/git-r0/recipe-sysroot/usr/bin/crossscripts:/home2/mike/nxp-avs_20190526/build-avs/tmp/work/aarch64-poky-linux/avs-device-sdk/git-r0/recipe-sysroot-native/usr/sbin:/home2/mike/nxp-avs_20190526/build-avs/tmp/work/aarch64-poky-linux/avs-device-sdk/git-r0/recipe-sysroot-native/usr/bin:/home2/mike/nxp-avs_20190526/build-avs/tmp/work/aarch64-poky-linux/avs-device-sdk/git-r0/recipe-sysroot-native/sbin:/home2/mike/nxp-avs_20190526/build-avs/tmp/work/aarch64-poky-linux/avs-device-sdk/git-r0/recipe-sysroot-native/bin:/home2/mike/nxp-avs_20190526/sources/poky/bitbake/bin:/home2/mike/nxp-avs_20190526/build-avs/tmp/hosttools"; export HOME="/home/mike"; LANG=C git -c core.fsyncobjectfiles=0 clone --bare --mirror https://github.com/alexa/avs-device-sdk.git /home2/mike/nxp-avs_20190526/downloads//git2/github.com.alexa.avs-device-sdk.git --progress failed with exit code 128, output:
Cloning into bare repository '/home2/mike/nxp-avs_20190526/downloads//git2/github.com.alexa.avs-device-sdk.git'...
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (10/10), done.
error: RPC failed; result=56, HTTP code = 200B | 0 bytes/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
可能由于网络问题,Yocto下载第三方源码的时候非常慢,这个时候需要通过手动下载,在对应的avs-device-sdk_git.bb指定本地路径。
先确定软件包的下载地址,例如对于avs-device-sdk_git软件包:
bitbake -e avs-device-sdk | grep ^SRC_URI=
SRC_URI = " \
git://github.com/alexa/avs-device-sdk.git;branch=master;protocol=https \
改为
SRC_URI=" \
git:///local/path/avs-device-sdk;branch=master;protocol=file
Yocto tips (5): Yocto如何更改source code的下载与git clone地址
编译出错的原因主要是和Ubuntude的版本号有区别,一般普遍的SDK都可以在Ubuntu 16.04 上运行,可能Ubuntu 18.04 还没有完全匹配, 方便的额办法以后的SDK可以在Docker 中构建,可以避免环境的问题