|
@@ -1,57 +0,0 @@
|
1
|
|
-#include <stdint.h>
|
2
|
|
-#include <string.h>
|
3
|
|
-#include <console.h>
|
4
|
|
-#include <gpxe/udp.h>
|
5
|
|
-#include <gpxe/tftp.h>
|
6
|
|
-#include <gpxe/async.h>
|
7
|
|
-#include <gpxe/uaccess.h>
|
8
|
|
-#include <gpxe/buffer.h>
|
9
|
|
-#include <gpxe/image.h>
|
10
|
|
-#include <gpxe/elf.h>
|
11
|
|
-#include <bios.h>
|
12
|
|
-#include "pxe.h"
|
13
|
|
-
|
14
|
|
-int test_tftp ( struct net_device *netdev, struct sockaddr_tcpip *target,
|
15
|
|
- const char *filename ) {
|
16
|
|
- struct tftp_session tftp;
|
17
|
|
- struct buffer buffer;
|
18
|
|
- struct image image;
|
19
|
|
- uint16_t fbms;
|
20
|
|
- int rc;
|
21
|
|
-
|
22
|
|
-
|
23
|
|
- ebuffer_alloc ( &buffer, 0 );
|
24
|
|
-#if 0
|
25
|
|
- memset ( &buffer, 0, sizeof ( buffer ) );
|
26
|
|
- buffer.addr = real_to_user ( 0, 0x7c00 );
|
27
|
|
- get_real ( fbms, BDA_SEG, BDA_FBMS );
|
28
|
|
- buffer.len = ( fbms * 1024 - 0x7c00 );
|
29
|
|
-#endif
|
30
|
|
-
|
31
|
|
- memset ( &tftp, 0, sizeof ( tftp ) );
|
32
|
|
- udp_connect ( &tftp.udp, target );
|
33
|
|
- tftp.filename = filename;
|
34
|
|
- tftp.buffer = &buffer;
|
35
|
|
-
|
36
|
|
- printf ( "Fetching \"%s\" via TFTP\n", filename );
|
37
|
|
- if ( ( rc = async_wait ( tftp_get ( &tftp ) ) ) != 0 )
|
38
|
|
- return rc;
|
39
|
|
-
|
40
|
|
- memset ( &image, 0, sizeof ( image ) );
|
41
|
|
- image.data = buffer.addr;
|
42
|
|
- image.len = buffer.len;
|
43
|
|
- if ( ( rc = multiboot_load ( &image ) ) == 0 ) {
|
44
|
|
- printf ( "Got valid multiboot image: execaddr at %lx\n",
|
45
|
|
- image.entry );
|
46
|
|
-
|
47
|
|
- image_exec ( &image );
|
48
|
|
-
|
49
|
|
- return 0;
|
50
|
|
- }
|
51
|
|
-
|
52
|
|
- printf ( "Attempting PXE boot\n" );
|
53
|
|
- pxe_netdev = netdev;
|
54
|
|
- rc = pxe_boot();
|
55
|
|
- printf ( "PXE NBP returned with status %04x\n", rc );
|
56
|
|
- return 0;
|
57
|
|
-}
|