3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * UBIFS command support
36 static int ubifs_initialized;
37 static int ubifs_mounted;
41 int ubifs_mount(char *vol_name);
42 int ubifs_ls(char *dir_name);
43 int ubifs_load(char *filename, u32 addr, u32 size);
45 int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
51 return cmd_usage(cmdtp);
54 debug("Using volume %s\n", vol_name);
56 if (ubifs_initialized == 0) {
58 ubifs_initialized = 1;
61 ret = ubifs_mount(vol_name);
70 int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
76 printf("UBIFS not mounted, use ubifs mount to mount volume first!\n");
82 debug("Using filename %s\n", filename);
84 ret = ubifs_ls(filename);
86 printf("%s not found!\n", filename);
91 int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
100 printf("UBIFS not mounted, use ubifs mount to mount volume first!\n");
105 return cmd_usage(cmdtp);
107 addr = simple_strtoul(argv[1], &endp, 16);
109 return cmd_usage(cmdtp);
114 size = simple_strtoul(argv[3], &endp, 16);
116 return cmd_usage(cmdtp);
118 debug("Loading file '%s' to address 0x%08x (size %d)\n", filename, addr, size);
120 ret = ubifs_load(filename, addr, size);
122 printf("%s not found!\n", filename);
128 ubifsmount, 2, 0, do_ubifs_mount,
129 "mount UBIFS volume",
131 " - mount 'volume-name' volume"
135 ubifsls, 2, 0, do_ubifs_ls,
136 "list files in a directory",
138 " - list files in a 'directory' (default '/')"
142 ubifsload, 4, 0, do_ubifs_load,
143 "load file from an UBIFS filesystem",
144 "<addr> <filename> [bytes]\n"
145 " - load file 'filename' to address 'addr'"