mirror of
https://github.com/ipxe/ipxe
synced 2025-12-09 02:40:27 +03:00
Added the embedded pxelinux payload patch from hpa.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <gpxe/netdevice.h>
|
||||
#include <gpxe/dhcp.h>
|
||||
#include <gpxe/image.h>
|
||||
#include <gpxe/embedded.h>
|
||||
#include <usr/ifmgmt.h>
|
||||
#include <usr/route.h>
|
||||
#include <usr/dhcpmgmt.h>
|
||||
@@ -45,6 +46,30 @@ 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 filename
|
||||
*
|
||||
@@ -115,6 +140,11 @@ 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 to download and boot whatever we are given as a filename */
|
||||
dhcp_snprintf ( buf, sizeof ( buf ),
|
||||
find_global_dhcp_option ( DHCP_BOOTFILE_NAME ) );
|
||||
|
||||
Reference in New Issue
Block a user