#include <pxe.h>
#include <pxe_call.h>
#include <gpxe/uaccess.h>
#include <gpxe/image.h>
#include <gpxe/segment.h>
#include <gpxe/netdevice.h>
#include <gpxe/features.h>
Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| FEATURE (FEATURE_IMAGE,"PXE", DHCP_EB_FEATURE_PXE, 1) | |
| struct image_type pxe_image_type | __image_type (PROBE_PXE) |
| PXE image type. | |
| static int | pxe_exec (struct image *image) |
| Execute PXE image. | |
| int | pxe_load (struct image *image) |
| Load PXE image into memory. | |
Definition in file pxe_image.c.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| FEATURE | ( | FEATURE_IMAGE | , | |
| "PXE" | , | |||
| DHCP_EB_FEATURE_PXE | , | |||
| 1 | ||||
| ) |
| struct image_type pxe_image_type __image_type | ( | PROBE_PXE | ) | [read] |
| static int pxe_exec | ( | struct image * | image | ) | [static] |
Execute PXE image.
| rc | Return status code |
Definition at line 46 of file pxe_image.c.
References DBGC, ENODEV, last_opened_netdev(), netdev, NULL, pxe_activate(), pxe_deactivate(), and pxe_start_nbp().
00046 { 00047 struct net_device *netdev; 00048 int rc; 00049 00050 /* Arbitrarily pick the most recently opened network device */ 00051 if ( ( netdev = last_opened_netdev() ) == NULL ) { 00052 DBGC ( image, "IMAGE %p could not locate PXE net device\n", 00053 image ); 00054 return -ENODEV; 00055 } 00056 00057 /* Activate PXE */ 00058 pxe_activate ( netdev ); 00059 00060 /* Start PXE NBP */ 00061 rc = pxe_start_nbp(); 00062 00063 /* Deactivate PXE */ 00064 pxe_deactivate(); 00065 00066 return rc; 00067 }
| int pxe_load | ( | struct image * | image | ) |
Load PXE image into memory.
| image | PXE file |
| rc | Return status code |
Definition at line 75 of file pxe_image.c.
References image::data, DBGC, ENOEXEC, image::len, memcpy_user(), prep_segment(), real_to_user(), strerror(), and image::type.
00075 { 00076 userptr_t buffer = real_to_user ( 0, 0x7c00 ); 00077 size_t filesz = image->len; 00078 size_t memsz = image->len; 00079 int rc; 00080 00081 /* Images too large to fit in base memory cannot be PXE 00082 * images. We include this check to help prevent unrecognised 00083 * images from being marked as PXE images, since PXE images 00084 * have no signature we can check against. 00085 */ 00086 if ( filesz > ( 0xa0000 - 0x7c00 ) ) 00087 return -ENOEXEC; 00088 00089 /* Rejecting zero-length images is also useful, since these 00090 * end up looking to the user like bugs in gPXE. 00091 */ 00092 if ( ! filesz ) 00093 return -ENOEXEC; 00094 00095 /* There are no signature checks for PXE; we will accept anything */ 00096 if ( ! image->type ) 00097 image->type = &pxe_image_type; 00098 00099 /* Verify and prepare segment */ 00100 if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) { 00101 DBGC ( image, "IMAGE %p could not prepare segment: %s\n", 00102 image, strerror ( rc ) ); 00103 return rc; 00104 } 00105 00106 /* Copy image to segment */ 00107 memcpy_user ( buffer, 0, image->data, 0, filesz ); 00108 00109 return 0; 00110 }
1.5.7.1