Skip to content

Commit

Permalink
dtoverlay app: Keep overlay symbols private
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Phil Elwell committed Dec 8, 2017
1 parent 2fe5100 commit 2e0e726
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions host_applications/linux/apps/dtoverlay/dtoverlay_main.c
Expand Up @@ -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);
Expand Down

0 comments on commit 2e0e726

Please sign in to comment.