You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

autoboot_cmd.c 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
  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 the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * 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., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. */
  19. #include <stdio.h>
  20. #include <getopt.h>
  21. #include <ipxe/command.h>
  22. #include <ipxe/parseopt.h>
  23. #include <ipxe/netdevice.h>
  24. #include <hci/ifmgmt_cmd.h>
  25. #include <usr/autoboot.h>
  26. FILE_LICENCE ( GPL2_OR_LATER );
  27. /** @file
  28. *
  29. * Booting commands
  30. *
  31. */
  32. /** "autoboot" options */
  33. struct autoboot_options {};
  34. /** "autoboot" option list */
  35. static struct option_descriptor autoboot_opts[] = {};
  36. /**
  37. * "autoboot" payload
  38. *
  39. * @v netdev Network device
  40. * @v opts Command options
  41. * @ret rc Return status code
  42. */
  43. static int autoboot_payload ( struct net_device *netdev,
  44. struct autoboot_options *opts __unused ) {
  45. return netboot ( netdev );
  46. }
  47. /** "autoboot" command descriptor */
  48. static struct ifcommon_command_descriptor autoboot_cmd =
  49. IFCOMMON_COMMAND_DESC ( struct autoboot_options, autoboot_opts,
  50. 0, MAX_ARGUMENTS, "[<interface>...]",
  51. autoboot_payload, 0 );
  52. /**
  53. * "autoboot" command
  54. *
  55. * @v argc Argument count
  56. * @v argv Argument list
  57. * @ret rc Return status code
  58. */
  59. static int autoboot_exec ( int argc, char **argv ) {
  60. return ifcommon_exec ( argc, argv, &autoboot_cmd );
  61. }
  62. /** Booting commands */
  63. struct command autoboot_commands[] __command = {
  64. {
  65. .name = "autoboot",
  66. .exec = autoboot_exec,
  67. },
  68. };