[RFC PATCH v2 27/74] dtc: Introduce import symbols
From: Herve Codina
Date: Wed Aug 26 2026 - 06:05:09 EST
Import symbols allow to define a list of symbols imported and used by an
addon.
Those symbols have to be resolved when the addon is applied on a base
device-tree and will involved exported symbols provided at the node the
addon is applied to.
Import symbols are similar in term of feature to __fixups__ available
in device-tree overlays.
The goal is to identify symbols which are used by an addon but not
defined by the addon itself. Those specific symbols are the imported
symbols.
Introduce the import symbols list related to an addon. No functional
change yet but preparation for the future support for import symbol
parsing.
Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
---
dtc-parser.y | 3 ++-
dtc.h | 4 +++-
flattree.c | 2 +-
fstree.c | 2 +-
livetree.c | 4 +++-
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dtc-parser.y b/dtc-parser.y
index a0d0aef9..4e46e9d1 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -113,7 +113,8 @@ sourcefile:
headers memreserves devicetree
{
parser_output = build_dt_info($1, $2, $3,
- guess_boot_cpuid($3));
+ guess_boot_cpuid($3),
+ NULL);
}
;
diff --git a/dtc.h b/dtc.h
index 8a20d6da..63fe4dc1 100644
--- a/dtc.h
+++ b/dtc.h
@@ -350,6 +350,7 @@ struct dt_info {
struct reserve_info *reservelist;
uint32_t boot_cpuid_phys;
struct node *dt; /* the device tree */
+ struct symbol *importsymlist; /* Import symbol list */
const char *outname; /* filename being written to, "-" for stdout */
};
@@ -360,7 +361,8 @@ struct dt_info {
struct dt_info *build_dt_info(unsigned int dtsflags,
struct reserve_info *reservelist,
- struct node *tree, uint32_t boot_cpuid_phys);
+ struct node *tree, uint32_t boot_cpuid_phys,
+ struct symbol *importsymlist);
void sort_tree(struct dt_info *dti);
void generate_labels_from_tree(struct dt_info *dti, const char *name);
void generate_label_tree(struct dt_info *dti, const char *name, bool allocph);
diff --git a/flattree.c b/flattree.c
index 4e4727e9..45dc4ed4 100644
--- a/flattree.c
+++ b/flattree.c
@@ -1241,5 +1241,5 @@ struct dt_info *dt_from_blob(const char *fname)
if (get_subnode(tree, "__fixups__") || get_subnode(tree, "__local_fixups__"))
dtsflags |= DTSF_PLUGIN;
- return build_dt_info(dtsflags, reservelist, tree, boot_cpuid_phys);
+ return build_dt_info(dtsflags, reservelist, tree, boot_cpuid_phys, NULL);
}
diff --git a/fstree.c b/fstree.c
index 445ae53a..a6aaf1e8 100644
--- a/fstree.c
+++ b/fstree.c
@@ -72,5 +72,5 @@ struct dt_info *dt_from_fs(const char *dirname)
tree = read_fstree(dirname);
tree = name_node(tree, "");
- return build_dt_info(DTSF_V1, NULL, tree, guess_boot_cpuid(tree));
+ return build_dt_info(DTSF_V1, NULL, tree, guess_boot_cpuid(tree), NULL);
}
diff --git a/livetree.c b/livetree.c
index fe0f300b..a6c40642 100644
--- a/livetree.c
+++ b/livetree.c
@@ -635,7 +635,8 @@ static void complete_references(struct dt_info *dti)
struct dt_info *build_dt_info(unsigned int dtsflags,
struct reserve_info *reservelist,
- struct node *tree, uint32_t boot_cpuid_phys)
+ struct node *tree, uint32_t boot_cpuid_phys,
+ struct symbol *importsymlist)
{
struct dt_info *dti;
@@ -644,6 +645,7 @@ struct dt_info *build_dt_info(unsigned int dtsflags,
dti->reservelist = reservelist;
dti->dt = tree;
dti->boot_cpuid_phys = boot_cpuid_phys;
+ dti->importsymlist = importsymlist;
fill_fullpaths(dti->dt, "");
--
2.55.0