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 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #define NORMAL "\033[0m"
  21. #define BOLD "\033[1m"
  22. #define CYAN "\033[36m"
  23. static struct feature features[0] __table_start ( struct feature, features );
  24. static struct feature features_end[0] __table_end ( struct feature, features );
  25. /**
  26. * Main entry point
  27. *
  28. * @ret rc Return status code
  29. */
  30. __cdecl int main ( void ) {
  31. struct feature *feature;
  32. initialise();
  33. startup();
  34. /* Print welcome banner */
  35. printf ( NORMAL "\n\n\n" BOLD "gPXE " VERSION
  36. NORMAL " -- Open Source Boot Firmware -- "
  37. CYAN "http://etherboot.org" NORMAL "\n"
  38. "Features:" );
  39. for ( feature = features ; feature < features_end ; feature++ )
  40. printf ( " %s", feature->name );
  41. printf ( "\n" );
  42. /* Prompt for shell */
  43. if ( shell_banner() ) {
  44. /* User wants shell; just give them a shell */
  45. shell();
  46. } else {
  47. /* User doesn't want shell; try booting. If booting
  48. * fails, offer a second chance to enter the shell for
  49. * diagnostics.
  50. */
  51. autoboot();
  52. if ( shell_banner() )
  53. shell();
  54. }
  55. shutdown ( SHUTDOWN_EXIT | shutdown_exit_flags );
  56. return 0;
  57. }