/*
- * 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>
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) {
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);
}
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];
/***************************************************/
U_BOOT_CMD(
cramfsload, 3, 0, do_cramfs_load,
- "cramfsload\t- load binary file from a filesystem image",
+ "load binary file from a filesystem image",
"[ off ] [ filename ]\n"
" - load binary file from address 'cramfsaddr'\n"
" with offset 'off'\n"
);
U_BOOT_CMD(
cramfsls, 2, 1, do_cramfs_ls,
- "cramfsls\t- list files in a directory (default /)",
+ "list files in a directory (default /)",
"[ directory ]\n"
" - list files in a directory.\n"
);