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.

shell_banner.c 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2006 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., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #include <stdio.h>
  19. #include <console.h>
  20. #include <latch.h>
  21. #include <gpxe/features.h>
  22. #include <gpxe/shell_banner.h>
  23. /** @file
  24. *
  25. * Shell startup banner
  26. *
  27. */
  28. #define BANNER_TIMEOUT ( 2 * TICKS_PER_SEC )
  29. #define NORMAL "\033[0m"
  30. #define BOLD "\033[1m"
  31. #define CYAN "\033[36m"
  32. static struct feature features[0] __table_start ( struct feature, features );
  33. static struct feature features_end[0] __table_end ( struct feature, features );
  34. /**
  35. * Print shell banner and prompt for shell entry
  36. *
  37. * @ret enter_shell User wants to enter shell
  38. */
  39. int shell_banner ( void ) {
  40. unsigned long timeout = ( currticks() + BANNER_TIMEOUT );
  41. struct feature *feature;
  42. int key;
  43. int enter_shell = 0;
  44. /* Print welcome banner */
  45. printf ( NORMAL "\n\n\n" BOLD "gPXE " VERSION
  46. NORMAL " -- Open Source Boot Firmware -- "
  47. CYAN "http://etherboot.org" NORMAL "\n"
  48. "Features:" );
  49. for ( feature = features ; feature < features_end ; feature++ ) {
  50. printf ( " %s", feature->name );
  51. }
  52. printf ( "\nPress Ctrl-B for the gPXE command line..." );
  53. /* Wait for key */
  54. while ( currticks() < timeout ) {
  55. if ( iskey() ) {
  56. key = getchar();
  57. if ( key == 0x02 /* Ctrl-B */ )
  58. enter_shell = 1;
  59. break;
  60. }
  61. }
  62. /* Clear the "Press Ctrl-B" line */
  63. printf ( "\r \r" );
  64. return enter_shell;
  65. }