From 47a86bca2d2241a5126350e70d117564890a3f01 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 26 Jul 2007 02:13:38 +0100 Subject: Prepare for iBFT merge when possible. iscsiboot.c contains a really, really ugly hack at present, but that doesn't hugely matter since I'm aiming to change the interface to iSCSI devices anyway within the next week. --- src/usr/iscsiboot.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/usr') diff --git a/src/usr/iscsiboot.c b/src/usr/iscsiboot.c index f3910f149..a7caebaf6 100644 --- a/src/usr/iscsiboot.c +++ b/src/usr/iscsiboot.c @@ -3,9 +3,27 @@ #include #include #include +#include +#include #include #include +/** + * Guess boot network device + * + * @ret netdev Boot network device + */ +static struct net_device * guess_boot_netdev ( void ) { + struct net_device *boot_netdev; + + /* Just use the first network device */ + for_each_netdev ( boot_netdev ) { + return boot_netdev; + } + + return NULL; +} + int iscsiboot ( const char *root_path ) { struct scsi_device scsi; struct int13_drive drive; @@ -30,6 +48,12 @@ int iscsiboot ( const char *root_path ) { drive.drive = find_global_dhcp_num_option ( DHCP_EB_BIOS_DRIVE ); drive.blockdev = &scsi.blockdev; + /* FIXME: ugly, ugly hack */ + struct net_device *netdev = guess_boot_netdev(); + struct iscsi_session *iscsi = + container_of ( scsi.backend, struct iscsi_session, refcnt ); + ibft_fill_data ( netdev, iscsi ); + register_int13_drive ( &drive ); printf ( "Registered as BIOS drive %#02x\n", drive.drive ); printf ( "Booting from BIOS drive %#02x\n", drive.drive ); -- cgit v1.2.3-55-g7522