aboutsummaryrefslogtreecommitdiff
path: root/src/usr/autoboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/autoboot.c')
-rw-r--r--src/usr/autoboot.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index f5f7f7d..41f1341 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -89,8 +89,8 @@ static int boot_embedded_image ( void ) {
* @v filename Boot filename
* @ret rc Return status code
*/
-static int boot_next_server_and_filename ( struct in_addr next_server,
- const char *filename ) {
+int boot_next_server_and_filename ( struct in_addr next_server,
+ const char *filename ) {
struct uri *uri;
struct image *image;
char buf[ 23 /* tftp://xxx.xxx.xxx.xxx/ */ + strlen(filename) + 1 ];
@@ -167,6 +167,7 @@ int boot_root_path ( const char *root_path ) {
* @ret rc Return status code
*/
static int netboot ( struct net_device *netdev ) {
+ struct setting tmp_setting = { .name = NULL };
char buf[256];
struct in_addr next_server;
int rc;
@@ -194,6 +195,16 @@ static int netboot ( struct net_device *netdev ) {
if ( rc != ENOENT )
return rc;
+ /* Try PXE menu boot, if we have PXE menu options */
+ tmp_setting.tag = DHCP_VENDOR_CLASS_ID;
+ fetch_string_setting ( NULL, &tmp_setting, buf, sizeof ( buf ) );
+ tmp_setting.tag = DHCP_PXE_BOOT_MENU;
+ if ( ( strcmp ( buf, "PXEClient" ) == 0 ) &&
+ setting_exists ( NULL, &tmp_setting ) ) {
+ printf ( "Booting from PXE menu\n" );
+ return pxe_menu_boot ( netdev );
+ }
+
/* Try to download and boot whatever we are given as a filename */
fetch_ipv4_setting ( NULL, &next_server_setting, &next_server );
fetch_string_setting ( NULL, &filename_setting, buf, sizeof ( buf ) );