From: Minkyu Kang Date: Thu, 7 Oct 2010 06:45:09 +0000 (+0900) Subject: usbd: prevent the wrong image downloading X-Git-Tag: v0.2~377 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25448f29343c99c792231efc9c3b5e3c07092c20;p=kernel%2Fu-boot.git usbd: prevent the wrong image downloading Signed-off-by: Minkyu Kang --- 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 */ {