]>
Commit | Line | Data |
---|---|---|
045fa1e1 SW |
1 | /* |
2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | |
3 | * | |
4 | * Inspired by cmd_ext_common.c, cmd_fat.c. | |
5 | * | |
5b8031cc | 6 | * SPDX-License-Identifier: GPL-2.0 |
045fa1e1 SW |
7 | */ |
8 | ||
9 | #include <common.h> | |
10 | #include <command.h> | |
11 | #include <fs.h> | |
12 | ||
cf659819 SW |
13 | static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
14 | { | |
15 | return do_size(cmdtp, flag, argc, argv, FS_TYPE_ANY); | |
16 | } | |
17 | ||
18 | U_BOOT_CMD( | |
19 | size, 4, 0, do_size_wrapper, | |
20 | "determine a file's size", | |
21 | "<interface> <dev[:part]> <filename>\n" | |
22 | " - Find file 'filename' from 'dev' on 'interface'\n" | |
23 | " and determine its size." | |
24 | ); | |
25 | ||
0e350f81 JH |
26 | static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, |
27 | char * const argv[]) | |
045fa1e1 | 28 | { |
b770e88a | 29 | return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY); |
045fa1e1 SW |
30 | } |
31 | ||
32 | U_BOOT_CMD( | |
f9b55e22 | 33 | load, 7, 0, do_load_wrapper, |
045fa1e1 SW |
34 | "load binary file from a filesystem", |
35 | "<interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]\n" | |
36 | " - Load binary file 'filename' from partition 'part' on device\n" | |
37 | " type 'interface' instance 'dev' to address 'addr' in memory.\n" | |
38 | " 'bytes' gives the size to load in bytes.\n" | |
39 | " If 'bytes' is 0 or omitted, the file is read until the end.\n" | |
40 | " 'pos' gives the file byte position to start reading from.\n" | |
b770e88a | 41 | " If 'pos' is 0 or omitted, the file is read from the start." |
0e350f81 | 42 | ) |
045fa1e1 | 43 | |
d455d878 SR |
44 | static int do_save_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, |
45 | char * const argv[]) | |
46 | { | |
47 | return do_save(cmdtp, flag, argc, argv, FS_TYPE_ANY); | |
48 | } | |
49 | ||
50 | U_BOOT_CMD( | |
51 | save, 7, 0, do_save_wrapper, | |
52 | "save file to a filesystem", | |
53 | "<interface> <dev[:part]> <addr> <filename> bytes [pos]\n" | |
54 | " - Save binary file 'filename' to partition 'part' on device\n" | |
55 | " type 'interface' instance 'dev' from addr 'addr' in memory.\n" | |
56 | " 'bytes' gives the size to save in bytes and is mandatory.\n" | |
57 | " 'pos' gives the file byte position to start writing to.\n" | |
58 | " If 'pos' is 0 or omitted, the file is written from the start." | |
59 | ) | |
60 | ||
0e350f81 JH |
61 | static int do_ls_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, |
62 | char * const argv[]) | |
045fa1e1 SW |
63 | { |
64 | return do_ls(cmdtp, flag, argc, argv, FS_TYPE_ANY); | |
65 | } | |
66 | ||
67 | U_BOOT_CMD( | |
68 | ls, 4, 1, do_ls_wrapper, | |
69 | "list files in a directory (default /)", | |
70 | "<interface> [<dev[:part]> [directory]]\n" | |
71 | " - List files in directory 'directory' of partition 'part' on\n" | |
72 | " device type 'interface' instance 'dev'." | |
0e350f81 | 73 | ) |
1a1ad8e0 SS |
74 | |
75 | static int do_fstype_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, | |
76 | char * const argv[]) | |
77 | { | |
78 | return do_fs_type(cmdtp, flag, argc, argv); | |
79 | } | |
80 | ||
81 | U_BOOT_CMD( | |
82 | fstype, 4, 1, do_fstype_wrapper, | |
83 | "Look up a filesystem type", | |
84 | "<interface> <dev>:<part>\n" | |
85 | "- print filesystem type\n" | |
86 | "fstype <interface> <dev>:<part> <varname>\n" | |
87 | "- set environment variable to filesystem type\n" | |
88 | ); |