summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/usr/autoboot.c
diff options
context:
space:
mode:
authorJosé Pekkarinen <jose.pekkarinen@nokia.com>2016-05-18 13:18:31 +0300
committerJosé Pekkarinen <jose.pekkarinen@nokia.com>2016-05-18 13:42:15 +0300
commit437fd90c0250dee670290f9b714253671a990160 (patch)
treeb871786c360704244a07411c69fb58da9ead4a06 /qemu/roms/ipxe/src/usr/autoboot.c
parent5bbd6fe9b8bab2a93e548c5a53b032d1939eec05 (diff)
These changes are the raw update to qemu-2.6.
Collission happened in the following patches: migration: do cleanup operation after completion(738df5b9) Bug fix.(1750c932f86) kvmclock: add a new function to update env->tsc.(b52baab2) The code provided by the patches was already in the upstreamed version. Change-Id: I3cc11841a6a76ae20887b2e245710199e1ea7f9a Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'qemu/roms/ipxe/src/usr/autoboot.c')
-rw-r--r--qemu/roms/ipxe/src/usr/autoboot.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/qemu/roms/ipxe/src/usr/autoboot.c b/qemu/roms/ipxe/src/usr/autoboot.c
index 47476ae40..912543828 100644
--- a/qemu/roms/ipxe/src/usr/autoboot.c
+++ b/qemu/roms/ipxe/src/usr/autoboot.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <stdio.h>
@@ -42,6 +46,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <usr/prompt.h>
#include <usr/autoboot.h>
#include <config/general.h>
+#include <config/branding.h>
/** @file
*
@@ -101,7 +106,7 @@ static struct uri * parse_next_server_and_filename ( struct in_addr next_server,
/* Construct a TFTP URI for the filename, if applicable */
if ( next_server.s_addr && filename[0] && ! uri_is_absolute ( uri ) ) {
uri_put ( uri );
- uri = tftp_uri ( next_server, filename );
+ uri = tftp_uri ( next_server, 0, filename );
if ( ! uri )
return NULL;
}
@@ -173,6 +178,7 @@ int uriboot ( struct uri *filename, struct uri *root_path, int drive,
if ( filename ) {
if ( ( rc = imgdownload ( filename, 0, &image ) ) != 0 )
goto err_download;
+ imgstat ( image );
image->flags |= IMAGE_AUTO_UNREGISTER;
if ( ( rc = image_exec ( image ) ) != 0 ) {
printf ( "Could not boot image: %s\n",
@@ -434,9 +440,14 @@ int netboot ( struct net_device *netdev ) {
* @ret is_autoboot Network device matches the autoboot device
*/
static int is_autoboot_busloc ( struct net_device *netdev ) {
+ struct device *dev;
- return ( ( netdev->dev->desc.bus_type == autoboot_desc.bus_type ) &&
- ( netdev->dev->desc.location == autoboot_desc.location ) );
+ for ( dev = netdev->dev ; dev ; dev = dev->parent ) {
+ if ( ( dev->desc.bus_type == autoboot_desc.bus_type ) &&
+ ( dev->desc.location == autoboot_desc.location ) )
+ return 1;
+ }
+ return 0;
}
/**
@@ -522,7 +533,8 @@ static int shell_banner ( void ) {
/* Prompt user */
printf ( "\n" );
- return ( prompt ( "Press Ctrl-B for the iPXE command line...",
+ return ( prompt ( "Press Ctrl-B for the " PRODUCT_SHORT_NAME
+ " command line...",
( ( BANNER_TIMEOUT * TICKS_PER_SEC ) / 10 ),
CTRL_B ) == 0 );
}
@@ -531,28 +543,29 @@ static int shell_banner ( void ) {
* Main iPXE flow of execution
*
* @v netdev Network device, or NULL
+ * @ret rc Return status code
*/
-void ipxe ( struct net_device *netdev ) {
+int ipxe ( struct net_device *netdev ) {
struct feature *feature;
struct image *image;
char *scriptlet;
+ int rc;
/*
* Print welcome banner
*
*
* If you wish to brand this build of iPXE, please do so by
- * defining the string PRODUCT_NAME in config/general.h.
+ * defining the string PRODUCT_NAME in config/branding.h.
*
* While nothing in the GPL prevents you from removing all
* references to iPXE or http://ipxe.org, we prefer you not to
* do so.
*
*/
- printf ( NORMAL "\n\n%s\n" BOLD "iPXE %s"
- NORMAL " -- Open Source Network Boot Firmware -- "
- CYAN "http://ipxe.org" NORMAL "\n"
- "Features:", product_name, product_version );
+ printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME " %s"
+ NORMAL " -- " PRODUCT_TAG_LINE " -- "
+ CYAN PRODUCT_URI NORMAL "\nFeatures:", product_version );
for_each_table_entry ( feature, FEATURES )
printf ( " %s", feature->name );
printf ( "\n" );
@@ -560,28 +573,30 @@ void ipxe ( struct net_device *netdev ) {
/* Boot system */
if ( ( image = first_image() ) != NULL ) {
/* We have an embedded image; execute it */
- image_exec ( image );
+ return image_exec ( image );
} else if ( shell_banner() ) {
/* User wants shell; just give them a shell */
- shell();
+ return shell();
} else {
fetch_string_setting_copy ( NULL, &scriptlet_setting,
&scriptlet );
if ( scriptlet ) {
/* User has defined a scriptlet; execute it */
- system ( scriptlet );
+ rc = system ( scriptlet );
free ( scriptlet );
+ return rc;
} else {
/* Try booting. If booting fails, offer the
* user another chance to enter the shell.
*/
if ( netdev ) {
- netboot ( netdev );
+ rc = netboot ( netdev );
} else {
- autoboot();
+ rc = autoboot();
}
if ( shell_banner() )
- shell();
+ rc = shell();
+ return rc;
}
}
}