Skip to contentSkip to conversation

Abort booting if the DTB version is incomp [...]

PATCH New OTRS Notification Master 1 participant 1 message Jan 25, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Abort booting if the DTB version is incomp [...]

Hello list,

inside the automatic U-Boot patch tracking system a new ticket [DNX#2007012542000011] was created:

<snip>

Quoted 38 lines

U-Boot only supports version 16 of the device tree file format, although some
versions of the device tree compiler generate version 3 by default. With
this patch, U-Boot now checks the version number and aborts the boot process
if the version of the device tree passed on the bootm command line is not
compatible.

---
 common/cmd_bootm.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
common/cmd_bootm.c +10 -0
index 0c092c7..9111cbd 100644
@@ -741,6 +741,16 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl
 		hdr = (image_header_t *)of_flat_tree;
 
 		if  (*(ulong *)of_flat_tree == OF_DT_HEADER) {
+			struct boot_param_header *bph =
+				(struct boot_param_header *) of_flat_tree;
+
+			if ((OF_DT_VERSION < be32_to_cpu(bph->last_comp_version)) ||
+			    (OF_DT_VERSION > be32_to_cpu(bph->version))) {
+				printf("ERROR: DTB version %u is not compatible with version %u " \
+				       "(last_comp_version=%u)\n", be32_to_cpu(bph->version),
+				       OF_DT_VERSION, be32_to_cpu(bph->last_comp_version));
+				return;
+			}
 #ifndef CFG_NO_FLASH
 			if (addr2info((ulong)of_flat_tree) != NULL)
 				of_data = (ulong)of_flat_tree;
Signature · 1 line
1.4.4

</snip>

Your U-Boot support team