Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

main.c 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**************************************************************************
  2. iPXE - 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. **************************************************************************/
  12. FILE_LICENCE ( GPL2_OR_LATER );
  13. #include <stdio.h>
  14. #include <ipxe/init.h>
  15. #include <ipxe/features.h>
  16. #include <ipxe/shell.h>
  17. #include <ipxe/shell_banner.h>
  18. #include <ipxe/image.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. /**
  25. * Main entry point
  26. *
  27. * @ret rc Return status code
  28. */
  29. __asmcall int main ( void ) {
  30. struct feature *feature;
  31. struct image *image;
  32. /* Some devices take an unreasonably long time to initialise */
  33. printf ( PRODUCT_SHORT_NAME " initialising devices..." );
  34. initialise();
  35. startup();
  36. printf ( "ok\n" );
  37. /*
  38. * Print welcome banner
  39. *
  40. *
  41. * If you wish to brand this build of iPXE, please do so by
  42. * defining the string PRODUCT_NAME in config/general.h.
  43. *
  44. * While nothing in the GPL prevents you from removing all
  45. * references to iPXE or http://ipxe.org, we prefer you not to
  46. * do so.
  47. *
  48. */
  49. printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE " VERSION
  50. NORMAL " -- Open Source Network Boot Firmware -- "
  51. CYAN "http://ipxe.org" NORMAL "\n"
  52. "Features:" );
  53. for_each_table_entry ( feature, FEATURES )
  54. printf ( " %s", feature->name );
  55. printf ( "\n" );
  56. /* Prompt for shell */
  57. if ( shell_banner() ) {
  58. /* User wants shell; just give them a shell */
  59. shell();
  60. } else {
  61. /* User doesn't want shell; load and execute the first
  62. * image, or autoboot() if we have no images. If
  63. * booting fails for any reason, offer a second chance
  64. * to enter the shell for diagnostics.
  65. */
  66. if ( have_images() ) {
  67. for_each_image ( image ) {
  68. image_exec ( image );
  69. break;
  70. }
  71. } else {
  72. autoboot();
  73. }
  74. if ( shell_banner() )
  75. shell();
  76. }
  77. shutdown_exit();
  78. return 0;
  79. }