]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_ubifs.c
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
[])
55 debug("Using volume %s\n", vol_name
);
57 if (ubifs_initialized
== 0) {
59 ubifs_initialized
= 1;
62 ret
= ubifs_mount(vol_name
);
71 int do_ubifs_ls(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
77 printf("UBIFS not mounted, use ubifs mount to mount volume first!\n");
83 debug("Using filename %s\n", filename
);
85 ret
= ubifs_ls(filename
);
87 printf("%s not found!\n", filename
);
92 int do_ubifs_load(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
100 if (!ubifs_mounted
) {
101 printf("UBIFS not mounted, use ubifs mount to mount volume first!\n");
110 addr
= simple_strtoul(argv
[1], &endp
, 16);
111 if (endp
== argv
[1]) {
119 size
= simple_strtoul(argv
[3], &endp
, 16);
120 if (endp
== argv
[3]) {
125 debug("Loading file '%s' to address 0x%08x (size %d)\n", filename
, addr
, size
);
127 ret
= ubifs_load(filename
, addr
, size
);
129 printf("%s not found!\n", filename
);
135 ubifsmount
, 2, 0, do_ubifs_mount
,
136 "mount UBIFS volume",
138 " - mount 'volume-name' volume"
141 U_BOOT_CMD(ubifsls
, 2, 0, do_ubifs_ls
,
142 "list files in a directory",
144 " - list files in a 'directory' (default '/')"
147 U_BOOT_CMD(ubifsload
, 4, 0, do_ubifs_load
,
148 "load file from an UBIFS filesystem",
149 "<addr> <filename> [bytes]\n"
150 " - load file 'filename' to address 'addr'"