aboutsummaryrefslogtreecommitdiffstats
path: root/com32/mboot
diff options
context:
space:
mode:
Diffstat (limited to 'com32/mboot')
-rw-r--r--com32/mboot/Makefile2
-rw-r--r--com32/mboot/map.c4
-rw-r--r--com32/mboot/mboot.c26
-rw-r--r--com32/mboot/mboot.h9
-rw-r--r--com32/mboot/solaris.c11
-rw-r--r--com32/mboot/syslinux.c45
6 files changed, 86 insertions, 11 deletions
diff --git a/com32/mboot/Makefile b/com32/mboot/Makefile
index c1ac76fb..7e6c2e96 100644
--- a/com32/mboot/Makefile
+++ b/com32/mboot/Makefile
@@ -24,7 +24,7 @@ LNXLIBS = ../libutil/libutil_lnx.a
MODULES = mboot.c32
TESTFILES =
-OBJS = mboot.o map.o mem.o initvesa.o apm.o solaris.o
+OBJS = mboot.o map.o mem.o initvesa.o apm.o solaris.o syslinux.o
all: $(MODULES) $(TESTFILES)
diff --git a/com32/mboot/map.c b/com32/mboot/map.c
index a32f9b3b..267e50c8 100644
--- a/com32/mboot/map.c
+++ b/com32/mboot/map.c
@@ -151,6 +151,10 @@ struct multiboot_header *map_image(void *ptr, size_t len)
!eh->e_phnum || eh->e_phoff + eh->e_phentsize * eh->e_phnum > len)
eh = NULL; /* No valid ELF header found */
+ /* Is this a Solaris kernel? */
+ if (!set.solaris && eh && kernel_is_solaris(eh))
+ opt.solaris = true;
+
/*
* Note: the Multiboot Specification implies that AOUT_KLUDGE should
* have precedence over the ELF header. However, Grub disagrees, and
diff --git a/com32/mboot/mboot.c b/com32/mboot/mboot.c
index 8425e068..915c7857 100644
--- a/com32/mboot/mboot.c
+++ b/com32/mboot/mboot.c
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -36,7 +36,7 @@
struct multiboot_info mbinfo;
struct syslinux_pm_regs regs;
-struct my_options opt;
+struct my_options opt, set;
struct module_data {
void *data;
@@ -161,11 +161,21 @@ int main(int argc, char *argv[])
argv++;
while (*argv) {
- if (!strcmp(*argv, "-solaris"))
- opt.solaris = true;
- else if (!strcmp(*argv, "-aout"))
- opt.aout = true;
- else
+ bool v = true;
+ const char *p = *argv;
+
+ if (!memcmp(p, "-no", 3)) {
+ v = false;
+ p += 3;
+ }
+
+ if (!strcmp(p, "-solaris")) {
+ opt.solaris = v;
+ set.solaris = true;
+ } else if (!strcmp(p, "-aout")) {
+ opt.aout = v;
+ set.aout = true;
+ } else
break;
argv++;
}
@@ -222,6 +232,8 @@ int main(int argc, char *argv[])
/* Add auxilliary information */
mboot_make_memmap();
mboot_apm();
+ mboot_syslinux_info();
+
if (opt.solaris)
mboot_solaris_dhcp_hack();
diff --git a/com32/mboot/mboot.h b/com32/mboot/mboot.h
index 993b31a8..b646cd36 100644
--- a/com32/mboot/mboot.h
+++ b/com32/mboot/mboot.h
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -50,6 +50,7 @@
#include <syslinux/loadfile.h>
#include <syslinux/movebits.h>
#include <syslinux/bootpm.h>
+#include <syslinux/config.h>
#include "mb_header.h"
#include "mb_info.h"
@@ -72,7 +73,7 @@ extern struct syslinux_pm_regs regs;
extern struct my_options {
bool solaris;
bool aout;
-} opt;
+} opt, set;
/* map.c */
#define MAP_HIGH 1
@@ -90,8 +91,12 @@ void mboot_make_memmap(void);
void mboot_apm(void);
/* solaris.c */
+bool kernel_is_solaris(const Elf32_Ehdr *);
void mboot_solaris_dhcp_hack(void);
+/* syslinux.c */
+void mboot_syslinux_info(void);
+
/* initvesa.c */
void set_graphics_mode(const struct multiboot_header *mbh,
struct multiboot_info *mbi);
diff --git a/com32/mboot/solaris.c b/com32/mboot/solaris.c
index 3b316606..1b153ddb 100644
--- a/com32/mboot/solaris.c
+++ b/com32/mboot/solaris.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -35,12 +35,21 @@
#include "mboot.h"
#include <syslinux/pxe.h>
+#include <syslinux/config.h>
+
+bool kernel_is_solaris(const Elf32_Ehdr *eh)
+{
+ return eh->e_ident[EI_OSABI] == 6; /* ABI == Solaris */
+}
void mboot_solaris_dhcp_hack(void)
{
void *dhcpdata;
size_t dhcplen;
+ if (syslinux_derivative_info()->c.filesystem != SYSLINUX_FS_PXELINUX)
+ return;
+
if (!pxe_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, &dhcpdata, &dhcplen)) {
mbinfo.drives_addr = map_data(dhcpdata, dhcplen, 4, 0);
if (mbinfo.drives_addr) {
diff --git a/com32/mboot/syslinux.c b/com32/mboot/syslinux.c
new file mode 100644
index 00000000..7de3853e
--- /dev/null
+++ b/com32/mboot/syslinux.c
@@ -0,0 +1,45 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2010 Intel Corporation; author: H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * syslinux.c
+ *
+ * Syslinux-specific information for the kernel
+ */
+
+#include <syslinux/config.h>
+#include "mboot.h"
+
+void mboot_syslinux_info(void)
+{
+ const struct syslinux_version *sv;
+
+ sv = syslinux_version();
+ mbinfo.boot_loader_name = map_string(sv->version_string);
+ if (mbinfo.boot_loader_name)
+ mbinfo.flags |= MB_INFO_BOOT_LOADER_NAME;
+}