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.

main.c 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**************************************************************************
  2. gPXE - Network Bootstrap Program
  3. Literature dealing with the network protocols:
  4. ARP - RFC826
  5. RARP - RFC903
  6. UDP - RFC768
  7. BOOTP - RFC951, RFC2132 (vendor extensions)
  8. DHCP - RFC2131, RFC2132 (options)
  9. TFTP - RFC1350, RFC2347 (options), RFC2348 (blocksize), RFC2349 (tsize)
  10. RPC - RFC1831, RFC1832 (XDR), RFC1833 (rpcbind/portmapper)
  11. NFS - RFC1094, RFC1813 (v3, useful for clarifications, not implemented)
  12. IGMP - RFC1112
  13. **************************************************************************/
  14. #include <stdio.h>
  15. #include <gpxe/init.h>
  16. #include <gpxe/features.h>
  17. #include <gpxe/shell.h>
  18. #include <gpxe/shell_banner.h>
  19. #include <usr/autoboot.h>
  20. #include <config/general.h>
  21. #define NORMAL "\033[0m"
  22. #define BOLD "\033[1m"
  23. #define CYAN "\033[36m"
  24. static struct feature features[0] __table_start ( struct feature, features );
  25. static struct feature features_end[0] __table_end ( struct feature, features );
  26. /**
  27. * Main entry point
  28. *
  29. * @ret rc Return status code
  30. */
  31. __asmcall int main ( void ) {
  32. struct feature *feature;
  33. initialise();
  34. startup();
  35. /*
  36. * Print welcome banner
  37. *
  38. *
  39. * If you wish to brand this build of gPXE, please do so by
  40. * defining the string PRODUCT_NAME in config/general.h.
  41. *
  42. * While nothing in the GPL prevents you from removing all
  43. * references to gPXE or http://etherboot.org, we prefer you
  44. * not to do so.
  45. *
  46. */
  47. printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "gPXE " VERSION
  48. NORMAL " -- Open Source Boot Firmware -- "
  49. CYAN "http://etherboot.org" NORMAL "\n"
  50. "Features:" );
  51. for ( feature = features ; feature < features_end ; feature++ )
  52. printf ( " %s", feature->name );
  53. printf ( "\n" );
  54. /* Prompt for shell */
  55. if ( shell_banner() ) {
  56. /* User wants shell; just give them a shell */
  57. shell();
  58. } else {
  59. /* User doesn't want shell; try booting. If booting
  60. * fails, offer a second chance to enter the shell for
  61. * diagnostics.
  62. */
  63. autoboot();
  64. if ( shell_banner() )
  65. shell();
  66. }
  67. shutdown ( SHUTDOWN_EXIT | shutdown_exit_flags );
  68. return 0;
  69. }