2005-03-08 19:53:11 +01:00
|
|
|
/**************************************************************************
|
2007-07-04 00:09:56 +02:00
|
|
|
gPXE - Network Bootstrap Program
|
2005-03-08 19:53:11 +01:00
|
|
|
|
|
|
|
Literature dealing with the network protocols:
|
|
|
|
ARP - RFC826
|
|
|
|
RARP - RFC903
|
|
|
|
UDP - RFC768
|
|
|
|
BOOTP - RFC951, RFC2132 (vendor extensions)
|
|
|
|
DHCP - RFC2131, RFC2132 (options)
|
|
|
|
TFTP - RFC1350, RFC2347 (options), RFC2348 (blocksize), RFC2349 (tsize)
|
|
|
|
RPC - RFC1831, RFC1832 (XDR), RFC1833 (rpcbind/portmapper)
|
|
|
|
NFS - RFC1094, RFC1813 (v3, useful for clarifications, not implemented)
|
|
|
|
IGMP - RFC1112
|
|
|
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
2008-03-27 00:16:20 +01:00
|
|
|
#include <stdio.h>
|
2006-04-30 03:08:52 +02:00
|
|
|
#include <gpxe/init.h>
|
2008-03-27 00:16:20 +01:00
|
|
|
#include <gpxe/features.h>
|
2006-12-20 01:26:01 +01:00
|
|
|
#include <gpxe/shell.h>
|
|
|
|
#include <gpxe/shell_banner.h>
|
2009-02-16 01:28:30 +01:00
|
|
|
#include <gpxe/image.h>
|
2007-01-10 03:03:20 +01:00
|
|
|
#include <usr/autoboot.h>
|
2008-10-31 20:10:28 +01:00
|
|
|
#include <config/general.h>
|
2006-06-01 17:53:05 +02:00
|
|
|
|
2008-03-27 00:16:20 +01:00
|
|
|
#define NORMAL "\033[0m"
|
|
|
|
#define BOLD "\033[1m"
|
|
|
|
#define CYAN "\033[36m"
|
|
|
|
|
|
|
|
static struct feature features[0] __table_start ( struct feature, features );
|
|
|
|
static struct feature features_end[0] __table_end ( struct feature, features );
|
|
|
|
|
2007-01-14 01:16:41 +01:00
|
|
|
/**
|
|
|
|
* Main entry point
|
|
|
|
*
|
|
|
|
* @ret rc Return status code
|
|
|
|
*/
|
2008-11-19 01:18:32 +01:00
|
|
|
__asmcall int main ( void ) {
|
2008-03-27 00:16:20 +01:00
|
|
|
struct feature *feature;
|
2009-02-16 01:28:30 +01:00
|
|
|
struct image *image;
|
2005-03-08 19:53:11 +01:00
|
|
|
|
2009-01-08 04:48:30 +01:00
|
|
|
/* Some devices take an unreasonably long time to initialise */
|
|
|
|
printf ( PRODUCT_SHORT_NAME " initialising devices...\n" );
|
|
|
|
|
2007-07-04 00:09:56 +02:00
|
|
|
initialise();
|
2007-01-14 01:16:41 +01:00
|
|
|
startup();
|
2006-05-02 23:10:45 +02:00
|
|
|
|
2008-10-31 20:10:28 +01:00
|
|
|
/*
|
|
|
|
* Print welcome banner
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* If you wish to brand this build of gPXE, please do so by
|
|
|
|
* defining the string PRODUCT_NAME in config/general.h.
|
|
|
|
*
|
|
|
|
* While nothing in the GPL prevents you from removing all
|
|
|
|
* references to gPXE or http://etherboot.org, we prefer you
|
|
|
|
* not to do so.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "gPXE " VERSION
|
2008-03-27 00:16:20 +01:00
|
|
|
NORMAL " -- Open Source Boot Firmware -- "
|
|
|
|
CYAN "http://etherboot.org" NORMAL "\n"
|
|
|
|
"Features:" );
|
|
|
|
for ( feature = features ; feature < features_end ; feature++ )
|
|
|
|
printf ( " %s", feature->name );
|
|
|
|
printf ( "\n" );
|
|
|
|
|
|
|
|
/* Prompt for shell */
|
|
|
|
if ( shell_banner() ) {
|
|
|
|
/* User wants shell; just give them a shell */
|
2008-02-11 18:51:44 +01:00
|
|
|
shell();
|
2008-03-27 00:16:20 +01:00
|
|
|
} else {
|
2009-02-16 01:28:30 +01:00
|
|
|
/* User doesn't want shell; load and execute the first
|
2009-02-24 06:51:21 +01:00
|
|
|
* image, or autoboot() if we have no images. If
|
|
|
|
* booting fails for any reason, offer a second chance
|
|
|
|
* to enter the shell for diagnostics.
|
2008-03-27 00:16:20 +01:00
|
|
|
*/
|
2009-02-24 06:51:21 +01:00
|
|
|
if ( have_images() ) {
|
|
|
|
for_each_image ( image ) {
|
|
|
|
image_exec ( image );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
autoboot();
|
2009-02-16 01:28:30 +01:00
|
|
|
}
|
|
|
|
|
2008-03-27 00:16:20 +01:00
|
|
|
if ( shell_banner() )
|
|
|
|
shell();
|
|
|
|
}
|
|
|
|
|
2008-07-17 18:45:17 +02:00
|
|
|
shutdown ( SHUTDOWN_EXIT | shutdown_exit_flags );
|
2005-04-12 18:43:18 +02:00
|
|
|
|
2007-01-14 01:16:41 +01:00
|
|
|
return 0;
|
2005-03-08 19:53:11 +01:00
|
|
|
}
|