]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_cramfs.c
arm: mx5: clock: fix PLL_FREQ_MIN() calculation
[karo-tx-uboot.git] / common / cmd_cramfs.c
index 8c86dc5bf1a3df285a89170cd1963a043bb159d6..1d31326bd648277826514031271568cfe1fa9ffb 100644 (file)
@@ -1,18 +1,5 @@
 /*
- * 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+
  *
  * based on: cmd_jffs2.c
  *
 #endif
 
 #ifdef CONFIG_CRAMFS_CMDLINE
-flash_info_t flash_info[1];
+#include <flash.h>
+
+#ifdef CONFIG_SYS_NO_FLASH
+# define OFFSET_ADJUSTMENT     0
+#else
+# define OFFSET_ADJUSTMENT     (flash_info[id.num].start[0])
+#endif
 
 #ifndef CONFIG_CMD_JFFS2
 #include <linux/stat.h>
@@ -119,7 +112,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        dev.id = &id;
        part.dev = &dev;
        /* fake the address offset */
-       part.offset = addr - flash_info[id.num].start[0];
+       part.offset = addr - OFFSET_ADJUSTMENT;
 
        /* pre-set Boot file name */
        if ((filename = getenv("bootfile")) == NULL) {
@@ -140,11 +133,9 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                size = cramfs_load ((char *) offset, &part, filename);
 
        if (size > 0) {
-               char buf[10];
                printf("### CRAMFS load complete: %d bytes loaded to 0x%lx\n",
                        size, offset);
-               sprintf(buf, "%x", size);
-               setenv("filesize", buf);
+               setenv_hex("filesize", size);
        } else {
                printf("### CRAMFS LOAD ERROR<%x> for %s!\n", size, filename);
        }
@@ -182,7 +173,7 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        dev.id = &id;
        part.dev = &dev;
        /* fake the address offset */
-       part.offset = addr - flash_info[id.num].start[0];
+       part.offset = addr - OFFSET_ADJUSTMENT;
 
        if (argc == 2)
                filename = argv[1];