XILINX_linux基本命令的使用

XILINX_linux基本命令的使用petalinux-v2018.2rootfs配置开发用到的常用工具,使能如下选项,FilesystemPackages→base→util-linuxutil-linux-mkfsFilesystemPackages→base→e2fsprogs [*]e2fsprogs []e2fsprogs-dev…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

参考

libgcc-xilinx和libgcc-xilinx-dev两个库是为了添加libgcc_s.so.1,来使用pthread_exit()函数
开发者分享 | 如何给 u-boot 的源码生成 patch 并在 Petalinux 中编译
【工程师分享】在Petalinux编译多个源文件的Linux内核模块,以及扩展Makefile功能
开发者分享|Petalinux patch生成和应用方法整理
开发者分享|U-boot下的自定义命令设计
71198 – 2017.2-2017.4 Zynq UltraScale+ MPSoC VCU: PetaLinux fails to build gstreamer using sstate cache

Petalinux版本信息查询

每个Xilinx Petalinux工具版本都会在官网有一个AR来具体说明。所有版本说明的AR的名称会按照如下格式来命名,PetaLinux XXXX.X – Product Update Release Notes and Known Issues。例如你要找2021.1版本的话,可以在官网搜索PetaLinux 2021.1 – Product Update Release Notes and Known Issues就能直接找到了。在这个AR中会有一个列表介绍当前版本下所有petalinux工具相关的版本信息。
479

Petalinux

安装依赖,

$ sudo apt install ssh make tftp-hpa tftpd-hpa dos2unix iproute2 gawk xvfb git make net-tools libncurses5-dev zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo gcc-multilib build-essential libsdl1.2-dev libglib2.0-dev screen pax gzip zlib1g:i386 minicom u-boot-tools mtd-utils

安装,

$ mkdir -p /opt/Xilinx/Petalinux/2019.2
$ ./petalinux-v2019.2-final-installer.run /opt/Xilinx/Petalinux/2019.2
$ sudo dpkg-reconfigure dash #选择no

建立工程,可以创建空白工程,也可以从bsp创建工程,

# 空白工程
$ petalinux-create -t project -n zynq-v2018.2 --template zynq
$ cp ~/project/fdk/pcierc-zc706/pcierc_wrapper.hdf ./zynq-v2018.2
$ cd zynq-v2018.2
$ petalinux-config --get-hw-description=.
# 从bsp创建工程
$ petalinux-create -t project -s ./zynq-v2018.2.bsp

系统配置,可配置生成的固件这些参数,Yocto相关参数配置都在这里,

$ petalinux-config

配置rootfs,

$ petalinux-config -c rootfs

配置内核,发现默认的内核路径为build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.14-xilinx-v2018.2+gitAUTOINC+ad4cd988ba-r0/linux-plnx_zynq7-standard-build

$ petalinux-config -c kernel

编译,

$ petalinux-build

生成SDK,默认的SDK安装包在<proj_proot>/images/linux/sdk.sh,通过在rootfs中加入packagegroup-petalinux-qtpackagegroup-petalinux-opencv,可以制作出支持Qt和OpenCV的交叉编译工具链。

$ petalinux-build --sdk

安装SDK,默认的SDK安装路径在<proj_proot>/images/linux/sdk/

$ petalinux-package --sysroot
PetaLinux SDK installer version 2018.2
======================================
You are about to install the SDK to "/home/qe/project/petalinux/zynq-v2018.2/images/linux/sdk". Proceed[Y/n]? Y
Extracting SDK................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /home/qe/project/petalinux/zynq-v2018.2/images/linux/sdk/environment-setup-cortexa9hf-neon-xilinx-linux-gnueabi

使用Yocto工具的步骤,新建工程后需要使用petalinux-configpetalinux-config --oldconfig,完成基本环境创建。

$ source ~/program/petalinux-v2018.2-final/components/yocto/source/arm/environment-setup-cortexa9hf-neon-xilinx-linux-gnueabi 
SDK environment now set up; additionally you may now run devtool to perform development tasks.
Run devtool --help for further details.
qe@ubuntu:~/zynq-v2018.2$ source ~/program/petalinux-v2018.2-final/components/yocto/source/arm/layers/core/oe-init-build-env 

### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
qe@ubuntu:~/zynq-v2018.2/build$ export PATH=~/program/petalinux-v2018.2-final/tools/hsm/bin:$PATH
qe@ubuntu:~/zynq-v2018.2/build$ export BB_ENV_EXTRAWHITE="BB_ENV_EXTRAWHITE PETALINUX"
# 测试bitbake命令
qe@ubuntu:~/project/petalinux/zynq-v2018.2/build$ bitbake strace
Loading cache: 100% |############################################| Time: 0:00:00
Loaded 3423 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:03
Parsing of 2552 .bb files complete (2517 cached, 35 parsed). 3425 targets, 148 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#######################################| Time: 0:00:03
Checking sstate mirror object availability: 100% |###############| Time: 0:02:33
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 2206 tasks of which 2181 didn't need to be rerun and all succeeded.

下面就可以愉快的使用yocto的工具来开发了,修改内核/home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/workspace/sources/linux-xlnx测试一下,报错,找不到openamp.scc,但是这个文件在默认的内核路径为build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.14-xilinx-v2018.2+gitAUTOINC+ad4cd988ba-r0确实存在。进入这个目录来测试,还是不行,而且petalinux-config -c kernel也不能用了。把recipe reset之后petalinux-config -c kernel可以用了,所以,尝试在petalinux使用外部源代码来解决这个问题吧,当然需要make mrproper一下,刚看了官方好像是bitbake virtual/kernel -c menuconfig,算了,不测试了。

qe@ubuntu:~/zynq-v2018.2/build$ bitbake linux-xlnx -c menuconfig
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:01
Loaded 3423 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:04
Parsing of 2552 .bb files complete (2516 cached, 36 parsed). 3425 targets, 148 skipped, 0 masked, 0 errors.
NOTE: There are 1 recipes to be removed from sysroot plnx-zynq7, removing...
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:06
Checking sstate mirror object availability: 100% |###########################################################################################################################################| Time: 0:00:01
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: linux-xlnx-4.14-xilinx-v2018.2+git999-r0 do_kernel_metadata: Could not generate configuration queue for plnx-zynq7.
ERROR: linux-xlnx-4.14-xilinx-v2018.2+git999-r0 do_kernel_metadata: Function failed: do_kernel_metadata (log file is located at /home/qe/project/petalinux/zynq-v2018.2/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.14-xilinx-v2018.2+git999-r0/temp/log.do_kernel_metadata.35873)
ERROR: Logfile of failure stored in: /home/qe/project/petalinux/zynq-v2018.2/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.14-xilinx-v2018.2+git999-r0/temp/log.do_kernel_metadata.35873
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/layers/core/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: ['kern-tools-native']
| NOTE: Skipping as already exists in sysroot: ['quilt-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_kernel_metadata
| ERROR: could not find kconf openamp.cfg, included from /home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/workspace/sources/linux-xlnx/oe-local-files/openamp.scc
| ERROR: could not process input files: /home/qe/project/petalinux/zynq-v2018.2/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.14-xilinx-v2018.2+git999-r0/defconfig /home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/workspace/sources/linux-xlnx/oe-local-files/openamp.scc /home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/workspace/sources/linux-xlnx/oe-local-files/plnx_kernel.cfg /home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/workspace/sources/linux-xlnx/oe-local-files/user_2020-11-27-10-32-00.cfg
|        See /tmp/tmp.tGsI3j1qT6 for details
| ERROR: Could not generate configuration queue for plnx-zynq7.
| WARNING: /home/qe/project/petalinux/zynq-v2018.2/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.14-xilinx-v2018.2+git999-r0/temp/run.do_kernel_metadata.35873:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_kernel_metadata (log file is located at /home/qe/project/petalinux/zynq-v2018.2/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.14-xilinx-v2018.2+git999-r0/temp/log.do_kernel_metadata.35873)
ERROR: Task (/home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/layers/meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.2.bb:do_kernel_metadata) failed with exit code '1'
NOTE: Tasks Summary: Attempted 346 tasks of which 342 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/qe/program/petalinux-v2018.2-final/components/yocto/source/arm/layers/meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.2.bb:do_kernel_metadata
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

添加自己的固件文件到根文件系统,注意这个时候和APP不一样,你的FILES_${PN}一定要写,

$ petalinux-create -t apps --template install --name myfw --enable

petalinux-build卡住在source bitbake很久都没动,执行一下clean才能编,

petalinux-build -x distclean

添加驱动,删除驱动除了删除模块目录之外,您还必须从<plnx-proj-root>/project-spec/meta-user/recipes-core/images/petalinux-image.bbappend中删除行:IMAGE_INSTALL_append= "mymodule"。删除目录但保留petalinux-image-full.bbappend中的上述程序行将出错。

$ petalinux-create -t modules --name broadcom-wl --enableINFO: Create modules: broadcom-wl

编译,

$ petalinux-build
$ petalinux-build -c broadcom-wl

生成uImage,如果你想在zynq平台上使用jffs2,zynqmp平台不支持这个命令,

$ petalinux-package --image -c kernel --format uImage

创建BOOT.BIN,

# $ petalinux-package --boot --fsbl <FSBL_ELF> --fpga <BITSTREAM> --u-boot --pmufw <PMUFW_ELF>
# It will generate a BOOT.BIN in your working directory with:
# * specified <BITSTREAM>
# * specified <FSBL_ELF>
# * specified < PMUFW_ELF > *
# * newly built u-boot image which is <PROJECT>/images/linux/u-boot.elf

# 3合1
$ petalinux-package --boot --fpga images/linux/pcierc_wrapper_gen2_x4.bit --u-boot --force
# 2合1
$ petalinux-package --boot --u-boot --force

配置自动登录,

# Select Yocto-settings > Enable debug-tweaks
$ petalinux-config

添加自启动程序,采用install类型的模板,只需要把自己的应用命名为myapp部署到/usr/bin就可以了,而petalinux的${bindir}就代表/usr/bin

$ petalinux-create -t apps --template install -n myfw-init --enable
$ cat project-spec/meta-user/recipes-apps/myfw-init/myfw-init.bb
#
# This file is the myfw-init recipe.
#

SUMMARY = "Simple myfw-init application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://myfw-init \ "

S = "${WORKDIR}"

inherit update-rc.d
INITSCRIPT_NAME = "myfw-init"
INITSCRIPT_PARAMS = "start 99 S ."

do_install() { 
   
        install -d ${D}${sysconfdir}/init.d
        install -m 0755 ${S}/myfw-init ${D}${sysconfdir}/init.d/myfw-init
}
FILES_${PN} += "${sysconfdir}/*"
$ cat project-spec/meta-user/recipes-apps/myfw-init/files/myfw-init 
#!/bin/sh

DAEMON=/usr/bin/myapp
start ()
{ 
   
        echo " Starting myapp"
        start-stop-daemon -S -o --background -x $DAEMON
}
stop ()
{ 
   
        echo " Stoping myapp"
        start-stop-daemon -K -x $DAEMON
}
restart()
{ 
   
        stop
        start
}
[ -e $DAEMON ] || exit 1
        case "$1" in
                start)
                        start; ;;
                stop)
                        stop; ;;
                restart)
                        restart; ;;
                *)
                        echo "Usage: $0 {start|stop|restart}"
                        exit 1
        esac
exit $?

删除自己的应用,直接删除应用的文件夹,然后注释掉IMAGE_INSTALL_append= " ***"

# <plnx-proj-root>/project-spec/meta-user/recipes-core/images/petalinux-image-full.bbappend
IMAGE_INSTALL_append= " ***"

发布bsp,

$ petalinux-package --bsp -o zynq-v2018.2.bsp -p .
$ petalinux-package --bsp -o zynq-v2018.2.bsp -p . --force

连着vivado工程一起打包,clean表示把vivado工程清除后再发布,减少文件体积,

$ petalinux-package --bsp -o zynq-v2018.2.bsp -p . --hwsource <PATH_TO_HARDWARE_PROJECT> --force
$ petalinux-package --bsp -o zynq-v2018.2.bsp -p . --hwsource <PATH_TO_HARDWARE_PROJECT> --force --clean

设置下载缓存

参考AR711989,

This is a known issue in 2017.2-2017.4 PetaLinux if BB_NO_NETWORK is set to 1, and the local download directory is set to PREMIRRORS_prepend in the conf file.

The PREMIRRORS variable will have SOURCE_MIRROR_URL as the first URL.

This causes build to fail as network access is disabled. 

PREMIRRORS should be appended here so that a prepend in other layers/conf files takes precedence.

To work around this issue follow the steps below:

1) Run petalinux-config ---> Yocto Settings ---> Add pre-mirror url ---> file:///opt/xilinx/petalinux/sstate-rel-v2017.4/downloads

2) Run petalinux-config ---> Yocto Settings ---> Local sstate feeds settings ---> /opt/xilinx/petalinux/sstate-rel-v2017.4/aarch64 

3) Run petalinux-config ---> Yocto Settings ---> Network sstate feeds URL ---> http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_VER}/aarch64/sstate-cache  //Keep this as the default generated from PetaLinux tools

4) Run petalinux-config ---> Yocto Settings ---> [*] Enable BB NO NETWORK    //This is mandatory when you do not have network access on build machines.

5) Add this content in <plnx-proj-root>/project-spec/meta-user/conf/petalinuxbsp.conf and make sure that this path matches with the pre-mirror URL path mentioned above.

PREMIRRORS_prepend = " git://.*/.* file:///opt/xilinx/petalinux/sstate-rel-v2017.4/downloads \n \ ftp://.*/.* file:///opt/xilinx/petalinux/sstate-rel-v2017.4/downloads \n \ http://.*/.* file:///opt/xilinx/petalinux/sstate-rel-v2017.4/downloads \n \ https://.*/.* file:///opt/xilinx/petalinux/sstate-rel-v2017.4/downloads \n"


6) Run "petalinux-build -x mrproper && petalinux-build"

rootfs配置

petalinux-v2018.2,开发用到的常用工具,使能如下选项,libgcc-xilinxlibgcc-xilinx-dev这两个软件包找不到。

Filesystem Packages  → base  → util-linux  util-linux-mkfs
Filesystem Packages  → base  → e2fsprogs 
	[*] e2fsprogs                  
	[ ] e2fsprogs-dev                                                                                                     
	[*] e2fsprogs-mke2fs                                                                                                  
	[ ] e2fsprogs-dbg                                                                                                     
	[*] e2fsprogs-resize2fs                                                                                               
	[*] e2fsprogs-tune2fs                                                                                                 
	[ ] libss                                                                                                             
	[ ] libcomerr                                                                                                         
	[ ] libext2fs                                                                                                         
	[ ] libe2p                                                                                                            
	[*] e2fsprogs-e2fsck                                                                                                  
	[*] e2fsprogs-badblocks    
Filesystem Packages  → base  → usbutils
Filesystem Packages  → base  → i2c-tools
Filesystem Packages  → net  → netcat
Filesystem Packages  → console  → network  → ethtool

关闭,

Filesystem Packages  → misc  → tcf-agent 

默认已有,

cantools pciutils microcom

去掉不需要的image,

# project-spec/meta-user/conf/petalinuxbsp.conf
#Remove all qemu contents
IMAGE_CLASSES_remove = "image-types-xilinx-qemu qemuboot-xilinx"
IMAGE_FSTYPES_remove = "wic.qemu-sd tar.gz tar.bz2 ext3 ext3.bz2 cpio.bz2 cpio.xz cpio.lzma cpio.lz4"

增加软件包

petalinux采用yocto来制作跟文件系统,比如iperf3,在petalinux rootfs的menuconfig中是没有的,需要手动配置,iperf3 recipe位置在,

zc@ubuntu:~/program/petalinux-v2018.2-final/components/yocto/source/aarch64/layers/meta-openembedded/meta-oe/recipes-benchmark/iperf3$ ls -l
total 8
drwxr-xr-x 2 zc zc 4096 Jun  8  2018 iperf3
-rw-r--r-- 1 zc zc 1171 Jun  8  2018 iperf3_3.2.bb

在工程的meta-user里添加该软件包,双引号里记得加个空格,

zc@ubuntu:~/project/petalinux/zynqmp-v2018.2/project-spec/meta-user/recipes-core/images$ cat petalinux-image.bbappend 
#Note: Mention Each package in individual line
# cascaded representation with line breaks are not valid in this file.
IMAGE_INSTALL_append = " peekpoke"
IMAGE_INSTALL_append = " gpio-demo"
IMAGE_INSTALL_append = " iperf3"

使能该软件包,选中iperf3,

zc@ubuntu:~/project/petalinux/zynqmp-v2018.2$ petalinux-config -c rootfs

编译,

zc@ubuntu:~/project/petalinux/zynqmp-v2018.2$ petalinux-build

对于petalinux-image-full中的recipes,有sstate locked,在project-spec/meta-user/conf/petalinuxbsp.conf文件中添加SIGGENE_UNLOCKED_RECIPES += “my-recipe”来unlock。

zc@ubuntu:~/project/petalinux/zynqmp-v2018.2$ cat project-spec/meta-user/conf/petalinuxbsp.conf 
#User Configuration

#OE_TERMINAL = "tmux"

# Add EXTRA_IMAGEDEPENDS default components
EXTRA_IMAGEDEPENDS_append_zynqmp = " virtual/fsbl virtual/pmu-firmware arm-trusted-firmware"
EXTRA_IMAGEDEPENDS_append_zynq = " virtual/fsbl"
EXTRA_IMAGEDEPENDS_append_microblaze = " virtual/fsboot virtual/elfrealloc"


#Remove all qemu contents
IMAGE_CLASSES_remove = "image-types-xilinx-qemu qemuboot-xilinx"
IMAGE_FSTYPES_remove = "wic.qemu-sd"

EXTRA_IMAGEDEPENDS_remove = "qemu-helper-native virtual/boot-bin"

修改源代码

2021.1及以后的版本可以直接通过petalinux工具中的命令,把源码下载到当前的petalinux工程中然后直接按照你的需要进行修改。之后petalinux工具会按照你修改后的源码进行编译。命令格式如下:petalinux-devtool modify<recipe-name>,例如:petalinux-devtool modify linux-xlnx,Linux kernel的源码会被下载到<plnx-proj-root>/components/yocto/workspace/sources/<recipe-name>文件夹下。然后就可以直接在这个位置对kernel的源码进行修改,修改完成后直接用petalinux-build就可以编译进去了。如果不知道确切的recipe的名字的话,可以使用petalinux-devtool search <key word>来查找。例如:petalinux-devtool search xen。另外,在2021.1版本之后,FSBL的recipe-name为fsbl-firmware,pmu的recipe-name为pmu-firmware。
2021.1之前的版本通过patch的方式实现源码的修改,利用git工具,先从上面的列表中找到对应的版本,然后先下载下来。git clone -b<version> <source link>,下载之后修改对应的源码,修改完成后回到源码的根目录来生成patch,git add .,把修改的内容添加到本地版本中,git diff <version old> <version new> <xxx.patch>,生成2个版本之间的patch,版本信息可以使用git log或者git status来查看。 接下来就可以将生成的patch应用到petalinux工程中去。通常就是修改对应recipe的bbappend文件,把patch添加进去即可。

Petalinux生成的Makefile

petalinux 2015.2.1驱动Makefile,可参考学习一下,

# 
# Makefile template for out of tree kernel modules
#

# PetaLinux-related stuff
ifndef PETALINUX
$(error You must source the petalinux/settings.sh script before working with PetaLinux)
endif

-include modules.common.mk

ccflags-y += -Wno-error=date-time

KERNEL_BUILD:=$(PROOT)/build/$(LINUX_KERNEL)

LOCALPWD=$(shell pwd)
obj-m += pcie_sata_ep.o

all: build modules install

build:modules

.PHONY: build clean modules

clean:
	make INSTANCE=$(LINUX_KERNEL) -C $(KERNEL_BUILD) M=$(LOCALPWD) clean

modules:
	if [ ! -f "$(PROOT)/build/$(LINUX_KERNEL)/link-to-kernel-build/Module.symvers" ]; then \
		echo "ERROR: Failed to build module ${ 
    INSTANCE} because kernel hasn't been built."; \
		echo "ERROR: Please build kernel with petalinux-build -c kernel first."; \
		exit 255; \
	else \
		make INSTANCE=$(LINUX_KERNEL) -C $(KERNEL_BUILD) M=$(LOCALPWD) modules_only; \
	fi

install: $(addprefix $(DIR),$(subst .o,.ko,$(obj-m)))
	if [ ! -f "$(PROOT)/build/$(LINUX_KERNEL)/link-to-kernel-build/Module.symvers" ]; then \
		echo "ERROR: Failed to install module ${ 
    INSTANCE} because kernel hasn't been built."; \
		echo "ERROR: Please build kernel with petalinux-build -c kernel first."; \
		exit 255; \
	else \
		make INSTANCE=$(LINUX_KERNEL) -C $(KERNEL_BUILD) M=$(LOCALPWD) INSTALL_MOD_PATH=$(TARGETDIR) modules_install_only; \
	fi


help:
	@echo ""
	@echo "Quick reference for various supported build targets for $(INSTANCE)."
	@echo "----------------------------------------------------"
	@echo " clean clean out build objects"
	@echo " all build $(INSTANCE) and install to rootfs host copy"
	@echo " build build subsystem"
	@echo " install install built objects to rootfs host copy"

问题

error: expected identifier or ‘(’ before string constant

2019.1报错,

| In file included from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/configs/platform-top.h:2,
|                  from include/config.h:5,
|                  from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/common.h:17,
|                  from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/lib/asm-offsets.c:14:
| /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/configs/platform-auto.h:151:2: error: expected identifier or '(' before string constant
|   "bootenv=uEnv.txt| In file included from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/configs/platform-top.h:2,
|                  from include/config.h:5,
|                  from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/common.h:17,
|                  from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/lib/asm-offsets.c:14:
| /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/configs/platform-auto.h:151:2: error: expected identifier or '(' before string constant
|   "bootenv=uEnv.txt\0" \
|   ^~~~~~~~~~~~~~~~~~~~
| make[2]: *** [/home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/./Kbuild:44: lib/asm-offsets.s] Error 1
| make[1]: *** [/home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/Makefile:1579: prepare0] Error 2
| make[1]: *** Waiting for unfinished jobs....
">
| In file included from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/configs/platform-top.h:2,
|                  from include/config.h:5,
|                  from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/common.h:17,
|                  from /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/lib/asm-offsets.c:14:
| /home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/include/configs/platform-auto.h:151:2: error: expected identifier or '(' before string constant
|   "bootenv=uEnv.txt\0" \
|   ^~~~~~~~~~~~~~~~~~~~
| make[2]: *** [/home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/./Kbuild:44: lib/asm-offsets.s] Error 1
| make[1]: *** [/home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/Makefile:1579: prepare0] Error 2
| make[1]: *** Waiting for unfinished jobs....
" \ | ^~~~~~~~~~~~~~~~~~~~ | make[2]: *** [/home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/./Kbuild:44: lib/asm-offsets.s] Error 1 | make[1]: *** [/home/developer/project/zynq-v2019.1/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/u-boot-xlnx/v2019.01-xilinx-v2019.1+gitAUTOINC+d895ac5e94-r0/git/Makefile:1579: prepare0] Error 2 | make[1]: *** Waiting for unfinished jobs....

发现是151行有一个空行,删掉即可,

#define CONFIG_EXTRA_ENV_SETTINGS \ SERIAL_MULTI \ 
	CONSOLE_ARG \ 
	DFU_ALT_INFO_RAM \ 
	DFU_ALT_INFO_MMC \ 
	PSSERIAL0 \ 
	"nc=setenv stdout nc;setenv stdin nc;
#define CONFIG_EXTRA_ENV_SETTINGS \ SERIAL_MULTI \ 
CONSOLE_ARG \ 
DFU_ALT_INFO_RAM \ 
DFU_ALT_INFO_MMC \ 
PSSERIAL0 \ 
"nc=setenv stdout nc;setenv stdin nc;\0" \ 
"bootenv=uEnv.txt\0" \ 
"
\ "bootenv=uEnv.txt
#define CONFIG_EXTRA_ENV_SETTINGS \ SERIAL_MULTI \ 
CONSOLE_ARG \ 
DFU_ALT_INFO_RAM \ 
DFU_ALT_INFO_MMC \ 
PSSERIAL0 \ 
"nc=setenv stdout nc;setenv stdin nc;\0" \ 
"bootenv=uEnv.txt\0" \ 
"
\

ERROR: Failed to source bitbake

$ cat build/build.log
FileExistsError: [Errno 17] File exists: '/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/flock' -> '/home/qe/project/petalinux/zynqmp_vcu/build/tmp/hosttools/flock'
# 由于工程copy到另一台电脑,删掉该路径下所有错误的link
qe@ubuntu:~/project/petalinux/zynqmp_vcu$ ls -l /home/qe/project/petalinux/zynqmp_vcu/build/tmp/hosttools
total 44
...
lrwxrwxrwx 1 qe qe 128 Sep 15 15:12 find -> /home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/find
lrwxrwxrwx 1 qe qe 117 Jul 27 10:07 flock -> /opt/Xilinx/Petalinux/2019.1/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/flock
...

Failed to open PetaLinux lib: librdi_commonxillic.so: cannot open shared object file

安装错误,重新安装,安装路径需要先设置写权限。

ERROR: Execution of event handler ‘check_sanity_eventhandler’ failed

执行petalinux-build -x mrproper后就无法编译,原因是我执行了source /home/qe/project/petalinux/zynqmp_vcu/sdk/environment-setup-aarch64-xilinx-linux

$ petalinux-build 
[INFO] building project
[INFO] sourcing bitbake
[INFO] generating user layers
INFO: bitbake petalinux-user-image
ERROR: Execution of event handler 'check_sanity_eventhandler' failed
Traceback (most recent call last):
  File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 979, in check_sanity_eventhandler(e=<bb.event.SanityCheck object at 0x7feab5508470>):
             sanity_data = copy_data(e)
    >        check_sanity(sanity_data)
             if e.generateevents:
  File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 943, in check_sanity(sanity_data=<bb.data_smart.DataSmart object at 0x7feab4b960b8>):
         if last_sanity_version < sanity_version or last_nativelsbstr != nativelsbstr: 
    >        check_sanity_version_change(status, sanity_data)
             status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
  File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 637, in check_sanity_version_change(status=<SanityStatus object at 0x7feab4adcfd0>, d=<bb.data_smart.DataSmart object at 0x7feab4b960b8>):
         status.addresult(check_git_version(d))
    >    status.addresult(check_perl_modules(d))
         status.addresult(check_wsl(d))
  File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 563, in check_perl_modules(sanity_data=<bb.data_smart.DataSmart object at 0x7feab4b960b8>):
             except subprocess.CalledProcessError as e:
    >            errresult += e.output
                 ret += "%s " % m
TypeError: Can't convert 'bytes' object to str implicitly ERROR: Command execution failed: Traceback (most recent call last): File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 561, in check_perl_modules subprocess.check_output(["perl", "-e", "use %s" % m]) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.5/subprocess.py", line 316, in check_output **kwargs).stdout File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.5/subprocess.py", line 398, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['perl', '-e', 'use Text::ParseWords']' returned non-zero exit status 2 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/command.py", line 113, in runAsyncCommand self.cooker.updateCache() File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/cooker.py", line 1527, in updateCache bb.event.fire(bb.event.SanityCheck(False), self.databuilder.mcdata[mc]) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/event.py", line 225, in fire fire_class_handlers(event, d) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/event.py", line 134, in fire_class_handlers execute_handler(name, handler, event, d) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/bitbake/lib/bb/event.py", line 106, in execute_handler ret = handler(event) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 979, in check_sanity_eventhandler check_sanity(sanity_data) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 943, in check_sanity check_sanity_version_change(status, sanity_data) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 637, in check_sanity_version_change status.addresult(check_perl_modules(d)) File "/home/qe/program/petalinux-v2019.1-final/components/yocto/source/aarch64/layers/core/meta/classes/sanity.bbclass", line 563, in check_perl_modules errresult += e.output TypeError: Can't convert 'bytes' object to str implicitly


Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
ERROR: Failed to build project

ERROR: ParseError

SRC_URI_append 多了一个空行引起的,

ERROR: ParseError at /home/qe/project/petalinux/zynqmp_vcu/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend:20: unparsed line: 'SRC_URI_append = " file://0001-media-xilinx-TPG-Add-IOCTL-to-set-PPC.patch | ETA: --:--:-file://0002-Add-2nd-HDMI-support-by-adding-a-dummy-driver.patch file://0003-drm-xlnx_mixer-Dont-enable-primary-plane-by-default.patch file://0004-drm_atomic_helper-Supress-vblank-timeout-warning-mes.patch file://0006-drivers-misc-add-support-for-interrupt-based-PCIe-en.patch file://0006-add-xilinx-aurora-drm-and-aurora-eth.patch '
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

SRC_URI_append = " \ file://0001-media-xilinx-TPG-Add-IOCTL-to-set-PPC.patch \ file://0002-Add-2nd-HDMI-support-by-adding-a-dummy-driver.patch \ file://0003-drm-xlnx_mixer-Dont-enable-primary-plane-by-default.patch \ file://0004-drm_atomic_helper-Supress-vblank-timeout-warning-mes.patch \ file://0005-drivers-misc-add-support-for-interrupt-based-PCIe-en.patch \ file://0006-add-xilinx-aurora-drm-and-aurora-eth.patch \ "
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/194646.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号