summaryrefslogtreecommitdiff
path: root/tools/binman/etype/fit.py
diff options
context:
space:
mode:
authorJonas Karlman <jonas@kwiboo.se>2023-01-21 22:01:48 +0300
committerSimon Glass <sjg@chromium.org>2023-01-26 20:47:45 +0300
commit00b3d53f156927427b2bec95604acb6f6190c134 (patch)
tree66f35ae3faebb592b54df51b94ad196ef4384934 /tools/binman/etype/fit.py
parent5ad03fc77dfa055629bfbf283bdf938e6dd27d94 (diff)
downloadu-boot-00b3d53f156927427b2bec95604acb6f6190c134.tar.xz
binman: Add special subnodes to the nodes generated by split-elf
Special nodes, hash and signature, is not being added to the nodes generated for each segment in split-elf operation. Copy the subnode logic used in _gen_fdt_nodes to _gen_split_elf to ensure special nodes are added to the generated nodes. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype/fit.py')
-rw-r--r--tools/binman/etype/fit.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index df1ce81f9c..bcb606f3f9 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -228,6 +228,9 @@ class Entry_fit(Entry_section):
atf-bl31 {
};
+ hash {
+ algo = "sha256";
+ };
};
@tee-SEQ {
@@ -243,6 +246,9 @@ class Entry_fit(Entry_section):
tee-os {
};
+ hash {
+ algo = "sha256";
+ };
};
};
@@ -271,6 +277,10 @@ class Entry_fit(Entry_section):
arch = "arm64";
type = "firmware";
description = "ARM Trusted Firmware";
+ hash {
+ algo = "sha256";
+ value = <...hash of first segment...>;
+ };
};
atf-2 {
data = <...contents of second segment...>;
@@ -280,6 +290,10 @@ class Entry_fit(Entry_section):
arch = "arm64";
type = "firmware";
description = "ARM Trusted Firmware";
+ hash {
+ algo = "sha256";
+ value = <...hash of second segment...>;
+ };
};
};
@@ -548,12 +562,13 @@ class Entry_fit(Entry_section):
else:
self.Raise("Generator node requires 'fit,fdt-list' property")
- def _gen_split_elf(base_node, node, segments, entry_addr):
+ def _gen_split_elf(base_node, node, depth, segments, entry_addr):
"""Add nodes for the ELF file, one per group of contiguous segments
Args:
base_node (Node): Template node from the binman definition
node (Node): Node to replace (in the FIT being built)
+ depth: Current node depth (0 is the base 'fit' node)
segments (list): list of segments, each:
int: Segment number (0 = first)
int: Start address of segment in memory
@@ -578,6 +593,10 @@ class Entry_fit(Entry_section):
self._raise_subnode(
node, f"Unknown directive '{pname}'")
+ for subnode in node.subnodes:
+ with fsw.add_node(subnode.name):
+ _add_node(node, depth + 1, subnode)
+
def _gen_node(base_node, node, depth, in_images, entry):
"""Generate nodes from a template
@@ -631,7 +650,7 @@ class Entry_fit(Entry_section):
self._raise_subnode(
node, f'Failed to read ELF file: {str(exc)}')
- _gen_split_elf(base_node, node, segments, entry_addr)
+ _gen_split_elf(base_node, node, depth, segments, entry_addr)
def _add_node(base_node, depth, node):
"""Add nodes to the output FIT