Browse Source

Windows RIS now gets as far as downloading NTLDR.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
40d6d3dcf4
2 changed files with 14 additions and 5 deletions
  1. 7
    3
      src/interface/pxe/pxe_preboot.c
  2. 7
    2
      src/interface/pxe/pxe_tftp.c

+ 7
- 3
src/interface/pxe/pxe_preboot.c View File

@@ -28,6 +28,7 @@
28 28
 #include <stdlib.h>
29 29
 #include <gpxe/uaccess.h>
30 30
 #include <gpxe/dhcp.h>
31
+#include <dhcp_basemem.h>
31 32
 #include "pxe.h"
32 33
 #include "pxe_callbacks.h"
33 34
 
@@ -85,11 +86,13 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
85 86
 	 * sources of options.
86 87
 	 */
87 88
 	if ( get_cached_info->BufferLimit == 0 ) {
88
-		DBG ( " without an external buffer.  Aargh." );
89
-		goto err;
89
+		get_cached_info->Buffer.segment = rm_ds;
90
+		get_cached_info->Buffer.offset =
91
+			( unsigned int ) ( & __from_data16 ( dhcp_basemem ) );
92
+		get_cached_info->BufferLimit = sizeof ( dhcp_basemem );
90 93
 	}
91 94
 
92
-	DBG ( " to %04x:%04x+%x\n", get_cached_info->Buffer.segment,
95
+	DBG ( " to %04x:%04x+%x", get_cached_info->Buffer.segment,
93 96
 	      get_cached_info->Buffer.offset, get_cached_info->BufferLimit );
94 97
 
95 98
 	/* Allocate space for temporary copy */
@@ -121,6 +124,7 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
121 124
 	/* Copy packet to client buffer */
122 125
 	buffer = real_to_user ( get_cached_info->Buffer.segment,
123 126
 				get_cached_info->Buffer.offset );
127
+	len = dhcppkt.len;
124 128
 	copy_to_user ( buffer, 0, data, len );
125 129
 	get_cached_info->BufferSize = len;
126 130
 

+ 7
- 2
src/interface/pxe/pxe_tftp.c View File

@@ -56,8 +56,10 @@ static unsigned int pxe_single_blkidx;
56 56
  * @v port		Server port (in network byte order)
57 57
  * @v filename		File name
58 58
  * @v blksize		Requested block size, or 0
59
+ *
60
+ * The URI string buffer must be at least @c PXE_URI_LEN bytes long.
59 61
  */
60
-static void pxe_tftp_build_uri ( char uri_string[PXE_URI_LEN],
62
+static void pxe_tftp_build_uri ( char *uri_string,
61 63
 				 uint32_t ipaddress, unsigned int port,
62 64
 				 const unsigned char *filename,
63 65
 				 int blksize ) {
@@ -73,7 +75,7 @@ static void pxe_tftp_build_uri ( char uri_string[PXE_URI_LEN],
73 75
 		blksize = TFTP_MAX_BLKSIZE;
74 76
 	tftp_set_request_blksize ( blksize );
75 77
 
76
-	snprintf ( uri_string, sizeof ( uri_string ), "tftp://%s:%d%s%s",
78
+	snprintf ( uri_string, PXE_URI_LEN, "tftp://%s:%d%s%s",
77 79
 		   inet_ntoa ( address ), ntohs ( port ),
78 80
 		   ( ( filename[0] == '/' ) ? "" : "/" ), filename );
79 81
 }
@@ -372,6 +374,9 @@ PXENV_EXIT_t pxenv_tftp_read_file ( struct s_PXENV_TFTP_READ_FILE
372 374
 			     tftp_read_file->FileName, 0 );
373 375
 	DBG ( " %s", uri_string );
374 376
 
377
+	DBG ( " to %08lx+%lx", tftp_read_file->Buffer,
378
+	      tftp_read_file->BufferSize );
379
+
375 380
 	/* Open URI */
376 381
 	fd = open ( uri_string );
377 382
 	if ( fd < 0 ) {

Loading…
Cancel
Save