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