X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fcmd_cramfs.c;h=1d31326bd648277826514031271568cfe1fa9ffb;hb=a7d0711a2486b7420a938831512d859879e613cb;hp=8c86dc5bf1a3df285a89170cd1963a043bb159d6;hpb=cc9f607beb49d4d3556c326efb83a0a51784e484;p=oweals%2Fu-boot.git diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c index 8c86dc5bf1..1d31326bd6 100644 --- a/common/cmd_cramfs.c +++ b/common/cmd_cramfs.c @@ -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 * @@ -43,7 +30,13 @@ #endif #ifdef CONFIG_CRAMFS_CMDLINE -flash_info_t flash_info[1]; +#include + +#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 @@ -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];