设备树编译器无法识别包含文件的 C 语法
Device tree compiler not recognizes C syntax for include files
我想手动编译我的开发板设备树。我已经从其官方 source 下载了最新版本的 dtc
,但是当我尝试 运行 以下命令时,出现错误,建议我更改所有 #include
指令到 /include/
等等 #define
等等
dtc -I dts -O dtb -p 0x1000 meson-gxl-s905x-khadas-vim.dts -o kvim1.dtb
我的开发板是 Khadas Vim,其核心是 amlogic S905x SoC。所有包含文件都存在,错误是:
Error: meson-gxl-s905x-khadas-vim.dts:8.1-9 syntax error
FATAL ERROR: Unable to parse input tree
第8行是:
#include <dt-bindings/input/input.h>
将 #include
更改为 /include/
将抑制错误!
如果你知道一些设备树的参考资料'language'(U-boot文档除外),请介绍一下。
这不是设备树语法问题,您只需使用 C 预处理器 cpp 预处理 .dts 文件,以获得设备树编译器可以原样消化的文件。
在您的特定情况下,假设您的当前目录是内核根目录,您将不得不使用以下两个命令:
cpp -nostdinc -I include -I arch -undef -x assembler-with-cpp arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts meson-gxl-s905x-khadas-vim.dts.preprocessed
dtc -I dts -O dtb -p 0x1000 meson-gxl-s905x-khadas-vim.dts.preprocessed -o kvim1.dtb
kvim1.dtb: Warning (unit_address_vs_reg): Node /scpi/clocks/scpi_clocks@0 has a unit name, but no reg property
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/bus@c8100000/pinctrl@14 has a unit name, but no reg property
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/periphs@c8834000/rng has a reg or ranges property, but no unit name
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/periphs@c8834000/pinctrl@4b0 has a unit name, but no reg property
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/periphs@c8834000/eth-phy-mux has a reg or ranges property, but no unit name
kvim1.dtb: Warning (unit_address_vs_reg): Node /gpio-keys-polled/button@0 has a unit name, but no reg property
kvim1.dtb: Warning (simple_bus_reg): Node /soc/bus@c8100000/pinctrl@14 missing or empty reg/ranges property
kvim1.dtb: Warning (simple_bus_reg): Node /soc/periphs@c8834000/rng simple-bus unit address format error, expected "0"
kvim1.dtb: Warning (simple_bus_reg): Node /soc/periphs@c8834000/pinctrl@4b0 missing or empty reg/ranges property
kvim1.dtb: Warning (simple_bus_reg): Node /soc/periphs@c8834000/eth-phy-mux simple-bus unit address format error, expected "55c"
正在验证 kvim1.dtb 已构建:
ls -ail kvim1.tdb
4359446 -rw-rw-r-- 1 user user 27568 Jun 2 12:05 kvim1.dtb
官方的Device Tree规范,请参考其official web site and its git repository。
我想手动编译我的开发板设备树。我已经从其官方 source 下载了最新版本的 dtc
,但是当我尝试 运行 以下命令时,出现错误,建议我更改所有 #include
指令到 /include/
等等 #define
等等
dtc -I dts -O dtb -p 0x1000 meson-gxl-s905x-khadas-vim.dts -o kvim1.dtb
我的开发板是 Khadas Vim,其核心是 amlogic S905x SoC。所有包含文件都存在,错误是:
Error: meson-gxl-s905x-khadas-vim.dts:8.1-9 syntax error
FATAL ERROR: Unable to parse input tree
第8行是:
#include <dt-bindings/input/input.h>
将 #include
更改为 /include/
将抑制错误!
如果你知道一些设备树的参考资料'language'(U-boot文档除外),请介绍一下。
这不是设备树语法问题,您只需使用 C 预处理器 cpp 预处理 .dts 文件,以获得设备树编译器可以原样消化的文件。
在您的特定情况下,假设您的当前目录是内核根目录,您将不得不使用以下两个命令:
cpp -nostdinc -I include -I arch -undef -x assembler-with-cpp arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts meson-gxl-s905x-khadas-vim.dts.preprocessed
dtc -I dts -O dtb -p 0x1000 meson-gxl-s905x-khadas-vim.dts.preprocessed -o kvim1.dtb
kvim1.dtb: Warning (unit_address_vs_reg): Node /scpi/clocks/scpi_clocks@0 has a unit name, but no reg property
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/bus@c8100000/pinctrl@14 has a unit name, but no reg property
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/periphs@c8834000/rng has a reg or ranges property, but no unit name
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/periphs@c8834000/pinctrl@4b0 has a unit name, but no reg property
kvim1.dtb: Warning (unit_address_vs_reg): Node /soc/periphs@c8834000/eth-phy-mux has a reg or ranges property, but no unit name
kvim1.dtb: Warning (unit_address_vs_reg): Node /gpio-keys-polled/button@0 has a unit name, but no reg property
kvim1.dtb: Warning (simple_bus_reg): Node /soc/bus@c8100000/pinctrl@14 missing or empty reg/ranges property
kvim1.dtb: Warning (simple_bus_reg): Node /soc/periphs@c8834000/rng simple-bus unit address format error, expected "0"
kvim1.dtb: Warning (simple_bus_reg): Node /soc/periphs@c8834000/pinctrl@4b0 missing or empty reg/ranges property
kvim1.dtb: Warning (simple_bus_reg): Node /soc/periphs@c8834000/eth-phy-mux simple-bus unit address format error, expected "55c"
正在验证 kvim1.dtb 已构建:
ls -ail kvim1.tdb
4359446 -rw-rw-r-- 1 user user 27568 Jun 2 12:05 kvim1.dtb
官方的Device Tree规范,请参考其official web site and its git repository。