|
@@ -38,6 +38,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
38
|
38
|
#include <ipxe/netdevice.h>
|
39
|
39
|
#include <ipxe/features.h>
|
40
|
40
|
#include <ipxe/console.h>
|
|
41
|
+#include <ipxe/efi/efi.h>
|
|
42
|
+#include <ipxe/efi/IndustryStandard/PeImage.h>
|
41
|
43
|
|
42
|
44
|
FEATURE ( FEATURE_IMAGE, "PXE", DHCP_EB_FEATURE_PXE, 1 );
|
43
|
45
|
|
|
@@ -125,9 +127,45 @@ int pxe_probe ( struct image *image ) {
|
125
|
127
|
return 0;
|
126
|
128
|
}
|
127
|
129
|
|
|
130
|
+/**
|
|
131
|
+ * Probe PXE image (with rejection of potential EFI images)
|
|
132
|
+ *
|
|
133
|
+ * @v image PXE file
|
|
134
|
+ * @ret rc Return status code
|
|
135
|
+ */
|
|
136
|
+int pxe_probe_no_mz ( struct image *image ) {
|
|
137
|
+ uint16_t magic;
|
|
138
|
+ int rc;
|
|
139
|
+
|
|
140
|
+ /* Probe PXE image */
|
|
141
|
+ if ( ( rc = pxe_probe ( image ) ) != 0 )
|
|
142
|
+ return rc;
|
|
143
|
+
|
|
144
|
+ /* Reject image with an "MZ" signature which may indicate an
|
|
145
|
+ * EFI image incorrectly handed out to a BIOS system.
|
|
146
|
+ */
|
|
147
|
+ if ( image->len >= sizeof ( magic ) ) {
|
|
148
|
+ copy_from_user ( &magic, image->data, 0, sizeof ( magic ) );
|
|
149
|
+ if ( magic == cpu_to_le16 ( EFI_IMAGE_DOS_SIGNATURE ) ) {
|
|
150
|
+ DBGC ( image, "IMAGE %p may be an EFI image\n",
|
|
151
|
+ image );
|
|
152
|
+ return -ENOTTY;
|
|
153
|
+ }
|
|
154
|
+ }
|
|
155
|
+
|
|
156
|
+ return 0;
|
|
157
|
+}
|
|
158
|
+
|
128
|
159
|
/** PXE image type */
|
129
|
|
-struct image_type pxe_image_type __image_type ( PROBE_PXE ) = {
|
130
|
|
- .name = "PXE",
|
131
|
|
- .probe = pxe_probe,
|
132
|
|
- .exec = pxe_exec,
|
|
160
|
+struct image_type pxe_image_type[] __image_type ( PROBE_PXE ) = {
|
|
161
|
+ {
|
|
162
|
+ .name = "PXE-NBP",
|
|
163
|
+ .probe = pxe_probe_no_mz,
|
|
164
|
+ .exec = pxe_exec,
|
|
165
|
+ },
|
|
166
|
+ {
|
|
167
|
+ .name = "PXE-NBP (may be EFI?)",
|
|
168
|
+ .probe = pxe_probe,
|
|
169
|
+ .exec = pxe_exec,
|
|
170
|
+ },
|
133
|
171
|
};
|