superna9999 / pyfdt

Python Flattened Device Tree Parser
Apache License 2.0
43 stars 18 forks source link

pinmux support - Invalid value for boardId #13

Open adjivas opened 6 years ago

adjivas commented 6 years ago

Hello @superna9999 !

Is it possible with jsonfdtdump.py to compile a manifest file from pinmux to a device tree?

My input JSON file AM335xMichel.pinmux produces this output error:

$ jsonfdtdump.py AM355xMichel.pinmux AM355xMichel.dtb
Traceback (most recent call last):
  File "/usr/bin/jsonfdtdump.py", line 4, in <module>
    __import__('pkg_resources').run_script('pyfdt==0.3', 'jsonfdtdump.py')
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 654, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1441, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python3.6/site-packages/pyfdt-0.3-py3.6.egg/EGG-INFO/scripts/jsonfdtdump.py", line 25, in <module>
  File "/usr/lib/python3.6/site-packages/pyfdt-0.3-py3.6.egg/pyfdt/pyfdt.py", line 856, in FdtJsonParse
  File "/usr/lib/python3.6/site-packages/pyfdt-0.3-py3.6.egg/pyfdt/pyfdt.py", line 845, in _add_json_to_fdtnode
Exception: Invalid value for boardId

boardId is defined at line L2:

"boardId": "undefined",
superna9999 commented 6 years ago

Hi,

Yes, the JSON format I proposed is specific because JSON does not enforce types, here is the format:

{
    "compatible": ["strings", "my,model"],
    "memory": {
        "device_type": ["strings", "memory"],
        "reg": ["words", "0x00000000", "0x00000000"],
        "cfg": ["bytes", "12", "23", "-64"]
    },
    "chosen" : {
        "cmdline": ["strings", "debug=on"]
    }
}

Maybe I missed something while implementing, but if another more format DT JSON format exist, I'll be happy to implement the parsing !