blob: e146254f6d68367d8dc2650c409f24a1676362dd [file] [log] [blame]
Stephen Warren045fa1e2012-10-22 06:43:51 +00001/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Inspired by cmd_ext_common.c, cmd_fat.c.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <common.h>
20#include <command.h>
21#include <fs.h>
22
Stephen Warrencf659812014-06-11 12:47:26 -060023static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
24{
25 return do_size(cmdtp, flag, argc, argv, FS_TYPE_ANY);
26}
27
28U_BOOT_CMD(
29 size, 4, 0, do_size_wrapper,
30 "determine a file's size",
31 "<interface> <dev[:part]> <filename>\n"
32 " - Find file 'filename' from 'dev' on 'interface'\n"
33 " and determine its size."
34);
35
Jeroen Hofstee0e350f82014-06-23 00:22:08 +020036static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
37 char * const argv[])
Stephen Warren045fa1e2012-10-22 06:43:51 +000038{
Wolfgang Denkb770e882013-10-05 21:07:25 +020039 return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
Stephen Warren045fa1e2012-10-22 06:43:51 +000040}
41
42U_BOOT_CMD(
Stephen Warrenf9b55e22012-10-31 11:05:07 +000043 load, 7, 0, do_load_wrapper,
Stephen Warren045fa1e2012-10-22 06:43:51 +000044 "load binary file from a filesystem",
45 "<interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]\n"
46 " - Load binary file 'filename' from partition 'part' on device\n"
47 " type 'interface' instance 'dev' to address 'addr' in memory.\n"
48 " 'bytes' gives the size to load in bytes.\n"
49 " If 'bytes' is 0 or omitted, the file is read until the end.\n"
50 " 'pos' gives the file byte position to start reading from.\n"
Wolfgang Denkb770e882013-10-05 21:07:25 +020051 " If 'pos' is 0 or omitted, the file is read from the start."
Jeroen Hofstee0e350f82014-06-23 00:22:08 +020052)
Stephen Warren045fa1e2012-10-22 06:43:51 +000053
Suriyan Ramasamid455d872014-11-17 14:39:38 -080054static int do_save_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
55 char * const argv[])
56{
57 return do_save(cmdtp, flag, argc, argv, FS_TYPE_ANY);
58}
59
60U_BOOT_CMD(
61 save, 7, 0, do_save_wrapper,
62 "save file to a filesystem",
63 "<interface> <dev[:part]> <addr> <filename> bytes [pos]\n"
64 " - Save binary file 'filename' to partition 'part' on device\n"
65 " type 'interface' instance 'dev' from addr 'addr' in memory.\n"
66 " 'bytes' gives the size to save in bytes and is mandatory.\n"
67 " 'pos' gives the file byte position to start writing to.\n"
68 " If 'pos' is 0 or omitted, the file is written from the start."
69)
70
Jeroen Hofstee0e350f82014-06-23 00:22:08 +020071static int do_ls_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
72 char * const argv[])
Stephen Warren045fa1e2012-10-22 06:43:51 +000073{
74 return do_ls(cmdtp, flag, argc, argv, FS_TYPE_ANY);
75}
76
77U_BOOT_CMD(
78 ls, 4, 1, do_ls_wrapper,
79 "list files in a directory (default /)",
80 "<interface> [<dev[:part]> [directory]]\n"
81 " - List files in directory 'directory' of partition 'part' on\n"
82 " device type 'interface' instance 'dev'."
Jeroen Hofstee0e350f82014-06-23 00:22:08 +020083)
Sjoerd Simons1a1ad8e2015-01-05 18:13:36 +010084
85static int do_fstype_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
86 char * const argv[])
87{
88 return do_fs_type(cmdtp, flag, argc, argv);
89}
90
91U_BOOT_CMD(
92 fstype, 4, 1, do_fstype_wrapper,
93 "Look up a filesystem type",
94 "<interface> <dev>:<part>\n"
95 "- print filesystem type\n"
96 "fstype <interface> <dev>:<part> <varname>\n"
97 "- set environment variable to filesystem type\n"
98);