dtoverlay app: Keep overlay symbols private

As of 4.14, the kernel overlay merging includes any symbols defined
by an overlay, which can cause clashes between overlays (and even
within them in the case that an overlay deliberately adds a global
symbol as a way of exporting it to other overlays).

In future we may choose to make use of this mechanism as a nicer
way of exporting symbols, but for now just delete all symbols before
presenting the overlay to the kernel.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
This commit is contained in:
Phil Elwell
2017-12-08 12:39:31 +00:00
parent 2fe51001db
commit 2e0e726a27

View File

@@ -520,6 +520,14 @@ static int dtoverlay_add(STATE_T *state, const char *overlay,
dtoverlay_free_dtb(base_dtb);
}
/* Prevent symbol clash by keeping them all private.
* In future we could choose to expose some - perhaps using
* a naming convention, or an "__exports__" node, at which
* point it will no longer be necessary to explictly target
* the /__symbols__ node with a fragment.
*/
dtoverlay_delete_node(overlay_dtb, "/__symbols__", 0);
if (param_string)
dtoverlay_dtb_set_trailer(overlay_dtb, param_string,
strlen(param_string) + 1);