[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:
Michael Brown
2009-02-16 00:28:30 +00:00
parent f16668dd60
commit 076154a1c6
12 changed files with 146 additions and 99 deletions

View File

@@ -23,7 +23,6 @@
#include <gpxe/dhcp.h>
#include <gpxe/settings.h>
#include <gpxe/image.h>
#include <gpxe/embedded.h>
#include <gpxe/sanboot.h>
#include <gpxe/uri.h>
#include <usr/ifmgmt.h>
@@ -59,30 +58,6 @@ static struct net_device * find_boot_netdev ( void ) {
return NULL;
}
/**
* Boot embedded image
*
* @ret rc Return status code
*/
static int boot_embedded_image ( void ) {
struct image *image;
int rc;
image = embedded_image();
if ( !image )
return ENOENT;
if ( ( rc = imgload ( image ) ) != 0 ) {
printf ( "Could not load embedded image: %s\n",
strerror ( rc ) );
} else if ( ( rc = imgexec ( image ) ) != 0 ) {
printf ( "Could not boot embedded image: %s\n",
strerror ( rc ) );
}
image_put ( image );
return rc;
}
/**
* Boot using next-server and filename
*
@@ -196,11 +171,6 @@ static int netboot ( struct net_device *netdev ) {
return rc;
route();
/* Try to boot an embedded image if we have one */
rc = boot_embedded_image ();
if ( rc != ENOENT )
return rc;
/* Try PXE menu boot, if applicable */
fetch_string_setting ( NULL, &vendor_class_id_setting,
buf, sizeof ( buf ) );