Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2002 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 5 | * |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 6 | * (C) Copyright 2002 |
| 7 | * Robert Schwebel, Pengutronix, <r.schwebel@pengutronix.de> |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 8 | * |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 9 | * (C) Copyright 2003 |
| 10 | * Kai-Uwe Bloem, Auerswald GmbH & Co KG, <linux-development@auerswald.de> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 11 | * |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 12 | * (C) Copyright 2005 |
| 13 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 14 | * |
| 15 | * Added support for reading flash partition table from environment. |
| 16 | * Parsing routines are based on driver/mtd/cmdline.c from the linux 2.4 |
| 17 | * kernel tree. |
| 18 | * |
| 19 | * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ |
| 20 | * Copyright 2002 SYSGO Real-Time Solutions GmbH |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * Three environment variables are used by the parsing routines: |
| 25 | * |
| 26 | * 'partition' - keeps current partition identifier |
| 27 | * |
| 28 | * partition := <part-id> |
| 29 | * <part-id> := <dev-id>,part_num |
| 30 | * |
Wolfgang Denk | eb95c85 | 2005-08-10 15:14:32 +0200 | [diff] [blame] | 31 | * |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 32 | * 'mtdids' - linux kernel mtd device id <-> u-boot device id mapping |
| 33 | * |
| 34 | * mtdids=<idmap>[,<idmap>,...] |
| 35 | * |
| 36 | * <idmap> := <dev-id>=<mtd-id> |
Kyungmin Park | 2538374 | 2008-08-27 14:45:20 +0900 | [diff] [blame] | 37 | * <dev-id> := 'nand'|'nor'|'onenand'<dev-num> |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 38 | * <dev-num> := mtd device number, 0... |
| 39 | * <mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name) |
| 40 | * |
| 41 | * |
| 42 | * 'mtdparts' - partition list |
| 43 | * |
| 44 | * mtdparts=mtdparts=<mtd-def>[;<mtd-def>...] |
| 45 | * |
| 46 | * <mtd-def> := <mtd-id>:<part-def>[,<part-def>...] |
| 47 | * <mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name) |
| 48 | * <part-def> := <size>[@<offset>][<name>][<ro-flag>] |
| 49 | * <size> := standard linux memsize OR '-' to denote all remaining space |
| 50 | * <offset> := partition start offset within the device |
| 51 | * <name> := '(' NAME ')' |
| 52 | * <ro-flag> := when set to 'ro' makes partition read-only (not used, passed to kernel) |
| 53 | * |
| 54 | * Notes: |
| 55 | * - each <mtd-id> used in mtdparts must albo exist in 'mtddis' mapping |
| 56 | * - if the above variables are not set defaults for a given target are used |
| 57 | * |
| 58 | * Examples: |
| 59 | * |
| 60 | * 1 NOR Flash, with 1 single writable partition: |
| 61 | * mtdids=nor0=edb7312-nor |
| 62 | * mtdparts=mtdparts=edb7312-nor:- |
| 63 | * |
| 64 | * 1 NOR Flash with 2 partitions, 1 NAND with one |
| 65 | * mtdids=nor0=edb7312-nor,nand0=edb7312-nand |
| 66 | * mtdparts=mtdparts=edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home) |
| 67 | * |
| 68 | */ |
| 69 | |
| 70 | /* |
Michal Simek | 40277b3 | 2007-09-15 00:03:35 +0200 | [diff] [blame] | 71 | * JFFS2/CRAMFS support |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 72 | */ |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 73 | #include <command.h> |
Simon Glass | 313112a | 2019-08-01 09:46:46 -0600 | [diff] [blame] | 74 | #include <env.h> |
Tom Rini | 063c938 | 2022-07-23 13:05:03 -0400 | [diff] [blame] | 75 | #if defined(CONFIG_CMD_FLASH) |
Simon Glass | 8e20188 | 2020-05-10 11:39:54 -0600 | [diff] [blame] | 76 | #include <flash.h> |
Tom Rini | 063c938 | 2022-07-23 13:05:03 -0400 | [diff] [blame] | 77 | #endif |
Simon Glass | 85f1378 | 2019-12-28 10:45:03 -0700 | [diff] [blame] | 78 | #include <image.h> |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 79 | #include <malloc.h> |
| 80 | #include <jffs2/jffs2.h> |
Simon Glass | c06c1be | 2020-05-10 11:40:08 -0600 | [diff] [blame] | 81 | #include <linux/bug.h> |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 82 | #include <linux/list.h> |
| 83 | #include <linux/ctype.h> |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 84 | #include <cramfs/cramfs_fs.h> |
| 85 | |
Jon Loeliger | d76b5c1 | 2007-07-08 18:02:23 -0500 | [diff] [blame] | 86 | #if defined(CONFIG_CMD_NAND) |
Masahiro Yamada | 2b7a873 | 2017-11-30 13:45:24 +0900 | [diff] [blame] | 87 | #include <linux/mtd/rawnand.h> |
Wolfgang Denk | 7b9bc3a | 2005-09-14 23:53:32 +0200 | [diff] [blame] | 88 | #include <nand.h> |
Jon Loeliger | d76b5c1 | 2007-07-08 18:02:23 -0500 | [diff] [blame] | 89 | #endif |
Kyungmin Park | 2538374 | 2008-08-27 14:45:20 +0900 | [diff] [blame] | 90 | |
| 91 | #if defined(CONFIG_CMD_ONENAND) |
| 92 | #include <linux/mtd/mtd.h> |
| 93 | #include <linux/mtd/onenand.h> |
| 94 | #include <onenand_uboot.h> |
| 95 | #endif |
| 96 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 97 | /* enable/disable debugging messages */ |
Bartlomiej Sieka | 6eed2ab | 2006-02-24 09:37:22 +0100 | [diff] [blame] | 98 | #define DEBUG_JFFS |
| 99 | #undef DEBUG_JFFS |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 100 | |
Michal Simek | 6ed8c71 | 2007-08-06 23:31:49 +0200 | [diff] [blame] | 101 | #ifdef DEBUG_JFFS |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 102 | # define DEBUGF(fmt, args...) printf(fmt ,##args) |
| 103 | #else |
| 104 | # define DEBUGF(fmt, args...) |
| 105 | #endif |
| 106 | |
| 107 | /* special size referring to all the remaining space in a partition */ |
| 108 | #define SIZE_REMAINING 0xFFFFFFFF |
| 109 | |
| 110 | /* special offset value, it is used when not provided by user |
| 111 | * |
| 112 | * this value is used temporarily during parsing, later such offests |
| 113 | * are recalculated */ |
| 114 | #define OFFSET_NOT_SPECIFIED 0xFFFFFFFF |
| 115 | |
| 116 | /* minimum partition size */ |
| 117 | #define MIN_PART_SIZE 4096 |
| 118 | |
| 119 | /* this flag needs to be set in part_info struct mask_flags |
| 120 | * field for read-only partitions */ |
Bartlomiej Sieka | 6eed2ab | 2006-02-24 09:37:22 +0100 | [diff] [blame] | 121 | #define MTD_WRITEABLE_CMD 1 |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 122 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 123 | /* current active device and partition number */ |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 124 | #ifdef CONFIG_CMD_MTDPARTS |
| 125 | /* Use the ones declared in cmd_mtdparts.c */ |
| 126 | extern struct mtd_device *current_mtd_dev; |
| 127 | extern u8 current_mtd_partnum; |
| 128 | #else |
| 129 | /* Use local ones */ |
| 130 | struct mtd_device *current_mtd_dev = NULL; |
| 131 | u8 current_mtd_partnum = 0; |
| 132 | #endif |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 133 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 134 | #if defined(CONFIG_CMD_CRAMFS) |
| 135 | extern int cramfs_check (struct part_info *info); |
| 136 | extern int cramfs_load (char *loadoffset, struct part_info *info, char *filename); |
| 137 | extern int cramfs_ls (struct part_info *info, char *filename); |
| 138 | extern int cramfs_info (struct part_info *info); |
| 139 | #else |
| 140 | /* defining empty macros for function names is ugly but avoids ifdef clutter |
| 141 | * all over the code */ |
| 142 | #define cramfs_check(x) (0) |
| 143 | #define cramfs_load(x,y,z) (-1) |
| 144 | #define cramfs_ls(x,y) (0) |
| 145 | #define cramfs_info(x) (0) |
| 146 | #endif |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 147 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 148 | #ifndef CONFIG_CMD_MTDPARTS |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 149 | /** |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 150 | * Check device number to be within valid range for given device type. |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 151 | * |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 152 | * @param dev device to validate |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 153 | * Return: 0 if device is valid, 1 otherwise |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 154 | */ |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 155 | static int mtd_device_validate(u8 type, u8 num, u32 *size) |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 156 | { |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 157 | if (type == MTD_DEV_TYPE_NOR) { |
| 158 | #if defined(CONFIG_CMD_FLASH) |
| 159 | if (num < CONFIG_SYS_MAX_FLASH_BANKS) { |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 160 | *size = flash_info[num].size; |
wdenk | ad276f2 | 2004-01-04 16:28:35 +0000 | [diff] [blame] | 161 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 162 | return 0; |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 163 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 164 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 165 | printf("no such FLASH device: %s%d (valid range 0 ... %d\n", |
| 166 | MTD_DEV_TYPE(type), num, CONFIG_SYS_MAX_FLASH_BANKS - 1); |
| 167 | #else |
| 168 | printf("support for FLASH devices not present\n"); |
| 169 | #endif |
| 170 | } else if (type == MTD_DEV_TYPE_NAND) { |
| 171 | #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) |
Grygorii Strashko | 6d2a2668 | 2017-06-26 19:12:55 -0500 | [diff] [blame] | 172 | struct mtd_info *mtd = get_nand_dev_by_index(num); |
| 173 | if (mtd) { |
| 174 | *size = mtd->size; |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 175 | return 0; |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 176 | } |
wdenk | da04a8b | 2004-08-02 23:22:59 +0000 | [diff] [blame] | 177 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 178 | printf("no such NAND device: %s%d (valid range 0 ... %d)\n", |
| 179 | MTD_DEV_TYPE(type), num, CONFIG_SYS_MAX_NAND_DEVICE - 1); |
| 180 | #else |
| 181 | printf("support for NAND devices not present\n"); |
| 182 | #endif |
| 183 | } else if (type == MTD_DEV_TYPE_ONENAND) { |
| 184 | #if defined(CONFIG_CMD_ONENAND) |
| 185 | *size = onenand_mtd.size; |
| 186 | return 0; |
| 187 | #else |
| 188 | printf("support for OneNAND devices not present\n"); |
| 189 | #endif |
| 190 | } else |
| 191 | printf("Unknown defice type %d\n", type); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 192 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 193 | return 1; |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 194 | } |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 195 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 196 | /** |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 197 | * Parse device id string <dev-id> := 'nand'|'nor'|'onenand'<dev-num>, |
| 198 | * return device type and number. |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 199 | * |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 200 | * @param id string describing device id |
| 201 | * @param ret_id output pointer to next char after parse completes (output) |
| 202 | * @param dev_type parsed device type (output) |
| 203 | * @param dev_num parsed device number (output) |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 204 | * Return: 0 on success, 1 otherwise |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 205 | */ |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 206 | static int mtd_id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *dev_num) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 207 | { |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 208 | const char *p = id; |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 209 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 210 | *dev_type = 0; |
| 211 | if (strncmp(p, "nand", 4) == 0) { |
| 212 | *dev_type = MTD_DEV_TYPE_NAND; |
| 213 | p += 4; |
| 214 | } else if (strncmp(p, "nor", 3) == 0) { |
| 215 | *dev_type = MTD_DEV_TYPE_NOR; |
| 216 | p += 3; |
| 217 | } else if (strncmp(p, "onenand", 7) == 0) { |
| 218 | *dev_type = MTD_DEV_TYPE_ONENAND; |
| 219 | p += 7; |
| 220 | } else { |
| 221 | printf("incorrect device type in %s\n", id); |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 222 | return 1; |
| 223 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 224 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 225 | if (!isdigit(*p)) { |
| 226 | printf("incorrect device number in %s\n", id); |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 227 | return 1; |
| 228 | } |
| 229 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 230 | *dev_num = simple_strtoul(p, (char **)&p, 0); |
| 231 | if (ret_id) |
| 232 | *ret_id = p; |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 233 | return 0; |
| 234 | } |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 235 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 236 | /* |
| 237 | * 'Static' version of command line mtdparts_init() routine. Single partition on |
| 238 | * a single device configuration. |
| 239 | */ |
| 240 | |
| 241 | /** |
Tomasz Figa | 63440e0 | 2008-12-30 18:35:57 +0100 | [diff] [blame] | 242 | * Calculate sector size. |
| 243 | * |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 244 | * Return: sector size |
Tomasz Figa | 63440e0 | 2008-12-30 18:35:57 +0100 | [diff] [blame] | 245 | */ |
| 246 | static inline u32 get_part_sector_size_nand(struct mtdids *id) |
| 247 | { |
| 248 | #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) |
Scott Wood | 08364d9 | 2016-05-30 13:57:54 -0500 | [diff] [blame] | 249 | struct mtd_info *mtd; |
Tomasz Figa | 63440e0 | 2008-12-30 18:35:57 +0100 | [diff] [blame] | 250 | |
Grygorii Strashko | 6d2a2668 | 2017-06-26 19:12:55 -0500 | [diff] [blame] | 251 | mtd = get_nand_dev_by_index(id->num); |
Tomasz Figa | 63440e0 | 2008-12-30 18:35:57 +0100 | [diff] [blame] | 252 | |
Scott Wood | 08364d9 | 2016-05-30 13:57:54 -0500 | [diff] [blame] | 253 | return mtd->erasesize; |
Tomasz Figa | 63440e0 | 2008-12-30 18:35:57 +0100 | [diff] [blame] | 254 | #else |
| 255 | BUG(); |
| 256 | return 0; |
| 257 | #endif |
| 258 | } |
| 259 | |
| 260 | static inline u32 get_part_sector_size_nor(struct mtdids *id, struct part_info *part) |
| 261 | { |
| 262 | #if defined(CONFIG_CMD_FLASH) |
Tomasz Figa | 63440e0 | 2008-12-30 18:35:57 +0100 | [diff] [blame] | 263 | u32 end_phys, start_phys, sector_size = 0, size = 0; |
| 264 | int i; |
| 265 | flash_info_t *flash; |
| 266 | |
| 267 | flash = &flash_info[id->num]; |
| 268 | |
| 269 | start_phys = flash->start[0] + part->offset; |
Peter Tyser | 5e26c2a | 2010-12-30 15:47:56 -0600 | [diff] [blame] | 270 | end_phys = start_phys + part->size - 1; |
Tomasz Figa | 63440e0 | 2008-12-30 18:35:57 +0100 | [diff] [blame] | 271 | |
| 272 | for (i = 0; i < flash->sector_count; i++) { |
| 273 | if (flash->start[i] >= end_phys) |
| 274 | break; |
| 275 | |
| 276 | if (flash->start[i] >= start_phys) { |
| 277 | if (i == flash->sector_count - 1) { |
| 278 | size = flash->start[0] + flash->size - flash->start[i]; |
| 279 | } else { |
| 280 | size = flash->start[i+1] - flash->start[i]; |
| 281 | } |
| 282 | |
| 283 | if (sector_size < size) |
| 284 | sector_size = size; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | return sector_size; |
| 289 | #else |
| 290 | BUG(); |
| 291 | return 0; |
| 292 | #endif |
| 293 | } |
| 294 | |
| 295 | static inline u32 get_part_sector_size_onenand(void) |
| 296 | { |
| 297 | #if defined(CONFIG_CMD_ONENAND) |
| 298 | struct mtd_info *mtd; |
| 299 | |
| 300 | mtd = &onenand_mtd; |
| 301 | |
| 302 | return mtd->erasesize; |
| 303 | #else |
| 304 | BUG(); |
| 305 | return 0; |
| 306 | #endif |
| 307 | } |
| 308 | |
| 309 | static inline u32 get_part_sector_size(struct mtdids *id, struct part_info *part) |
| 310 | { |
| 311 | if (id->type == MTD_DEV_TYPE_NAND) |
| 312 | return get_part_sector_size_nand(id); |
| 313 | else if (id->type == MTD_DEV_TYPE_NOR) |
| 314 | return get_part_sector_size_nor(id, part); |
| 315 | else if (id->type == MTD_DEV_TYPE_ONENAND) |
| 316 | return get_part_sector_size_onenand(); |
| 317 | else |
| 318 | DEBUGF("Error: Unknown device type.\n"); |
| 319 | |
| 320 | return 0; |
| 321 | } |
| 322 | |
| 323 | /** |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 324 | * Parse and initialize global mtdids mapping and create global |
Wolfgang Denk | eb95c85 | 2005-08-10 15:14:32 +0200 | [diff] [blame] | 325 | * device/partition list. |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 326 | * |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 327 | * 'Static' version of command line mtdparts_init() routine. Single partition on |
| 328 | * a single device configuration. |
| 329 | * |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 330 | * Return: 0 on success, 1 otherwise |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 331 | */ |
| 332 | int mtdparts_init(void) |
| 333 | { |
| 334 | static int initialized = 0; |
| 335 | u32 size; |
| 336 | char *dev_name; |
| 337 | |
| 338 | DEBUGF("\n---mtdparts_init---\n"); |
| 339 | if (!initialized) { |
Wolfgang Denk | c0d487b | 2005-08-09 21:41:20 +0200 | [diff] [blame] | 340 | struct mtdids *id; |
| 341 | struct part_info *part; |
| 342 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 343 | initialized = 1; |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 344 | current_mtd_dev = (struct mtd_device *) |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 345 | malloc(sizeof(struct mtd_device) + |
| 346 | sizeof(struct part_info) + |
| 347 | sizeof(struct mtdids)); |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 348 | if (!current_mtd_dev) { |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 349 | printf("out of memory\n"); |
| 350 | return 1; |
| 351 | } |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 352 | memset(current_mtd_dev, 0, sizeof(struct mtd_device) + |
| 353 | sizeof(struct part_info) + sizeof(struct mtdids)); |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 354 | |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 355 | id = (struct mtdids *)(current_mtd_dev + 1); |
Wolfgang Denk | c0d487b | 2005-08-09 21:41:20 +0200 | [diff] [blame] | 356 | part = (struct part_info *)(id + 1); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 357 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 358 | /* id */ |
| 359 | id->mtd_id = "single part"; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 360 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 361 | dev_name = CONFIG_JFFS2_DEV; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 362 | |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 363 | if ((mtd_id_parse(dev_name, NULL, &id->type, &id->num) != 0) || |
| 364 | (mtd_device_validate(id->type, id->num, &size) != 0)) { |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 365 | printf("incorrect device: %s%d\n", MTD_DEV_TYPE(id->type), id->num); |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 366 | free(current_mtd_dev); |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 367 | return 1; |
| 368 | } |
| 369 | id->size = size; |
| 370 | INIT_LIST_HEAD(&id->link); |
| 371 | |
| 372 | DEBUGF("dev id: type = %d, num = %d, size = 0x%08lx, mtd_id = %s\n", |
| 373 | id->type, id->num, id->size, id->mtd_id); |
| 374 | |
| 375 | /* partition */ |
| 376 | part->name = "static"; |
| 377 | part->auto_name = 0; |
| 378 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 379 | part->size = CONFIG_JFFS2_PART_SIZE; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 380 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 381 | part->offset = CONFIG_JFFS2_PART_OFFSET; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 382 | |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 383 | part->dev = current_mtd_dev; |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 384 | INIT_LIST_HEAD(&part->link); |
| 385 | |
| 386 | /* recalculate size if needed */ |
| 387 | if (part->size == SIZE_REMAINING) |
| 388 | part->size = id->size - part->offset; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 389 | |
Mike Frysinger | b5125d2 | 2010-01-08 08:03:06 -0500 | [diff] [blame] | 390 | part->sector_size = get_part_sector_size(id, part); |
| 391 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 392 | DEBUGF("part : name = %s, size = 0x%08lx, offset = 0x%08lx\n", |
| 393 | part->name, part->size, part->offset); |
| 394 | |
| 395 | /* device */ |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 396 | current_mtd_dev->id = id; |
| 397 | INIT_LIST_HEAD(¤t_mtd_dev->link); |
| 398 | current_mtd_dev->num_parts = 1; |
| 399 | INIT_LIST_HEAD(¤t_mtd_dev->parts); |
| 400 | list_add(&part->link, ¤t_mtd_dev->parts); |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 401 | } |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 402 | |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 403 | return 0; |
| 404 | } |
Stefan Roese | b1423dd | 2009-03-19 13:30:36 +0100 | [diff] [blame] | 405 | #endif /* #ifndef CONFIG_CMD_MTDPARTS */ |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 406 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 407 | /** |
| 408 | * Return pointer to the partition of a requested number from a requested |
| 409 | * device. |
| 410 | * |
| 411 | * @param dev device that is to be searched for a partition |
| 412 | * @param part_num requested partition number |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 413 | * Return: pointer to the part_info, NULL otherwise |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 414 | */ |
| 415 | static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int part_num) |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 416 | { |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 417 | struct list_head *entry; |
| 418 | struct part_info *part; |
| 419 | int num; |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 420 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 421 | if (!dev) |
| 422 | return NULL; |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 423 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 424 | DEBUGF("\n--- jffs2_part_info: partition number %d for device %s%d (%s)\n", |
| 425 | part_num, MTD_DEV_TYPE(dev->id->type), |
| 426 | dev->id->num, dev->id->mtd_id); |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 427 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 428 | if (part_num >= dev->num_parts) { |
| 429 | printf("invalid partition number %d for device %s%d (%s)\n", |
| 430 | part_num, MTD_DEV_TYPE(dev->id->type), |
| 431 | dev->id->num, dev->id->mtd_id); |
| 432 | return NULL; |
| 433 | } |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 434 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 435 | /* locate partition number, return it */ |
| 436 | num = 0; |
| 437 | list_for_each(entry, &dev->parts) { |
| 438 | part = list_entry(entry, struct part_info, link); |
| 439 | |
| 440 | if (part_num == num++) { |
| 441 | return part; |
| 442 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 443 | } |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 444 | |
| 445 | return NULL; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 446 | } |
wdenk | 8886a66 | 2004-04-18 19:43:36 +0000 | [diff] [blame] | 447 | |
Michal Simek | 6ed8c71 | 2007-08-06 23:31:49 +0200 | [diff] [blame] | 448 | /***************************************************/ |
Bin Meng | 7557405 | 2016-02-05 19:30:11 -0800 | [diff] [blame] | 449 | /* U-Boot commands */ |
Michal Simek | 6ed8c71 | 2007-08-06 23:31:49 +0200 | [diff] [blame] | 450 | /***************************************************/ |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 451 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 452 | /** |
| 453 | * Routine implementing fsload u-boot command. This routine tries to load |
| 454 | * a requested file from jffs2/cramfs filesystem on a current partition. |
| 455 | * |
| 456 | * @param cmdtp command internal data |
| 457 | * @param flag command flag |
| 458 | * @param argc number of arguments supplied to the command |
| 459 | * @param argv arguments list |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 460 | * Return: 0 on success, 1 otherwise |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 461 | */ |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 462 | int do_jffs2_fsload(struct cmd_tbl *cmdtp, int flag, int argc, |
| 463 | char *const argv[]) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 464 | { |
wdenk | f2140d5 | 2004-07-01 16:30:44 +0000 | [diff] [blame] | 465 | char *fsname; |
wdenk | 3c71176 | 2004-06-09 13:37:52 +0000 | [diff] [blame] | 466 | char *filename; |
wdenk | f2140d5 | 2004-07-01 16:30:44 +0000 | [diff] [blame] | 467 | int size; |
| 468 | struct part_info *part; |
Simon Glass | 892265d | 2019-12-28 10:45:02 -0700 | [diff] [blame] | 469 | ulong offset = image_load_addr; |
wdenk | 3c71176 | 2004-06-09 13:37:52 +0000 | [diff] [blame] | 470 | |
| 471 | /* pre-set Boot file name */ |
Simon Glass | 64b723f | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 472 | filename = env_get("bootfile"); |
| 473 | if (!filename) |
wdenk | 3c71176 | 2004-06-09 13:37:52 +0000 | [diff] [blame] | 474 | filename = "uImage"; |
wdenk | 3c71176 | 2004-06-09 13:37:52 +0000 | [diff] [blame] | 475 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 476 | if (argc == 2) { |
| 477 | filename = argv[1]; |
| 478 | } |
| 479 | if (argc == 3) { |
Simon Glass | 3ff49ec | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 480 | offset = hextoul(argv[1], NULL); |
Simon Glass | 892265d | 2019-12-28 10:45:02 -0700 | [diff] [blame] | 481 | image_load_addr = offset; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 482 | filename = argv[2]; |
| 483 | } |
| 484 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 485 | /* make sure we are in sync with env variables */ |
| 486 | if (mtdparts_init() !=0) |
| 487 | return 1; |
| 488 | |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 489 | if ((part = jffs2_part_info(current_mtd_dev, current_mtd_partnum))){ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 490 | |
Michal Simek | 40277b3 | 2007-09-15 00:03:35 +0200 | [diff] [blame] | 491 | /* check partition type for cramfs */ |
| 492 | fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 493 | printf("### %s loading '%s' to 0x%lx\n", fsname, filename, offset); |
| 494 | |
| 495 | if (cramfs_check(part)) { |
| 496 | size = cramfs_load ((char *) offset, part, filename); |
| 497 | } else { |
Michal Simek | 40277b3 | 2007-09-15 00:03:35 +0200 | [diff] [blame] | 498 | /* if this is not cramfs assume jffs2 */ |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 499 | size = jffs2_1pass_load((char *)offset, part, filename); |
| 500 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 501 | |
| 502 | if (size > 0) { |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 503 | printf("### %s load complete: %d bytes loaded to 0x%lx\n", |
| 504 | fsname, size, offset); |
Simon Glass | 4d949a2 | 2017-08-03 12:22:10 -0600 | [diff] [blame] | 505 | env_set_hex("filesize", size); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 506 | } else { |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 507 | printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | return !(size > 0); |
| 511 | } |
Wolfgang Denk | 79117cd | 2005-08-16 09:32:45 +0200 | [diff] [blame] | 512 | return 1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 513 | } |
| 514 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 515 | /** |
| 516 | * Routine implementing u-boot ls command which lists content of a given |
| 517 | * directory on a current partition. |
| 518 | * |
| 519 | * @param cmdtp command internal data |
| 520 | * @param flag command flag |
| 521 | * @param argc number of arguments supplied to the command |
| 522 | * @param argv arguments list |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 523 | * Return: 0 on success, 1 otherwise |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 524 | */ |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 525 | int do_jffs2_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 526 | { |
wdenk | 8d414a7 | 2005-06-10 10:00:19 +0000 | [diff] [blame] | 527 | char *filename = "/"; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 528 | int ret; |
| 529 | struct part_info *part; |
| 530 | |
| 531 | if (argc == 2) |
| 532 | filename = argv[1]; |
| 533 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 534 | /* make sure we are in sync with env variables */ |
| 535 | if (mtdparts_init() !=0) |
| 536 | return 1; |
| 537 | |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 538 | if ((part = jffs2_part_info(current_mtd_dev, current_mtd_partnum))){ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 539 | |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 540 | /* check partition type for cramfs */ |
| 541 | if (cramfs_check(part)) { |
| 542 | ret = cramfs_ls (part, filename); |
| 543 | } else { |
Michal Simek | 40277b3 | 2007-09-15 00:03:35 +0200 | [diff] [blame] | 544 | /* if this is not cramfs assume jffs2 */ |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 545 | ret = jffs2_1pass_ls(part, filename); |
| 546 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 547 | |
Wolfgang Denk | 79117cd | 2005-08-16 09:32:45 +0200 | [diff] [blame] | 548 | return ret ? 0 : 1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 549 | } |
Wolfgang Denk | 79117cd | 2005-08-16 09:32:45 +0200 | [diff] [blame] | 550 | return 1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 551 | } |
| 552 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 553 | /** |
| 554 | * Routine implementing u-boot fsinfo command. This routine prints out |
| 555 | * miscellaneous filesystem informations/statistics. |
| 556 | * |
| 557 | * @param cmdtp command internal data |
| 558 | * @param flag command flag |
| 559 | * @param argc number of arguments supplied to the command |
| 560 | * @param argv arguments list |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 561 | * Return: 0 on success, 1 otherwise |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 562 | */ |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 563 | int do_jffs2_fsinfo(struct cmd_tbl *cmdtp, int flag, int argc, |
| 564 | char *const argv[]) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 565 | { |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 566 | struct part_info *part; |
Michal Simek | 40277b3 | 2007-09-15 00:03:35 +0200 | [diff] [blame] | 567 | char *fsname; |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 568 | int ret; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 569 | |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 570 | /* make sure we are in sync with env variables */ |
| 571 | if (mtdparts_init() !=0) |
| 572 | return 1; |
Wolfgang Denk | eb95c85 | 2005-08-10 15:14:32 +0200 | [diff] [blame] | 573 | |
Stefan Roese | 4fa1f2d | 2009-05-16 12:04:22 +0200 | [diff] [blame] | 574 | if ((part = jffs2_part_info(current_mtd_dev, current_mtd_partnum))){ |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 575 | |
| 576 | /* check partition type for cramfs */ |
Michal Simek | 40277b3 | 2007-09-15 00:03:35 +0200 | [diff] [blame] | 577 | fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); |
| 578 | printf("### filesystem type is %s\n", fsname); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 579 | |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 580 | if (cramfs_check(part)) { |
| 581 | ret = cramfs_info (part); |
| 582 | } else { |
Michal Simek | 40277b3 | 2007-09-15 00:03:35 +0200 | [diff] [blame] | 583 | /* if this is not cramfs assume jffs2 */ |
wdenk | ae65f50 | 2004-01-03 21:24:46 +0000 | [diff] [blame] | 584 | ret = jffs2_1pass_info(part); |
| 585 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 586 | |
Wolfgang Denk | 79117cd | 2005-08-16 09:32:45 +0200 | [diff] [blame] | 587 | return ret ? 0 : 1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 588 | } |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 589 | return 1; |
| 590 | } |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 591 | |
| 592 | /***************************************************/ |
wdenk | f287a24 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 593 | U_BOOT_CMD( |
| 594 | fsload, 3, 0, do_jffs2_fsload, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 595 | "load binary file from a filesystem image", |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 596 | "[ off ] [ filename ]\n" |
| 597 | " - load binary file from flash bank\n" |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 598 | " with offset 'off'" |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 599 | ); |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 600 | U_BOOT_CMD( |
Siva Durga Prasad Paladugu | b9a9afd | 2017-05-30 14:18:55 +0200 | [diff] [blame] | 601 | fsls, 2, 1, do_jffs2_ls, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 602 | "list files in a directory (default /)", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 603 | "[ directory ]" |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 604 | ); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 605 | |
wdenk | f287a24 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 606 | U_BOOT_CMD( |
| 607 | fsinfo, 1, 1, do_jffs2_fsinfo, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 608 | "print information about filesystems", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 609 | "" |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 610 | ); |
Wolfgang Denk | 47f5779 | 2005-08-08 01:03:24 +0200 | [diff] [blame] | 611 | /***************************************************/ |