]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_ximg.c
karo: tx51: remove duplicate CONFIG_SYS_SDRAM_CLK definition
[karo-tx-uboot.git] / common / cmd_ximg.c
index 0414589badb7b99c62c91375de00b574a24517be..b439be3d088526eb48c0fb9c95cd6f805203728f 100644 (file)
@@ -5,23 +5,7 @@
  * (C) Copyright 2003
  * Kai-Uwe Bloem, Auerswald GmbH & Co KG, <linux-development@auerswald.de>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 
@@ -42,7 +26,7 @@
 #define CONFIG_SYS_XIMG_LEN    0x800000
 #endif
 
-int
+static int
 do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
        ulong           addr = load_addr;
@@ -50,7 +34,6 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        ulong           data, len, count;
        int             verify;
        int             part = 0;
-       char            pbuf[10];
        image_header_t  *hdr;
 #if defined(CONFIG_FIT)
        const char      *uname = NULL;
@@ -59,7 +42,9 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        const void      *fit_data;
        size_t          fit_len;
 #endif
+#ifdef CONFIG_GZIP
        uint            unc_len = CONFIG_SYS_XIMG_LEN;
+#endif
        uint8_t         comp;
 
        verify = getenv_yesno("verify");
@@ -161,7 +146,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
                /* verify integrity */
                if (verify) {
-                       if (!fit_image_check_hashes(fit_hdr, noffset)) {
+                       if (!fit_image_verify(fit_hdr, noffset)) {
                                puts("Bad Data Hash\n");
                                return 1;
                        }
@@ -256,17 +241,14 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                puts("OK\n");
        }
 
-       sprintf(pbuf, "%8lx", data);
-       setenv("fileaddr", pbuf);
-       sprintf(pbuf, "%8lx", len);
-       setenv("filesize", pbuf);
+       setenv_hex("fileaddr", data);
+       setenv_hex("filesize", len);
 
        return 0;
 }
 
-U_BOOT_CMD(
-       imxtract, 4, 1, do_imgextract,
-       "extract a part of a multi-image",
+#ifdef CONFIG_SYS_LONGHELP
+static char imgextract_help_text[] =
        "addr part [dest]\n"
        "    - extract <part> from legacy image at <addr> and copy to <dest>"
 #if defined(CONFIG_FIT)
@@ -274,4 +256,10 @@ U_BOOT_CMD(
        "addr uname [dest]\n"
        "    - extract <uname> subimage from FIT image at <addr> and copy to <dest>"
 #endif
+       "";
+#endif
+
+U_BOOT_CMD(
+       imxtract, 4, 1, do_imgextract,
+       "extract a part of a multi-image", imgextract_help_text
 );