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 *argv[])
51 debug("Using volume %s\n", vol_name);
53 if (ubifs_initialized == 0) {
55 ubifs_initialized = 1;
58 ret = ubifs_mount(vol_name);
67 int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
73 printf("UBIFS not mounted, use ubifs mount to mount volume first!\n");
79 debug("Using filename %s\n", filename);
81 ret = ubifs_ls(filename);
83 printf("%s not found!\n", filename);
88 int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
96 printf("UBIFS not mounted, use ubifs mount to mount volume first!\n");
101 printf("Usage:\n%s\n", cmdtp->usage);
105 addr = simple_strtoul(argv[1], NULL, 16);
109 size = simple_strtoul(argv[3], NULL, 16);
110 debug("Loading file '%s' to address 0x%08x (size %d)\n", filename, addr, size);
112 ret = ubifs_load(filename, addr, size);
114 printf("%s not found!\n", filename);
120 ubifsmount, 2, 0, do_ubifs_mount,
121 "mount UBIFS volume",
125 U_BOOT_CMD(ubifsls, 2, 0, do_ubifs_ls,
126 "list files in a directory",
128 " - list files in a 'directory' (default '/')"
131 U_BOOT_CMD(ubifsload, 4, 0, do_ubifs_load,
132 "load file from an UBIFS filesystem",
133 "<addr> <filename> [bytes]\n"
134 " - load file 'filename' to address 'addr'"