HomeFreeBSD

stand/fdt: Check /compatible property on overlay if it exists

Description

stand/fdt: Check /compatible property on overlay if it exists

Example overlays seen in other places use a compatible property on root node
of an overlay to specify SOC compatibility. These don't get merged into base
FDT as they're not part of a fragment, but it's expected that consumers of
the overlay may want to check it.

If /compatible on the overlay is missing, just apply it. This is the "I know
what I'm doing" mode for those wanting to whip up a quick overlay and apply
it. An overlay intended for distribution should include /compatible so as
not to break a user's system.

If /compatible on the overlay exists, honor it and cross-check it with
/compatible on the base FDT. If /compatible on the base FDT is missing in
this case, don't apply the overlay rather than risk breaking the system.

Move the COPYOUT of overlay material to before we allocate space for
next_fdtp so that we can avoid the allocation and copy into next_fdtp if we
already know that the overlay can't apply.

This gives way to the possibility of autoloading overlays found in
/boot/overlays, since this provides a means of filtering out overlays not
applicable to the current board.

Reviewed by: gonzo
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13969

Details

Committed
kevansJan 28 2018, 3:07 AM
Reviewer
gonzo
Differential Revision
D13969: stand/fdt: Check /compatible property on overlay if it exists
Parents
rS328504: stand/fdt: Consolidate overlay handling a little further
Branches
Unknown
Tags
Unknown