[RFC PATCH V2 1/2] dtc: add 'compat' output option, prints board string

Jason Cooper jason at lakedaemon.net
Mon Nov 18 14:21:21 EST 2013


On Mon, Nov 18, 2013 at 12:01:02PM -0700, Stephen Warren wrote:
> On 11/18/2013 11:38 AM, Jason Cooper wrote:
> > Consumers of the Linux kernel's build products are beginning to hardcode
> > the filenames of the dtbs generated.  Since the dtb filenames are
> > currently the dts filename s/dts/dtb/, this prevents the kernel
> > community from renaming dts files as needed.
> > 
> > Let's provide a consistent naming structure for consumers to script
> > against.  Or at least, as consistent as the dts properties themselves.
> > 
> > With this patch, adding the '-O compat' option to the dtc commandline
> > will cause dtc to parse the provided file, and print out the board
> > compatible string to stdout.
> > 
> > This will facilitate an 'installdtbs.sh' script in the kernel for naming
> > dtb files by their compatible string, eg:
> > 
> > $ dtc -I dtb -O compat arch/arm/boot/dts/armada-370-mirabox.dtb
> > globalscale,mirabox
> > 
> > This change will also simplify distribution install scripts that need to
> > search through many dtbs to find the right one for a target board.
> > 
> > Signed-off-by: Jason Cooper <jason at lakedaemon.net>
> > ---
> > changes since v1:
> >  - made patch against in-tree dtc code to facilitate testing
> 
> I assume this patch would first get applied to the upstream dtc, then
> back-ported into the kernel though?

Yes.

> I wonder if dtc is the correct place to put this feature at all though.
> It seems like a tiny standalone utility using libfdt would be better.
> Actually, perhaps the existing fdtget utility (which seems to be
> scripts/dtc/fdtget.c in the kernel although I don't know if it's built
> by the kernel yet) can be used rather than creating a new one? Using
> fdtget seems like it'd allow more flexibility later, if the naming rules
> change, via scripting rather than having to edit the dtc source code.

Ah, neat.  I missed fdtget.c.  I'll take a look at that, it sounds
promising.

thx,

Jason.



More information about the linux-arm-kernel mailing list