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.
This commit is contained in:
Michael Brown
2007-07-26 02:13:38 +01:00
parent 84c347c7de
commit 47a86bca2d
4 changed files with 132 additions and 18 deletions

View File

@@ -3,9 +3,27 @@
#include <stdio.h>
#include <gpxe/iscsi.h>
#include <gpxe/dhcp.h>
#include <gpxe/netdevice.h>
#include <gpxe/ibft.h>
#include <int13.h>
#include <usr/iscsiboot.h>
/**
* 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 );