* [U-Boot-Users] [PATCH] Abort booting if the DTB version is incompatible
@ 2007-01-25 16:13 Timur Tabi
2007-01-25 20:35 ` Wolfgang Denk
0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2007-01-25 16:13 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot-Users] [PATCH] Abort booting if the DTB version is incompatible
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
0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2007-01-25 20:35 UTC (permalink / raw)
To: u-boot
In message <11697416301544-git-send-email-timur@freescale.com> you wrote:
> 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.
Is there a differnce between your two submissions of the same (?)
patch?
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Es gibt immer genug fuer die Beduerfnisse aller, aber niemals genug
fuer die Gier einzelner. -- Ghandi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] [PATCH] Abort booting if the DTB version is incompatible
2007-01-25 20:35 ` Wolfgang Denk
@ 2007-01-25 20:36 ` Timur Tabi
0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2007-01-25 20:36 UTC (permalink / raw)
To: u-boot
Wolfgang Denk wrote:
> In message <11697416301544-git-send-email-timur@freescale.com> you wrote:
>> 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.
>
> Is there a differnce between your two submissions of the same (?)
> patch?
No. Sorry about that - I didn't intend to send it twice.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] [PATCH] Abort booting if the DTB version is incompatible
@ 2007-01-25 15:44 Timur Tabi
0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2007-01-25 15:44 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-25 20:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2007-01-25 15:44 Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox