summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2007-01-12 09:10:35 +0100
committerMichael Brown2007-01-12 09:10:35 +0100
commit6fdc6c81a6a089074d17f46b0ab930e6e1445e8b (patch)
tree500fcc1b50f4090c11ce6964371adfd666a80497 /src
parentfetch() now knows nothing about struct image; it simply loads a file and (diff)
downloadipxe-6fdc6c81a6a089074d17f46b0ab930e6e1445e8b.tar.gz
ipxe-6fdc6c81a6a089074d17f46b0ab930e6e1445e8b.tar.xz
ipxe-6fdc6c81a6a089074d17f46b0ab930e6e1445e8b.zip
Force probing of multiboot before ELF.
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/image/multiboot.c4
-rw-r--r--src/image/elf.c4
-rw-r--r--src/include/gpxe/image.h28
3 files changed, 24 insertions, 12 deletions
diff --git a/src/arch/i386/image/multiboot.c b/src/arch/i386/image/multiboot.c
index cdf81e6eb..746b8a57c 100644
--- a/src/arch/i386/image/multiboot.c
+++ b/src/arch/i386/image/multiboot.c
@@ -33,7 +33,7 @@
#include <gpxe/memmap.h>
#include <gpxe/elf.h>
-struct image_type multiboot_image_type __image_type;
+struct image_type multiboot_image_type __image_type ( PROBE_MULTIBOOT );
/** Multiboot flags that we support */
#define MB_SUPPORTED_FLAGS ( MB_FLAG_PGALIGN | MB_FLAG_MEMMAP | \
@@ -320,7 +320,7 @@ int multiboot_load ( struct image *image ) {
}
/** Multiboot image type */
-struct image_type multiboot_image_type __image_type = {
+struct image_type multiboot_image_type __image_type ( PROBE_MULTIBOOT ) = {
.name = "Multiboot",
.load = multiboot_load,
.exec = multiboot_exec,
diff --git a/src/image/elf.c b/src/image/elf.c
index 869be3f33..167ef2bf7 100644
--- a/src/image/elf.c
+++ b/src/image/elf.c
@@ -30,7 +30,7 @@
#include <gpxe/image.h>
#include <gpxe/elf.h>
-struct image_type elf_image_type __image_type;
+struct image_type elf_image_type __image_type ( PROBE_NORMAL );
typedef Elf32_Ehdr Elf_Ehdr;
typedef Elf32_Phdr Elf_Phdr;
@@ -143,7 +143,7 @@ int elf_load ( struct image *image ) {
}
/** ELF image type */
-struct image_type elf_image_type __image_type = {
+struct image_type elf_image_type __image_type ( PROBE_NORMAL ) = {
.name = "ELF",
.load = elf_load,
.exec = elf_exec,
diff --git a/src/include/gpxe/image.h b/src/include/gpxe/image.h
index 5367735c8..c91468c67 100644
--- a/src/include/gpxe/image.h
+++ b/src/include/gpxe/image.h
@@ -79,18 +79,30 @@ struct image_type {
int ( * exec ) ( struct image *image );
};
-/** An executable or loadable image type */
-#define __image_type __table ( struct image_type, image_types, 01 )
+/**
+ * Multiboot image probe priority
+ *
+ * Multiboot images are also valid executables in another format
+ * (e.g. ELF), so we must perform the multiboot probe first.
+ */
+#define PROBE_MULTIBOOT 01
/**
- * An unverifiable executable or loadable image type
+ * Normal image probe priority
+ */
+#define PROBE_NORMAL 02
+
+/**
+ * PXE image probe priority
*
- * This should be used to mark image types for which there are no
- * signature or other checks that can be used to verify the validity
- * of the image (such as PXE images). These will then be tried last
- * in the list of image types.
+ * PXE images have no signature checks, so will claim all image files.
+ * They must therefore be tried last in the probe order list.
*/
-#define __default_image_type __table ( struct image_type, image_types, 02 )
+#define PROBE_PXE 03
+
+/** An executable or loadable image type */
+#define __image_type( probe_order ) \
+ __table ( struct image_type, image_types, probe_order )
extern struct list_head images;