mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 19:49:45 +03:00
[image] Allow multiple embedded images
This patch extends the embedded image feature to allow multiple embedded images instead of just one. gPXE now always boots the first embedded image on startup instead of doing the hardcoded DHCP boot (aka autoboot). Based heavily upon a patch by Stefan Hajnoczi <stefanha@gmail.com>.
This commit is contained in:
@@ -218,3 +218,4 @@ REQUIRE_OBJECT ( gdbstub_cmd );
|
||||
*
|
||||
*/
|
||||
REQUIRE_OBJECT ( device );
|
||||
REQUIRE_OBJECT ( embedded );
|
||||
|
||||
@@ -19,6 +19,7 @@ Literature dealing with the network protocols:
|
||||
#include <gpxe/features.h>
|
||||
#include <gpxe/shell.h>
|
||||
#include <gpxe/shell_banner.h>
|
||||
#include <gpxe/image.h>
|
||||
#include <usr/autoboot.h>
|
||||
#include <config/general.h>
|
||||
|
||||
@@ -36,6 +37,7 @@ static struct feature features_end[0] __table_end ( struct feature, features );
|
||||
*/
|
||||
__asmcall int main ( void ) {
|
||||
struct feature *feature;
|
||||
struct image *image;
|
||||
|
||||
/* Some devices take an unreasonably long time to initialise */
|
||||
printf ( PRODUCT_SHORT_NAME " initialising devices...\n" );
|
||||
@@ -68,11 +70,16 @@ __asmcall int main ( void ) {
|
||||
/* User wants shell; just give them a shell */
|
||||
shell();
|
||||
} else {
|
||||
/* User doesn't want shell; try booting. If booting
|
||||
* fails, offer a second chance to enter the shell for
|
||||
* diagnostics.
|
||||
/* User doesn't want shell; load and execute the first
|
||||
* image. If booting fails (i.e. if the image
|
||||
* returns, or fails to execute), offer a second
|
||||
* chance to enter the shell for diagnostics.
|
||||
*/
|
||||
autoboot();
|
||||
for_each_image ( image ) {
|
||||
image_exec ( image );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( shell_banner() )
|
||||
shell();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user