summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorMichael Brown2007-07-26 03:13:38 +0200
committerMichael Brown2007-07-26 03:13:38 +0200
commit47a86bca2d2241a5126350e70d117564890a3f01 (patch)
tree5df56a80c12fe6af0f6f210f6f4a7f8fe4a76e43 /src/usr
parentInhibit a spurious warning on GCC 4.0.1 (diff)
downloadipxe-47a86bca2d2241a5126350e70d117564890a3f01.tar.gz
ipxe-47a86bca2d2241a5126350e70d117564890a3f01.tar.xz
ipxe-47a86bca2d2241a5126350e70d117564890a3f01.zip
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.
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/iscsiboot.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/usr/iscsiboot.c b/src/usr/iscsiboot.c
index f3910f14..a7caebaf 100644
--- a/src/usr/iscsiboot.c
+++ b/src/usr/iscsiboot.c
@@ -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 );