2
0
mirror of https://github.com/xcat2/xNBA.git synced 2025-04-15 01:29:26 +00:00
xNBA/src/include/ipxe/init.h
Michael Brown b2332d5118 [prefix] Allow iPXE's own command line to be executed as a script
Some prefixes (e.g. .lkrn) allow a command line to be passed in to
iPXE.  At present, this command line is ignored.

If a command line is provided, treat it as an embedded script (without
an explicit "#!ipxe" magic marker).  This allows for patterns of
invocation such as

  title  iPXE
  kernel /boot/ipxe.lkrn dhcp && \
         sanboot iscsi:10.0.4.1::::iqn.2010-04.org.ipxe.dolphin:storage

Here GRUB is instructed to load ipxe.lkrn with an embedded script
equivalent to

  #!ipxe
  dhcp
  sanboot iscsi:10.0.4.1::::iqn.2010-04.org.ipxe.dolphin:storage

This can be used to effectively vary the embedded script without
having to rebuild ipxe.lkrn.

Originally-implemented-by: Dave Hansen <dave@sr71.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07 22:28:31 +00:00

89 lines
2.0 KiB
C

#ifndef _IPXE_INIT_H
#define _IPXE_INIT_H
FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/tables.h>
/**
* An initialisation function
*
* Initialisation functions are called exactly once, as part of the
* call to initialise().
*/
struct init_fn {
void ( * initialise ) ( void );
};
/** Initialisation function table */
#define INIT_FNS __table ( struct init_fn, "init_fns" )
/** Declare an initialisation functon */
#define __init_fn( init_order ) __table_entry ( INIT_FNS, init_order )
/** @defgroup initfn_order Initialisation function ordering
* @{
*/
#define INIT_EARLY 01 /**< Early initialisation */
#define INIT_SERIAL 02 /**< Serial driver initialisation */
#define INIT_CONSOLE 03 /**< Console initialisation */
#define INIT_NORMAL 04 /**< Normal initialisation */
#define INIT_LATE 05 /**< Late initialisation */
/** @} */
/**
* A startup/shutdown function
*
* Startup and shutdown functions may be called multiple times, as
* part of the calls to startup() and shutdown().
*/
struct startup_fn {
void ( * startup ) ( void );
void ( * shutdown ) ( int booting );
};
/** Startup/shutdown function table */
#define STARTUP_FNS __table ( struct startup_fn, "startup_fns" )
/** Declare a startup/shutdown function */
#define __startup_fn( startup_order ) \
__table_entry ( STARTUP_FNS, startup_order )
/** @defgroup startfn_order Startup/shutdown function ordering
*
* Shutdown functions are called in the reverse order to startup
* functions.
*
* @{
*/
#define STARTUP_EARLY 01 /**< Early startup */
#define STARTUP_NORMAL 02 /**< Normal startup */
#define STARTUP_LATE 03 /**< Late startup */
/** @} */
extern void initialise ( void );
extern void startup ( void );
extern void shutdown ( int booting );
/**
* Shut down system for OS boot
*
*/
static inline void shutdown_boot ( void ) {
shutdown ( 1 );
}
/**
* Shut down system for exit back to firmware
*
*/
static inline void shutdown_exit ( void ) {
shutdown ( 0 );
}
#endif /* _IPXE_INIT_H */