Hi all,
I played today a bit with dt-schema[0] which allows to validate
device-tree schema files via something called json-schema[1], a schema
description written in, *drums*, yaml. Ideally vendors specify their
hardware in the Kernel[2] and dt-schema validates each .dts file added
to OpenWrt. The output for the TP-Link 4300 v1 looks currently like the
following:
user@dawn:~/src/openwrt/openwrt$ dt-validate -n -s
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-5.4.51/Documentation/devicetree/bindings/processed-schema.yaml
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:266:15:
ahb: pcie-controller@180c0000:ranges: [[33554432, 0, 268435456,
268435456, 0, 67108864, 16777216, 0, 0, 0, 0, 1]] is not valid under any
of the given schemas (Possible causes of the failure):
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:266:15:
ahb: pcie-controller@180c0000:ranges: [[33554432, 0, 268435456,
268435456, 0, 67108864, 16777216, 0, 0, 0, 0, 1]] is not of type 'boolean'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:266:16:
ahb: pcie-controller@180c0000:ranges:0: [33554432, 0, 268435456,
268435456, 0, 67108864, 16777216, 0, 0, 0, 0, 1] is too long
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:
uart@18020000: $nodename:0: 'uart@18020000' does not match
'^serial(@[0-9a-f,]+)*$'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:60:9:
pinmux@1804002c: '#address-cells' is a dependency of '#size-cells'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:
uart@18500000: $nodename:0: 'uart@18500000' does not match
'^serial(@[0-9a-f,]+)*$'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:
eth@19000000: $nodename:0: 'eth@19000000' does not match '^ethernet(@.*)?$'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:109:19:
eth@19000000: compatible: ['qca,ar9340-eth', 'syscon'] is not valid
under any of the given schemas (Possible causes of the failure):
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:109:19:
eth@19000000: compatible: ['qca,ar9340-eth', 'syscon'] is too long
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:
eth@1a000000: $nodename:0: 'eth@1a000000' does not match '^ethernet(@.*)?$'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:140:19:
eth@1a000000: compatible: ['qca,ar9340-eth', 'syscon'] is not valid
under any of the given schemas (Possible causes of the failure):
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:140:19:
eth@1a000000: compatible: ['qca,ar9340-eth', 'syscon'] is too long
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:193:7:
usb@1b000000: '#address-cells', '#size-cells', 'caps-offset', 'port@1',
'reset-names' do not match any of the regexes: 'pinctrl-[0-9]+'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:200:19:
usb@1b000000: phy-names:0: 'usb' was expected
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:193:7:
usb@1b000000: '#address-cells', '#size-cells', 'caps-offset', 'port@1',
'reset-names' do not match any of the regexes: 'pinctrl-[0-9]+'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:200:19:
usb@1b000000: phy-names:0: 'usb' was expected
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:320:5:
leds: 'qss', 'system', 'usb1', 'usb2', 'wlan2g' do not match any of the
regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:343:5:
ath9k-leds: 'wlan5g' does not match any of the regexes:
'(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+'
/home/user/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/image-ar9344_tplink_tl-wdr4300-v1.dtb.yaml:362:7:
gpio_usb1_power: 'gpio-export,name', 'gpio-export,output' do not match
any of the regexes: '^#.*',
'^(at25|devbus|dmacap|dsa|exynos|gpio-fan|gpio|gpmc|hdmi|i2c-gpio),.*',
'^(keypad|m25p|max8952|max8997|max8998|mpmc),.*',
'^(pinctrl-single|#pinctrl-single|PowerPC),.*',
'^(pl022|pxa-mmc|rcar_sound|rotary-encoder|s5m8767|sdhci),.*',
'^(simple-audio-card|simple-graph-card|st-plgpio|st-spics|ts),.*',
'^GEFanuc,.*', '^ORCL,.*', '^SUNW,.*',
'^[a-zA-Z0-9#_][a-zA-Z0-9+\\-._@]{0,63}$',
'^[a-zA-Z0-9+\\-._]*@[0-9a-zA-Z,]*$', '^abilis,.*', '^abracon,.*',
'^acme,.*', '^actions,.*', '^active-semi,.*', '^ad,.*', '^adafruit,.*',
'^adapteva,.*', '^adaptrum,.*', '^adh,.*', '^adi,.*', '^advantech,.*',
'^aeroflexgaisler,.*', '^al,.*', '^allegro,.*', '^allo,.*',
'^allwinner,.*', '^alphascale,.*', '^altr,.*', '^amarula,.*',
'^amazon,.*', '^amcc,.*', '^amd,.*', '^amediatech,.*', '^amlogic,.*',
'^ampire,.*', '^ams,.*', '^amstaos,.*', '^analogix,.*', '^andestech,.*',
'^anvo,.*', '^apm,.*', '^aptina,.*', '^arasan,.*', '^archermind,.*',
'^arctic,.*', '^arcx,.*', '^aries,.*', '^arm,.*', '^armadeus,.*',
'^arrow,.*', '^artesyn,.*', '^asahi-kasei,.*', '^aspeed,.*', '^asus,.*',
'^atlas,.*', '^atmel,.*', '^auo,.*', '^auvidea,.*', '^avago,.*',
'^avia,.*', '^avic,.*', '^avnet,.*', '^axentia,.*', '^axis,.*',
'^azoteq,.*', '^azw,.*', '^bananapi,.*', '^bhf,.*', '^bitmain,.*',
'^boe,.*', '^bosch,.*', '^boundary,.*', '^brcm,.*', '^bticino,.*',
'^buffalo,.*', '^bur,.*', '^calxeda,.*', '^capella,.*', '^cascoda,.*',
'^catalyst,.*', '^cavium,.*', '^cdns,.*', '^cdtech,.*', '^ceva,.*',
'^chipidea,.*', '^chipone,.*', '^chipspark,.*', '^chrp,.*',
'^chunghwa,.*', '^chuwi,.*', '^ciaa,.*', '^cirrus,.*',
'^cloudengines,.*', '^cnm,.*', '^cnxt,.*', '^colorfly,.*',
'^compulab,.*', '^corpro,.*', '^cortina,.*', '^cosmic,.*', '^crane,.*',
'^creative,.*', '^crystalfontz,.*', '^csky,.*', '^csq,.*',
'^cubietech,.*', '^cypress,.*', '^cznic,.*', '^dallas,.*',
'^dataimage,.*', '^davicom,.*', '^delta,.*', '^denx,.*',
'^devantech,.*', '^dh,.*', '^difrnce,.*', '^digi,.*', '^digilent,.*',
'^dioo,.*', '^dlc,.*', '^dlg,.*', '^dlink,.*', '^dmo,.*',
'^domintech,.*', '^dongwoon,.*', '^dptechnics,.*', '^dragino,.*',
'^dserve,.*', '^ea,.*', '^ebs-systart,.*', '^ebv,.*', '^eckelmann,.*',
'^edt,.*', '^eeti,.*', '^einfochips,.*', '^elan,.*', '^elgin,.*',
'^embest,.*', '^emlid,.*', '^emmicro,.*', '^empire-electronix,.*',
'^emtrion,.*', '^endless,.*', '^energymicro,.*', '^engicam,.*',
'^epcos,.*', '^epfl,.*', '^epson,.*', '^esp,.*', '^est,.*', '^ettus,.*',
'^eukrea,.*', '^everest,.*', '^everspin,.*', '^evervision,.*',
'^exar,.*', '^excito,.*', '^ezchip,.*', '^facebook,.*', '^fairphone,.*',
'^faraday,.*', '^fastrax,.*', '^fcs,.*', '^feiyang,.*', '^firefly,.*',
'^focaltech,.*', '^friendlyarm,.*', '^fsl,.*', '^fujitsu,.*',
'^gateworks,.*', '^gcw,.*', '^ge,.*', '^geekbuying,.*', '^gef,.*',
'^gemei,.*', '^geniatech,.*', '^giantec,.*', '^giantplus,.*',
'^globalscale,.*', '^globaltop,.*', '^gmt,.*', '^goodix,.*',
'^google,.*', '^grinn,.*', '^grmn,.*', '^gumstix,.*', '^gw,.*',
'^hannstar,.*', '^haoyu,.*', '^hardkernel,.*', '^hideep,.*',
'^himax,.*', '^hisilicon,.*', '^hit,.*', '^hitex,.*', '^holt,.*',
'^holtek,.*', '^honeywell,.*', '^hoperun,.*', '^hp,.*', '^hsg,.*',
'^hugsun,.*', '^hwacom,.*', '^hyundai,.*', '^i2se,.*', '^ibm,.*',
'^icplus,.*', '^idt,.*', '^ifi,.*', '^ilitek,.*', '^img,.*',
'^incircuit,.*', '^inet-tek,.*', '^infineon,.*', '^inforce,.*',
'^ingenic,.*', '^innolux,.*', '^inside-secure,.*', '^inspur,.*',
'^intel,.*', '^intercontrol,.*', '^invensense,.*', '^inversepath,.*',
'^iom,.*', '^isee,.*', '^isil,.*', '^issi,.*', '^itead,.*', '^iwave,.*',
'^jdi,.*', '^jedec,.*', '^jesurun,.*', '^jianda,.*', '^karo,.*',
'^keithkoep,.*', '^keymile,.*', '^khadas,.*', '^kiebackpeter,.*',
'^kinetic,.*', '^kingdisplay,.*', '^kingnovel,.*', '^kionix,.*',
'^kobo,.*', '^koe,.*', '^kontron,.*', '^kosagi,.*', '^kyo,.*',
'^lacie,.*', '^laird,.*', '^lamobo,.*', '^lantiq,.*', '^lattice,.*',
'^leez,.*', '^lego,.*', '^lemaker,.*', '^lenovo,.*', '^lg,.*',
'^lgphilips,.*', '^libretech,.*', '^licheepi,.*', '^linaro,.*',
'^linksprite,.*', '^linksys,.*', '^linux,.*', '^linx,.*', '^lltc,.*',
'^logicpd,.*', '^longcheer,.*', '^lsi,.*', '^lwn,.*', '^macnica,.*',
'^mapleboard,.*', '^marvell,.*', '^maxbotix,.*', '^maxim,.*',
'^mbvl,.*', '^mcube,.*', '^meas,.*', '^mecer,.*', '^mediatek,.*',
'^megachips,.*', '^mele,.*', '^melexis,.*', '^melfas,.*',
'^mellanox,.*', '^memsic,.*', '^menlo,.*', '^merrii,.*', '^micrel,.*',
'^microchip,.*', '^microcrystal,.*', '^micron,.*', '^microsoft,.*',
'^mikroe,.*', '^miniand,.*', '^minix,.*', '^miramems,.*',
'^mitsubishi,.*', '^mosaixtech,.*', '^motorola,.*', '^moxa,.*',
'^mpl,.*', '^mqmaker,.*', '^mscc,.*', '^msi,.*', '^mti,.*',
'^multi-inno,.*', '^mundoreader,.*', '^murata,.*', '^mxicy,.*',
'^myir,.*', '^national,.*', '^nec,.*', '^neonode,.*', '^netgear,.*',
'^netlogic,.*', '^netron-dy,.*', '^netxeon,.*', '^newhaven,.*',
'^nexbox,.*', '^nextthing,.*', '^ni,.*', '^nintendo,.*', '^nlt,.*',
'^nokia,.*', '^nordic,.*', '^novtech,.*', '^nutsboard,.*',
'^nuvoton,.*', '^nvd,.*', '^nvidia,.*', '^nxp,.*', '^oceanic,.*',
'^okaya,.*', '^oki,.*', '^olimex,.*', '^olpc,.*', '^onion,.*',
'^onnn,.*', '^ontat,.*', '^opalkelly,.*', '^opencores,.*',
'^openrisc,.*', '^option,.*', '^oranth,.*', '^orisetech,.*',
'^ortustech,.*', '^osddisplays,.*', '^ovti,.*', '^oxsemi,.*',
'^panasonic,.*', '^parade,.*', '^pda,.*', '^pericom,.*',
'^pervasive,.*', '^phicomm,.*', '^phytec,.*', '^picochip,.*',
'^pine64,.*', '^pineriver,.*', '^pixcir,.*', '^plantower,.*',
'^plathome,.*', '^plda,.*', '^plx,.*', '^pni,.*', '^polaroid,.*',
'^portwell,.*', '^poslab,.*', '^pov,.*', '^powervr,.*', '^primux,.*',
'^probox2,.*', '^pulsedlight,.*', '^purism,.*', '^qca,.*', '^qcom,.*',
'^qemu,.*', '^qi,.*', '^qiaodian,.*', '^qihua,.*', '^qnap,.*',
'^radxa,.*', '^raidsonic,.*', '^ralink,.*', '^ramtron,.*',
'^raspberrypi,.*', '^raydium,.*', '^rda,.*', '^realtek,.*',
'^renesas,.*', '^rervision,.*', '^richtek,.*', '^ricoh,.*',
'^rikomagic,.*', '^riscv,.*', '^rockchip,.*', '^rocktech,.*',
'^rohm,.*', '^ronbo,.*', '^roofull,.*', '^samsung,.*', '^samtec,.*',
'^sancloud,.*', '^sandisk,.*', '^sbs,.*', '^schindler,.*',
'^seagate,.*', '^seirobotics,.*', '^semtech,.*', '^sensirion,.*',
'^sensortek,.*', '^sff,.*', '^sgd,.*', '^sgx,.*', '^sharp,.*',
'^shimafuji,.*', '^si-en,.*', '^si-linux,.*', '^sifive,.*', '^sigma,.*',
'^sii,.*', '^sil,.*', '^silabs,.*', '^silead,.*', '^silergy,.*',
'^siliconmitus,.*', '^simtek,.*', '^sinlinx,.*', '^sinovoip,.*',
'^sipeed,.*', '^sirf,.*', '^sis,.*', '^sitronix,.*', '^skyworks,.*',
'^smsc,.*', '^snps,.*', '^sochip,.*', '^socionext,.*', '^solidrun,.*',
'^solomon,.*', '^sony,.*', '^spansion,.*', '^sprd,.*', '^sst,.*',
'^st,.*', '^starry,.*', '^startek,.*', '^ste,.*', '^stericsson,.*',
'^summit,.*', '^sunchip,.*', '^swir,.*', '^syna,.*', '^synology,.*',
'^tbs,.*', '^tbs-biometrics,.*', '^tcg,.*', '^tcl,.*', '^technexion,.*',
'^technologic,.*', '^techstar,.*', '^tempo,.*', '^terasic,.*',
'^tfc,.*', '^thine,.*', '^ti,.*', '^tianma,.*', '^tlm,.*', '^tmt,.*',
'^topeet,.*', '^toppoly,.*', '^toradex,.*', '^toshiba,.*', '^toumaz,.*',
'^tpk,.*', '^tplink,.*', '^tpo,.*', '^tq,.*', '^tronfy,.*',
'^tronsmart,.*', '^truly,.*', '^tsd,.*', '^tyan,.*', '^u-blox,.*',
'^ubnt,.*', '^ucrobotics,.*', '^udoo,.*', '^uniwest,.*', '^upisemi,.*',
'^urt,.*', '^usi,.*', '^utoo,.*', '^v3,.*', '^vamrs,.*',
'^variscite,.*', '^via,.*', '^virtio,.*', '^vishay,.*', '^vitesse,.*',
'^vivante,.*', '^vocore,.*', '^voipac,.*', '^vot,.*', '^vxt,.*',
'^wd,.*', '^wetek,.*', '^wexler,.*', '^whwave,.*', '^wi2wi,.*',
'^winbond,.*', '^winstar,.*', '^wits,.*', '^wlf,.*', '^wm,.*',
'^wobo,.*', '^x-powers,.*', '^xes,.*', '^xillybus,.*', '^xlnx,.*',
'^xunlong,.*', '^yones-toptech,.*', '^ysoft,.*', '^zarlink,.*',
'^zeitec,.*', '^zidoo,.*', '^zii,.*', '^zte,.*', '^zyxel,.*'
[...]
The workflow is not super trivial but easily to cover by a CI:
* OpenWrt buildroot creates the .dtb files.
* `dtc` (device-tree-compiler) with YAML support (compiled with libyaml)
converts the .dtb file to YAML.
* `dt-mk-schema` (part of dt-schema) compiles all bindings of the Kernel
to a single file.
* `dt-validate` (part of dt-schema) then validates the file and prints a
message similar to the one abve.
Ideally we have a CI which detects modified .dts files and validates
them and complains at the submitter if anything is wrong. The question
is if people (you) can actually make sense out of those information and
may are willing to add additional validation schemas for new devices?
I'm happy to setup the CI part, but as this is my first day touching
device-tree I'm not (yet) much of help at understanding or solving such
warning.
Best,
Paul
[0]: https://github.com/robherring/dt-schema
[1]: https://json-schema.org/specification.html
[2]:
https://github.com/torvalds/linux/tree/master/Documentation/devicetree/bindings
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel