AR# 76822

|

2021.1 and later PetaLinux: Device-tree fails to build when nodes are modified using custom meta layer

描述

In the 2021.1 and later PetaLinux releases, the Device-tree fails to build when DT nodes are modified using the custom meta layer shown below.

1) Add a custom layer by following UG1144.


2) In the example below, meta-avnet is the custom meta layer. If you are modifying DT node properties for QSPI flash nodes in <plnx-proj-root>/project-spec/meta-avnet/recipes-bsp/device-tree/files/mz7010-som/system-bsp.dtsi as shown below, the device-tree fails to build.

$ cat <plnx-proj-root>/project-spec/meta-avnet/recipes-bsp/device-tree/files/mz7010-som/system-bsp.dtsi 
/ {
};

/* QSPI partitions are defined with petalinux-config and described in system.conf.dtsi */
&flash0 {
compatible = "n25q128a11","jedc,spi-nor";
reg = <0x0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
};
$ petalinux-build
[INFO] Sourcing buildtools
[INFO] Building project
[INFO] Sourcing build environment
[INFO] Generating workspace directory
INFO: bitbake petalinux-image-minimal
NOTE: Started PRServer with DBfile: /group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 35603, PID: 52004
Loading cache: 100% | | ETA: --:--:--
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |##################################################################################################################################################################################################| Time: 0:00:18
Parsing of 3503 .bb files complete (0 cached, 3503 parsed). 5138 targets, 269 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Fetching uninative binary shim file:///group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/components/yocto/downloads/uninative/5ec5a9276046e7eceeac749a18b175667384e1f445cd4526300a41404d985a5b/x86_64-nativesdk-libc.tar.xz;sha256sum=5ec5a9276046e7eceeac749a18b175667384e1f445cd4526300a41404d985a5b (will check PREMIRRORS first)
Initialising tasks: 100% |###############################################################################################################################################################################################| Time: 0:00:05
Checking sstate mirror object availability: 100% |#######################################################################################################################################################################| Time: 0:00:12
Sstate summary: Wanted 1242 Found 996 Missed 246 Current 0 (80% match, 0% complete)
NOTE: Executing Tasks
ERROR: device-tree-xilinx-v2021.1+gitAUTOINC+252758eb1f-r0 do_compile: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:devicetree_do_compile(d)
0003:
File: '/group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/components/yocto/layers/core/meta/classes/devicetree.bbclass', lineno: 131, function: devicetree_do_compile
0127: if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)):
0128: continue # skip non-.dts files and non-overlay files
0129: except:
0130: continue # skip if can't determine if overlay
*** 0131: devicetree_compile(dtspath, includes, d)
0132:}
0133:
0134:devicetree_do_install() {
0135: for DTB_FILE in `ls *.dtb *.dtbo`; do
File: '/group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/components/yocto/layers/core/meta/classes/devicetree.bbclass', lineno: 119, function: devicetree_compile
0115: dtcargs += ["-i", i]
0116: dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")]
0117: dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)]
0118: bb.note("Running {0}".format(" ".join(dtcargs)))
*** 0119: subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
0120:
0121:python devicetree_do_compile() {
0122: includes = expand_includes("DT_INCLUDE", d)
0123: listpath = d.getVar("DT_FILES_PATH")
File: '/proj/gsd/petalinux/2021.1/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.8/subprocess.py', lineno: 512, function: run
0508: # We don't call process.wait() as .__exit__ does that for us.
0509: raise
0510: retcode = process.poll()
0511: if check and retcode:
*** 0512: raise CalledProcessError(retcode, process.args,
0513: output=stdout, stderr=stderr)
0514: return CompletedProcess(process.args, retcode, stdout, stderr)
0515:
0516:
Exception: subprocess.CalledProcessError: Command '['dtc', '-@', '-p', '0x1000', '-@', '-i', '/tmp/sandeepg/plnx/2021.1/avnet-microzed/work-shared/mz7010-som/kernel-source/scripts/dtc/include-prefixes', '-i', '/tmp/sandeepg/plnx/2021.1/avnet-microzed/work/mz7010_som-xilinx-linux-gnueabi/device-tree/xilinx-v2021.1+gitAUTOINC+252758eb1f-r0', '-i', '/tmp/sandeepg/plnx/2021.1/avnet-microzed/work-shared/mz7010-som/kernel-source/arch/arm/boot/dts', '-i', '/group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree', '-o', 'system-top.dtb', '-I', 'dts', '-O', 'dtb', 'system-top.dts.pp']' returned non-zero exit status 1.

Subprocess output:
Error: /group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree/system-bsp.dtsi:56.1-8 Label or path flash0 not found
FATAL ERROR: Syntax error parsing input tree

ERROR: Logfile of failure stored in: /tmp/sandeepg/plnx/2021.1/avnet-microzed/work/mz7010_som-xilinx-linux-gnueabi/device-tree/xilinx-v2021.1+gitAUTOINC+252758eb1f-r0/temp/log.do_compile.39383
ERROR: Task (/group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/components/yocto/layers/meta-xilinx/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3577 tasks of which 2758 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
/group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/components/yocto/layers/meta-xilinx/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bb:do_compile
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
ERROR: Failed to build project. Check the /group/bcapps/sandeepg/plnx-workspace/2021.1/avnet-microzed/build/build.log file for more details...
$

解决方案

This is a known issue in the 2021.1 and later versions of PetaLinux.

Root Cause:

Due to changes in the 2021.1 and later versions of PetaLinux, The priority of the meta-user layer is moved from 6 to 7, so the meta-avnet BBFILE having a priority of 5 causes device-tree build errors.

The system-bsp.dtsi from the meta-avnet layer will be appended in system-top.dts first and then the system-user.dtsi from the meta-user layer as shown below:

/dts-v1/;
#include "zynq-7000.dtsi"
#include "pl.dtsi"
#include "pcw.dtsi"
/ {
chosen {
bootargs = "earlycon";
stdout-path = "serial0:115200n8";
};
aliases {
ethernet0 = &gem0;
serial0 = &uart1;
spi0 = &qspi;
};
memory {
device_type = "memory";
reg = <0x0 0x40000000>;
};
};
#include "system-bsp.dtsi"
#include "system-user.dtsi"

This is due to the Yocto device-tree recipe do_configure bitbake task in the meta-avnet layer being executed before the meta-user layer.

The flash dt nodes are  generated by the PetaLinux tools (system-conf.dtsi) based on the petalinux-config QSPI partition options. This system-conf.dtsi will be included from system-user.dtsi.

In the above scenario if you have any flash dt node properties in system-bsp.dtsi from meta-avnet, it causes build conflicts with system-conf.dtsi due to the order in which it is processed.

As a result, it is recommended to set meta-avnet or any custom meta-layer to have the same or lower priority than the meta-user layer, especially with device-tree recipes included in meta layers.

To work around this issue, follow the below steps:

1) Change the BBFILE_PRIORITY value from 5 to 7 in meta-avent/conf/layers.conf file using a text editor:

BBFILE_PRIORITY_meta-avnet = "7"

2) Clean the device-tree sstate cache and rebuild the device-tree recipes:

$ petalinux-build -c device-tree -x cleansall
$ petalinux-build -c device-tree

链接问答记录

主要问答记录

Answer Number 问答标题 问题版本 已解决问题的版本
76526 PetaLinux 2021.1 - Product Update Release Notes and Known Issues N/A N/A
AR# 76822
日期 08/31/2021
状态 Active
Type 已知问题
器件 More Less
Tools
People Also Viewed