Browse Source

[segment] Add "Requested memory not available" error message

prep_segment() can sometimes fail because an image requests memory
that is already in use by gPXE.  This will happen if
e.g. undionly.kpxe is used to boot memtest86; the memtest86 image is
an old-format kernel that needs to be loaded at 9000:0000, but this
area of memory may well already be in use by the underlying PXE stack.

Add a human-friendly error message, so that the cause is more
immediately visible.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
f7d2168c8e
2 changed files with 12 additions and 0 deletions
  1. 1
    0
      src/hci/strerror.c
  2. 11
    0
      src/image/segment.c

+ 1
- 0
src/hci/strerror.c View File

115
 	{ ENOSPC, "No space left on device" },
115
 	{ ENOSPC, "No space left on device" },
116
 	{ ENOTSUP, "Not supported" },
116
 	{ ENOTSUP, "Not supported" },
117
 	{ EPERM, "Operation not permitted" },
117
 	{ EPERM, "Operation not permitted" },
118
+	{ ERANGE, "Out of range" },
118
 	{ ETIMEDOUT, "Connection timed out" },
119
 	{ ETIMEDOUT, "Connection timed out" },
119
 };
120
 };

+ 11
- 0
src/image/segment.c View File

26
 #include <errno.h>
26
 #include <errno.h>
27
 #include <gpxe/uaccess.h>
27
 #include <gpxe/uaccess.h>
28
 #include <gpxe/memmap.h>
28
 #include <gpxe/memmap.h>
29
+#include <gpxe/errortab.h>
29
 #include <gpxe/segment.h>
30
 #include <gpxe/segment.h>
30
 
31
 
31
 /**
32
 /**
72
 	      start, mid, end );
73
 	      start, mid, end );
73
 	return -ERANGE;
74
 	return -ERANGE;
74
 }
75
 }
76
+
77
+/**
78
+ * Segment-specific error messages
79
+ *
80
+ * This error happens sufficiently often to merit a user-friendly
81
+ * description.
82
+ */
83
+struct errortab segment_errors[] __errortab = {
84
+	{ ERANGE, "Requested memory not available" },
85
+};

Loading…
Cancel
Save