1

我想为phyBOARD Mira 板的CANBOAT 存储库创建一个 Yocto 层,该板将连接到船上的 NMEA2000。我想读取不同的 PGN 值并将其存储在数据库中。

配置

我有一个 Linux 虚拟机(Ubuntu 16.04 LTS)

Linux ubuntu 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

我将所有图层都meta放在一个名为sources. $YOCTO_DIRsources我创建了meta-canboat具有以下结构的层:

├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-canboat
    └── canboat
        └── canboat.bb

canboat.bb基于Makefile 的 Yocto-Mega-Manual

SUMMARY = "CANBOAT"
SECTION = "base"
LICENSE = "GPLv3"
#DEPENDS = "xsltproc"

LIC_FILES_CHKSUM = "file://GPL;md5=05507c6da2404b0e88fe5a152fd12540"

S = "${WORKDIR}/git"

SRC_URI = "git://github.com/canboat/canboat.git;branch=${SRCBRANCH}"
SRCBRANCH = "master"
SRCREV = "93b2ebfb334d7a9750b6947d3a4af9b091be2432"

do_compile() {// this is not necessary for Yocto
    make
}
do_install() { // for Makefile Packages do_install is necessary
   oe_runmake install DESTDIR=${D}
}

构建和错误

build我执行的目录中

  bitbake canboat

并获取错误日志:

| DEBUG: Executing shell function do_compile
| mkdir -p rel/linux-x86_64
| for dir in actisense-serial analyzer n2kd nmea0183 ip group-function candump2analyzer socketcan-writer; do make -C $dir; done
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/actisense-serial'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/actisense-serial -I../common actisense-serial.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/actisense-serial'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/analyzer -I../common pgn.c analyzer.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/n2kd'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/n2kd -I../common main.c gps_ais.c nmea0183.c ../common/common.c -lm
| cp n2kd_monitor ../rel/linux-x86_64/n2kd_monitor
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/n2kd'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/nmea0183'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/nmea0183-serial  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -I../common nmeareader.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/nmea0183'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/ip'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/iptee  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -I../common iptee.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/ip'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/group-function'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/command-group-function -I../common command.c ../common/common.c
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/request-group-function -I../common request.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/group-function'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/candump2analyzer'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/candump2analyzer -I../common candump2analyzer.c ../common/common.c -lm
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/candump2analyzer'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/socketcan-writer'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/socketcan-writer -I../analyzer -I../common socketcan-writer.c ../analyzer/pgn.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/socketcan-writer'
| make -C analyzer json
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| ../rel/linux-x86_64/analyzer -explain-xml >pgns.xml && xsltproc pgns2json.xslt pgns.xml >pgns.json

| /bin/sh: ../rel/linux-x86_64/analyzer: 无法执行二进制文件: Exec 格式错误

| Makefile:33: recipe for target 'json' failed
| make[1]: *** [json] Error 126
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| Makefile:29: recipe for target 'all' failed
| make: *** [all] Error 2
| WARNING: /opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/temp/run.do_compile.47581:1 exit 2 from 'make'
| ERROR: Function failed: do_compile (log file is located at /opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/temp/log.do_compile.47581)

-x86_64我了解平台上的二进制文件可能不兼容gnueabi。如何编译此存储库以克服这种不兼容性?

GitHub 回购

元皮艇

4

1 回答 1

0

答案取决于二进制文件的作用:二进制文件的结果是否取决于工具运行的架构?如果您在问题中添加详细信息,有人可能会提供更详细的答案。

选项1:如果工具结果独立于架构,那么您可以首先编译canboat的“原生”(即构建主机arch)版本,然后确保目标构建依赖于原生版本并使用来自原生构建的工具. 这将意味着配方中的微小变化和 Makefile 中的一些变化

选项 2:如果结果确实依赖于 arch,您可能必须使用 qemu 来运行该工具。

在 poky 资源中都有这两种情况的示例。

可能还有第三种选择:如果构建成功不需要文件,则可以在第一次启动/安装时在安装后脚本中运行该工具(并修改构建系统以在构建期间不执行此操作)。

于 2018-05-04T15:46:41.437 回答