Bug 204043 - error building pandaboard.dtb with BSDL dtc
Summary: error building pandaboard.dtb with BSDL dtc
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: David Chisnall
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-26 18:27 UTC by Ed Maste
Modified: 2015-12-29 16:32 UTC (History)
0 users

See Also:


Attachments
pandaboard dts (34.17 KB, text/plain)
2015-10-26 18:27 UTC, Ed Maste
no flags Details
dtb file generated with gpl'd dtc (55.36 KB, application/octet-stream)
2015-10-26 18:29 UTC, Ed Maste
no flags Details
dtb from gnu dtc (55.36 KB, application/octet-stream)
2015-12-29 01:37 UTC, Ed Maste
no flags Details
dtb from bsd dtc (52.58 KB, application/octet-stream)
2015-12-29 01:38 UTC, Ed Maste
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer freebsd_triage 2015-10-26 18:27:39 UTC
Created attachment 162478 [details]
pandaboard dts

sh -c 'MACHINE=arm /scratch/tmp/emaste/freebsd/sys/tools/fdt/make_dtb.sh /scratch/tmp/emaste/freebsd/sys pandaboard.dts /scratch/tmp/emaste/obj/arm.armv6/scratch/tmp/emaste/freebsd/sys/PANDABOARD'
converting pandaboard.dts -> /scratch/tmp/emaste/obj/arm.armv6/scratch/tmp/emaste/freebsd/sys/PANDABOARD/pandaboard.dtb
Error on line 102: Expected numbers in array of cells
  interrupts = <1 13 (((3) << 8) | 4)>;
                     ^
Error on line 102: Expected ; at end of property
  interrupts = <1 13 (((3) << 8) | 4)>;
                     ^
Failed to parse tree.  Unhappy face!

preprocessed file obtained with:
cpp -P -x assembler-with-cpp -I sys/gnu/dts/include -I sys/boot/fdt/dts/arm -I sys/gnu/dts/arm -include sys/boot/fdt/dts/arm/pandaboard.dts /dev/null
Comment 1 Ed Maste freebsd_committer freebsd_triage 2015-10-26 18:29:13 UTC
Created attachment 162479 [details]
dtb file generated with gpl'd dtc
Comment 2 Ed Maste freebsd_committer freebsd_triage 2015-10-26 18:36:20 UTC
ATMEL kernel conf fails the same way:

Generating at91-sama5d3_xplained.dtb from at91-sama5d3_xplained.dts
converting at91-sama5d3_xplained.dts -> /scratch/tmp/emaste/obj/arm.arm/scratch/tmp/emaste/freebsd/sys/ATMEL/modules/scratch/tmp/emaste/freebsd/sys/modules/dtb/atmel/at91-sama5d3_xplained.dtb
Error on line 127: Expected numbers in array of cells
    dmas = <&dma0 2 (0 & (0xff))>;
                    ^
Error on line 127: Expected ; at end of property
    dmas = <&dma0 2 (0 & (0xff))>;
                    ^
Failed to parse tree.  Unhappy face!
*** [at91-sama5d3_xplained.dtb] Error code 1
Comment 3 David Chisnall freebsd_committer freebsd_triage 2015-12-26 15:48:55 UTC
I've pushed some fixes to dtc here:

https://github.com/davidchisnall/dtc

I believe that they address this bug and also #204042.

Please can you test (in particular, compile the output of `dtc -I dts -O dts` on both the GPL and BSDL dtc implementations and see if they differ) and let me know if there are any issues?

Pre-commit review on GitHub before I push to svn would also be appreciated.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2015-12-29 01:37:59 UTC
Created attachment 164781 [details]
dtb from gnu dtc
Comment 5 Ed Maste freebsd_committer freebsd_triage 2015-12-29 01:38:33 UTC
Created attachment 164782 [details]
dtb from bsd dtc
Comment 6 Ed Maste freebsd_committer freebsd_triage 2015-12-29 01:38:41 UTC
The errors are indeed gone in the latest version from GitHub, although the produced dtb output differs between the GNU and BSD dtc.
Comment 7 David Chisnall freebsd_committer freebsd_triage 2015-12-29 08:57:52 UTC
(In reply to Ed Maste from comment #6)

Thanks.  That looks as if it's an issue in merging.  I'll take a look.

In future, is it possible for you to upload the generated dts (`-O dts` instead of `-O dtb` on the command lines)?
Comment 8 David Chisnall freebsd_committer freebsd_triage 2015-12-29 09:20:55 UTC
Ooops, I was comparing against an older version of some of the include files.  The only differences in the assignment of phandle numbers (BSD DTC assigns them in order of first reference, GPL DTC assigns them in order of first definition).  As these are effectively pointers, it shouldn't matter.

Do you want to look at the code on GitHub, or should I just commit it?
Comment 9 David Chisnall freebsd_committer freebsd_triage 2015-12-29 14:20:22 UTC
With the latest version on GitHub, both dtc implementations generate byte-for-byte identical dts output from the pandaboard dts.  BSDL DTC appears to lose the null terminators on the property values in the aliases section when generating dtb output.
Comment 10 David Chisnall freebsd_committer freebsd_triage 2015-12-29 15:15:58 UTC
The generated dtb files from the two versions are still not identical, however the .dts files generated from the two .dtb files by either tool are identical.  I take this to mean that we're now able to generate a correct dtb from this dts.
Comment 11 Ed Maste freebsd_committer freebsd_triage 2015-12-29 15:30:00 UTC
> Do you want to look at the code on GitHub, or should I just commit it?

I intend to give the code on GitHub a look over the holidays still.
Comment 12 Ed Maste freebsd_committer freebsd_triage 2015-12-29 15:48:54 UTC
> I intend to give the code on GitHub a look over the holidays still.

On second thought, it's probably best to just commit to HEAD, since this change is an improvement and it's not enabled by default at present. I can still take a look either in GitHub or in HEAD.
Comment 13 David Chisnall freebsd_committer freebsd_triage 2015-12-29 16:32:08 UTC
Committed to head.