!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
struct multiboot_info mbinfo;
struct syslinux_pm_regs regs;
-struct my_options opt;
+struct my_options opt, set;
struct module_data {
void *data;
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++;
}
extern struct my_options {
bool solaris;
bool aout;
-} opt;
+} opt, set;
/* map.c */
#define MAP_HIGH 1
void mboot_apm(void);
/* solaris.c */
+bool kernel_is_solaris(const Elf32_Ehdr *);
void mboot_solaris_dhcp_hack(void);
/* syslinux.c */
/* ----------------------------------------------------------------------- *
*
- * 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
#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) {