From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Abort booting if the DTB version is incompatible
Date: Thu, 25 Jan 2007 09:44:46 -0600 [thread overview]
Message-ID: <11697398863084-git-send-email-timur@freescale.com> (raw)
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.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
common/cmd_bootm.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 0c092c7..9111cbd 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -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;
--
1.4.4
next reply other threads:[~2007-01-25 15:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-25 15:44 Timur Tabi [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-01-25 16:13 [U-Boot-Users] [PATCH] Abort booting if the DTB version is incompatible Timur Tabi
2007-01-25 20:35 ` Wolfgang Denk
2007-01-25 20:36 ` Timur Tabi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11697398863084-git-send-email-timur@freescale.com \
--to=timur@freescale.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.