cmd_sandbox.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2012, Google Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of
  7. * the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  17. * MA 02111-1307 USA
  18. */
  19. #include <common.h>
  20. #include <fs.h>
  21. static int do_sandbox_load(cmd_tbl_t *cmdtp, int flag, int argc,
  22. char * const argv[])
  23. {
  24. return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
  25. }
  26. static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int argc,
  27. char * const argv[])
  28. {
  29. return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
  30. }
  31. static cmd_tbl_t cmd_sandbox_sub[] = {
  32. U_BOOT_CMD_MKENT(load, 3, 0, do_sandbox_load, "", ""),
  33. U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
  34. };
  35. static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
  36. char * const argv[])
  37. {
  38. cmd_tbl_t *c;
  39. /* Skip past 'sandbox' */
  40. argc--;
  41. argv++;
  42. c = find_cmd_tbl(argv[0], cmd_sandbox_sub,
  43. ARRAY_SIZE(cmd_sandbox_sub));
  44. if (c)
  45. return c->cmd(cmdtp, flag, argc, argv);
  46. else
  47. return CMD_RET_USAGE;
  48. }
  49. U_BOOT_CMD(
  50. sb, 6, 1, do_sandbox,
  51. "Miscellaneous sandbox commands",
  52. "load host <addr> <filename> [<bytes> <offset>] - load a file from host\n"
  53. "sb ls host <filename> - save a file to host"
  54. );