diff options
author | Michael Brown | 2009-01-31 08:36:05 +0100 |
---|---|---|
committer | Michael Brown | 2009-02-01 02:21:40 +0100 |
commit | e65afc4b10552ec9ac7de2f0d924b96bc71aaad0 (patch) | |
tree | 36e528a6d947aa8701208953e74cd496728955b4 /src/usr/autoboot.c | |
parent | [settings] Avoid duplicate settings block names (diff) | |
download | ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.tar.gz ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.tar.xz ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.zip |
[dhcp] Split PXE menuing code out of dhcp.c
The DHCP client code now implements only the mechanism of the DHCP and
PXE Boot Server protocols. Boot Server Discovery can be initiated
manually using the "pxebs" command. The menuing code is separated out
into a user-level function on a par with boot_root_path(), and is
entered in preference to a normal filename boot if the DHCP vendor
class is "PXEClient" and the PXE boot menu option exists.
Diffstat (limited to 'src/usr/autoboot.c')
-rw-r--r-- | src/usr/autoboot.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index f5f7f7d1..41f13417 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 ) ); |