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