ltib -c and get syntax error in dts file

本文记录了一次使用LTIB编译内核时遇到的错误及其解决过程。主要问题是设备树描述文件(.dts)的格式不被当前的Device Tree Compiler(DTC)支持。通过更新DTC并转换.dts文件格式,最终成功解决了编译问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

以前能编译过的ltib,这几天编译时,试了好几遍总是遇到同样的错误无法编译过:

coolyu@coolyu-desktop:~/ltib-mpc8315erdb-20080630$: ltib -c

...

+ [ mpc8315erdb_default mpc8315erdb_1588 mpc8315erdb_otg mpc8315erdb_ulpi = %dtc_name ]
+ basename mpc8315erdb_default.dtb
+ dtc -f -b 0 -I dts -O dtb -R 8 -S 0x3000 -o /home/coolyu/ltib-mpc8315erdb-20080630/tmp/kernel//opt/freescale/rootfs/ppc/boot/mpc8315erdb_default.dtb arch/powerpc/boot/dts/mpc8315erdb_default.dts
DTC: Use of "-S" is deprecated; it will be removed soon, use "-p" instead
DTC: dts->dtb  on file "arch/powerpc/boot/dts/mpc8315erdb_default.dts"
Error: arch/powerpc/boot/dts/mpc8315erdb_default.dts 12:0 - 1:0 syntax error
FATAL ERROR: Unable to parse input tree
error: Bad exit status from /home/coolyu/ltib-mpc8315erdb-20080630/tmp/rpm-tmp.733 (%install)


RPM build errors:
    Bad exit status from /home/coolyu/ltib-mpc8315erdb-20080630/tmp/rpm-tmp.733 (%install)
Build time for kernel-2.6.24.3-mpc8315erdb: 363 seconds

Failed building kernel-2.6.24.3-mpc8315erdb


f_buildrpms() returned an error, exiting
traceback:
 main:501


Started: Sat May 28 21:53:09 2011
Ended:   Sat May 28 21:59:36 2011
Elapsed: 387 seconds

These packages failed to build:
kernel-2.6.24.3-mpc8315erdb

Build Failed

Exiting on error or interrupt
coolyu@coolyu-desktop:~/ltib-mpc8315erdb-20080630$ cd ..

Freescale提供的解决办法:

http://forums.freescale.com/t5/8-Bit-Microcontrollers/building-with-ltib-c-and-get-syntax-error-in-dts-file/td-p/59936

 

Re: building with ltib -c and get syntax error in dts file

Options

2011-02-25 01:04 PM

Ok, managed to sort this.

 

Apparently the .dts files for the mpc8313erdb are in dts-v0 format. The vrsion of the DTC (Device Tree Compiler)  I have installed does not support this format any longer.

 

To fix it I downloaded the source and built it, which includes a utility called convert-dtsv0

(下载该目录下的所有源码,编译出可执行程序convert-dtsv0,放到host-linux系统的/usr/local/bin目录下。进入mpc8313erdb.dts所在目录,执行命令:convert-dtsv0 mpc8313erdb.dts,可以看到新生成了mpc8313erdb.dtsv1,再将mpc8313erdb.dtsv1改成文件名mpc8313erdb.dts,替换掉原来的mpc8313erdb.dts文件)

>git clone http://git.jdl.com/software/dtc.git

>cd dtc

>make

 

This should build the convert-dtsv0 utiltity

 

Copy it to your /usr/local/bin directory (or wherever you think is suitable in your PATH)

 

>cd /ltib-mpc8313erdb-20081222/config/platform/mpc8313erdb/dts/

(or wherever you have the BSP installed)

 

>convert-dtsv0 mpc8313erdb.dts

>convert-dtsv0 mpc8313erdb-revc-tsec1-marvell.dts

>convert-dtsv0 mpc8313erdb-usb-internal-client.dts

 

This will produce three files of the same names, but with the extension .dtsv1

You will need to delete or rename the original files to something else (I renamed them with an extra .orig extension), then rename the .dtsv1 files to .dts

 

The build should now work. (hopefully)

ERROR: device-tree-xilinx-v2020.2+gitAUTOINC+f725aaecff-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: '/home/ljj/petalinux/csl_zynqsys_1/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: '/home/ljj/petalinux/csl_zynqsys_1/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: '/opt/pkg/petalinux/2020.2/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.7/subprocess.py', lineno: 512, function: run 0508: raise 0509: retcode = process.poll() 0510: if check and retcode: 0511: raise CalledProcessError(retcode, process.args, *** 0512: output=stdout, stderr=stderr) 0513: return CompletedProcess(process.args, retcode, stdout, stderr) 0514: 0515: 0516:def list2cmdline(seq): Exception: subprocess.CalledProcessError: Command '['dtc', '-@', '-p', '0x1000', '-i', '/home/ljj/petalinux/csl_zynqsys_1/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree', '-i', '/home/ljj/petalinux/csl_zynqsys_1/build/tmp/work-shared/zynq-generic/kernel-source/scripts/dtc/include-prefixes', '-i', '/home/ljj/petalinux/csl_zynqsys_1/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2020.2+gitAUTOINC+f725aaecff-r0', '-i', '/home/ljj/petalinux/csl_zynqsys_1/build/tmp/work-shared/zynq-generic/kernel-source/arch/arm/boot/dts', '-o', 'system-top.dtb', '-I', 'dts', '-O', 'dtb', 'system-top.dts.pp']' returned non-zero exit status 1. Subprocess output: Error: /home/ljj/petalinux/csl_zynqsys_1/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2020.2+gitAUTOINC+f725aaecff-r0/system-user.dtsi:15.1-6 syntax error FATAL ERROR: Unable to parse input tree ERROR: Logfile of failure stored in: /home/ljj/petalinux/csl_zynqsys_1/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2020.2+gitAUTOINC+f725aaecff-r0/temp/log.do_compile.22923 ERROR: Task (/home/ljj/petalinux/csl_zynqsys_1/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 4295 tasks of which 359 didn't need to be rerun and 1 failed. Summary: 1 task failed: /home/ljj/petalinux/csl_zynqsys_1/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 结合上面设备树文件的代码,分析一下为什么会报错
最新发布
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值