]> git.ipfire.org Git - people/ms/u-boot.git/blame - cmd/fs.c
Merge branch 'master' of git://git.denx.de/u-boot-socfpga
[people/ms/u-boot.git] / cmd / fs.c
CommitLineData
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>
0f4060eb 12#include <efi_loader.h>
045fa1e1 13
cf659819
SW
14static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
15{
16 return do_size(cmdtp, flag, argc, argv, FS_TYPE_ANY);
17}
18
19U_BOOT_CMD(
20 size, 4, 0, do_size_wrapper,
21 "determine a file's size",
22 "<interface> <dev[:part]> <filename>\n"
23 " - Find file 'filename' from 'dev' on 'interface'\n"
24 " and determine its size."
25);
26
0e350f81
JH
27static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
28 char * const argv[])
045fa1e1 29{
0f4060eb 30 efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "");
b770e88a 31 return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
045fa1e1
SW
32}
33
34U_BOOT_CMD(
f9b55e22 35 load, 7, 0, do_load_wrapper,
045fa1e1
SW
36 "load binary file from a filesystem",
37 "<interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]\n"
38 " - Load binary file 'filename' from partition 'part' on device\n"
39 " type 'interface' instance 'dev' to address 'addr' in memory.\n"
40 " 'bytes' gives the size to load in bytes.\n"
41 " If 'bytes' is 0 or omitted, the file is read until the end.\n"
42 " 'pos' gives the file byte position to start reading from.\n"
b770e88a 43 " If 'pos' is 0 or omitted, the file is read from the start."
0e350f81 44)
045fa1e1 45
d455d878
SR
46static int do_save_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
47 char * const argv[])
48{
49 return do_save(cmdtp, flag, argc, argv, FS_TYPE_ANY);
50}
51
52U_BOOT_CMD(
53 save, 7, 0, do_save_wrapper,
54 "save file to a filesystem",
55 "<interface> <dev[:part]> <addr> <filename> bytes [pos]\n"
56 " - Save binary file 'filename' to partition 'part' on device\n"
57 " type 'interface' instance 'dev' from addr 'addr' in memory.\n"
58 " 'bytes' gives the size to save in bytes and is mandatory.\n"
59 " 'pos' gives the file byte position to start writing to.\n"
60 " If 'pos' is 0 or omitted, the file is written from the start."
61)
62
0e350f81
JH
63static int do_ls_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
64 char * const argv[])
045fa1e1
SW
65{
66 return do_ls(cmdtp, flag, argc, argv, FS_TYPE_ANY);
67}
68
69U_BOOT_CMD(
70 ls, 4, 1, do_ls_wrapper,
71 "list files in a directory (default /)",
72 "<interface> [<dev[:part]> [directory]]\n"
73 " - List files in directory 'directory' of partition 'part' on\n"
74 " device type 'interface' instance 'dev'."
0e350f81 75)
1a1ad8e0
SS
76
77static int do_fstype_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
78 char * const argv[])
79{
80 return do_fs_type(cmdtp, flag, argc, argv);
81}
82
83U_BOOT_CMD(
84 fstype, 4, 1, do_fstype_wrapper,
85 "Look up a filesystem type",
86 "<interface> <dev>:<part>\n"
87 "- print filesystem type\n"
88 "fstype <interface> <dev>:<part> <varname>\n"
89 "- set environment variable to filesystem type\n"
90);