From 25448f29343c99c792231efc9c3b5e3c07092c20 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 7 Oct 2010 15:45:09 +0900 Subject: [PATCH] usbd: prevent the wrong image downloading Signed-off-by: Minkyu Kang --- common/cmd_usbd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/cmd_usbd.c b/common/cmd_usbd.c index 15dc7e9..16fb02c 100644 --- a/common/cmd_usbd.c +++ b/common/cmd_usbd.c @@ -1039,6 +1039,21 @@ static int process_data(struct usbd_ops *usbd) } } #endif +#ifdef CONFIG_SBOOT + /* Only u-boot.bin is allowed */ + { + long *img_header = (long *)down_ram_addr; + + if (*img_header != 0xea000018) { + printf("\n!!! ERROR !!!\n" + "Please download the u-boot.bin.\n" + "Other images are not allowed.\n\n"); + *((ulong *) usbd->tx_data) = STATUS_ERROR; + usbd->send_data(usbd->tx_data, usbd->tx_len); + return 0; + } + } +#endif #if defined(CONFIG_ENV_IS_IN_NAND) || defined(CONFIG_ENV_IS_IN_ONENAND) /* Erase the environment also when write bootloader */ { -- 2.7.4