mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 01:52:39 +03:00
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:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user