Start a new LOG file in preparation for release
[gpxe.git] / src / core / main.c
blob64e098ca32743325290fcd7c63f098602f41c203
1 /**************************************************************************
2 Etherboot - Network Bootstrap Program
4 Literature dealing with the network protocols:
5 ARP - RFC826
6 RARP - RFC903
7 UDP - RFC768
8 BOOTP - RFC951, RFC2132 (vendor extensions)
9 DHCP - RFC2131, RFC2132 (options)
10 TFTP - RFC1350, RFC2347 (options), RFC2348 (blocksize), RFC2349 (tsize)
11 RPC - RFC1831, RFC1832 (XDR), RFC1833 (rpcbind/portmapper)
12 NFS - RFC1094, RFC1813 (v3, useful for clarifications, not implemented)
13 IGMP - RFC1112
15 **************************************************************************/
17 #include <gpxe/heap.h>
18 #include <gpxe/init.h>
19 #include <gpxe/device.h>
20 #include <gpxe/shell.h>
21 #include <gpxe/shell_banner.h>
22 #include <gpxe/shutdown.h>
23 #include <gpxe/hidemem.h>
24 #include <usr/autoboot.h>
26 /**
27 * Start up Etherboot
29 * Call this function only once, before doing (almost) anything else.
31 static void startup ( void ) {
32 hide_etherboot();
33 init_heap();
34 call_init_fns();
35 probe_devices();
38 /**
39 * Shut down Etherboot
41 * Call this function only once, before either exiting main() or
42 * starting up a non-returnable image.
44 void shutdown ( void ) {
45 remove_devices();
46 call_exit_fns();
47 unhide_etherboot();
50 /**
51 * Main entry point
53 * @ret rc Return status code
55 int main ( void ) {
57 startup();
59 /* Try autobooting if we're not going straight to the shell */
60 if ( ! shell_banner() ) {
61 autoboot();
64 /* Autobooting failed or the user wanted the shell */
65 shell();
67 shutdown();
69 return 0;