aboutsummaryrefslogtreecommitdiffstats
path: root/stubdom/grub.patches/99minios
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-06-18 09:36:47 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-06-18 09:36:47 +0100
commita2c7db64f561821fd528614e68c4d92718210126 (patch)
tree79c7e1c3ef49b5b4272fd12d36420e6fb8d23cd1 /stubdom/grub.patches/99minios
parent7074b13cee246f09b3b0a2a6da139b2e047cf4a4 (diff)
downloadxen-a2c7db64f561821fd528614e68c4d92718210126.tar.gz
xen-a2c7db64f561821fd528614e68c4d92718210126.tar.bz2
xen-a2c7db64f561821fd528614e68c4d92718210126.zip
Add PV-GRUB
This fetches GRUB1 sources, applies the {graphical, print function, save default, and ext3_256byte} patches from debian, and applies a patch to make it work on x86_64 and port it to Mini-OS. By using libxc, PV-GRUB can then "kexec" the loaded kernel from inside the domain itself, hence permitting to avoid the security-concerned pygrub. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'stubdom/grub.patches/99minios')
-rw-r--r--stubdom/grub.patches/99minios1456
1 files changed, 1456 insertions, 0 deletions
diff --git a/stubdom/grub.patches/99minios b/stubdom/grub.patches/99minios
new file mode 100644
index 0000000000..3efc57177c
--- /dev/null
+++ b/stubdom/grub.patches/99minios
@@ -0,0 +1,1456 @@
+Index: grub/stage2/builtins.c
+===================================================================
+--- grub.orig/stage2/builtins.c 2008-06-16 15:18:14.649009000 +0100
++++ grub/stage2/builtins.c 2008-06-16 15:18:14.719009000 +0100
+@@ -45,8 +45,10 @@
+ #ifdef GRUB_UTIL
+ # include <device.h>
+ #else /* ! GRUB_UTIL */
++#ifndef __MINIOS
+ # include <apic.h>
+ # include <smp-imps.h>
++#endif
+ #endif /* ! GRUB_UTIL */
+
+ #ifdef USE_MD5_PASSWORDS
+@@ -246,11 +248,13 @@
+ boot_func (char *arg, int flags)
+ {
+ struct term_entry *prev_term = current_term;
++#ifndef __MINIOS__
+ /* Clear the int15 handler if we can boot the kernel successfully.
+ This assumes that the boot code never fails only if KERNEL_TYPE is
+ not KERNEL_TYPE_NONE. Is this assumption is bad? */
+ if (kernel_type != KERNEL_TYPE_NONE)
+ unset_int15_handler ();
++#endif
+
+ /* if our terminal needed initialization, we should shut it down
+ * before booting the kernel, but we want to save what it was so
+@@ -261,13 +265,21 @@
+ current_term = term_table; /* assumption: console is first */
+ }
+
++#ifndef __MINIOS__
+ #ifdef SUPPORT_NETBOOT
+ /* Shut down the networking. */
+ cleanup_net ();
+ #endif
++#endif
+
+ switch (kernel_type)
+ {
++#ifdef __MINIOS__
++ case KERNEL_TYPE_PV:
++ /* Paravirtualized */
++ pv_boot();
++ break;
++#else
+ case KERNEL_TYPE_FREEBSD:
+ case KERNEL_TYPE_NETBSD:
+ /* *BSD */
+@@ -319,6 +331,7 @@
+ multi_boot ((int) entry_addr, (int) &mbi);
+ break;
+
++#endif
+ default:
+ errnum = ERR_BOOT_COMMAND;
+ return 1;
+@@ -1123,6 +1136,7 @@
+ };
+
+
++#ifndef __MINIOS__
+ /* displayapm */
+ static int
+ displayapm_func (char *arg, int flags)
+@@ -1163,8 +1177,10 @@
+ "displayapm",
+ "Display APM BIOS information."
+ };
++#endif
+
+
++#ifndef __MINIOS__
+ /* displaymem */
+ static int
+ displaymem_func (char *arg, int flags)
+@@ -1218,6 +1234,7 @@
+ "Display what GRUB thinks the system address space map of the"
+ " machine is, including all regions of physical RAM installed."
+ };
++#endif
+
+
+ /* dump FROM TO */
+@@ -1280,6 +1297,7 @@
+ #endif /* GRUB_UTIL */
+
+
++#ifndef __MINIOS__
+ static char embed_info[32];
+ /* embed */
+ /* Embed a Stage 1.5 in the first cylinder after MBR or in the
+@@ -1413,6 +1431,7 @@
+ " is a drive, or in the \"bootloader\" area if DEVICE is a FFS partition."
+ " Print the number of sectors which STAGE1_5 occupies if successful."
+ };
++#endif
+
+
+ /* fallback */
+@@ -1956,6 +1975,7 @@
+ #endif /* SUPPORT_NETBOOT */
+
+
++#ifndef __MINIOS__
+ /* impsprobe */
+ static int
+ impsprobe_func (char *arg, int flags)
+@@ -1982,6 +2002,7 @@
+ " configuration table and boot the various CPUs which are found into"
+ " a tight loop."
+ };
++#endif
+
+
+ /* initrd */
+@@ -1992,6 +2013,7 @@
+ {
+ case KERNEL_TYPE_LINUX:
+ case KERNEL_TYPE_BIG_LINUX:
++ case KERNEL_TYPE_PV:
+ if (! load_initrd (arg))
+ return 1;
+ break;
+@@ -2015,6 +2037,7 @@
+ };
+
+
++#ifndef __MINIOS__
+ /* install */
+ static int
+ install_func (char *arg, int flags)
+@@ -2555,8 +2578,10 @@
+ " for LBA mode. If the option `--stage2' is specified, rewrite the Stage"
+ " 2 via your OS's filesystem instead of the raw device."
+ };
++#endif
+
+
++#ifndef __MINIOS__
+ /* ioprobe */
+ static int
+ ioprobe_func (char *arg, int flags)
+@@ -2598,6 +2623,7 @@
+ "ioprobe DRIVE",
+ "Probe I/O ports used for the drive DRIVE."
+ };
++#endif
+
+ /* print */
+ static int
+@@ -3776,6 +3802,7 @@
+ };
+
+
++#ifndef __MINIOS__
+ #ifdef SUPPORT_SERIAL
+ /* serial */
+ static int
+@@ -3927,8 +3954,10 @@
+ " default values are COM1, 9600, 8N1."
+ };
+ #endif /* SUPPORT_SERIAL */
++#endif
+
+
++#ifndef __MINIOS__
+ /* setkey */
+ struct keysym
+ {
+@@ -4174,8 +4203,10 @@
+ " is a digit), and delete. If no argument is specified, reset key"
+ " mappings."
+ };
++#endif
+
+
++#ifndef __MINIOS__
+ /* setup */
+ static int
+ setup_func (char *arg, int flags)
+@@ -4484,6 +4515,7 @@
+ " partition where GRUB images reside, specify the option `--stage2'"
+ " to tell GRUB the file name under your OS."
+ };
++#endif
+
+
+ #if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
+@@ -4788,6 +4820,7 @@
+ #endif /* SUPPORT_SERIAL */
+
+
++#ifndef __MINIOS__
+ /* testload */
+ static int
+ testload_func (char *arg, int flags)
+@@ -4874,8 +4907,10 @@
+ " consistent offset error. If this test succeeds, then a good next"
+ " step is to try loading a kernel."
+ };
++#endif
+
+
++#ifndef __MINIOS__
+ /* testvbe MODE */
+ static int
+ testvbe_func (char *arg, int flags)
+@@ -4979,6 +5014,7 @@
+ "testvbe MODE",
+ "Test the VBE mode MODE. Hit any key to return."
+ };
++#endif
+
+
+ #ifdef SUPPORT_NETBOOT
+@@ -5075,6 +5111,7 @@
+ };
+
+
++#ifndef __MINIOS__
+ /* uppermem */
+ static int
+ uppermem_func (char *arg, int flags)
+@@ -5095,8 +5132,10 @@
+ "Force GRUB to assume that only KBYTES kilobytes of upper memory are"
+ " installed. Any system address range maps are discarded."
+ };
++#endif
+
+
++#ifndef __MINIOS__
+ /* vbeprobe */
+ static int
+ vbeprobe_func (char *arg, int flags)
+@@ -5203,6 +5242,7 @@
+ "Probe VBE information. If the mode number MODE is specified, show only"
+ " the information about only the mode."
+ };
++#endif
+
+
+ /* The table of builtin commands. Sorted in dictionary order. */
+@@ -5233,12 +5273,16 @@
+ #ifdef SUPPORT_NETBOOT
+ &builtin_dhcp,
+ #endif /* SUPPORT_NETBOOT */
++#ifndef __MINIOS__
+ &builtin_displayapm,
+ &builtin_displaymem,
++#endif
+ #ifdef GRUB_UTIL
+ &builtin_dump,
+ #endif /* GRUB_UTIL */
++#ifndef __MINIOS__
+ &builtin_embed,
++#endif
+ &builtin_fallback,
+ &builtin_find,
+ #ifdef SUPPORT_GRAPHICS
+@@ -5253,10 +5297,14 @@
+ #ifdef SUPPORT_NETBOOT
+ &builtin_ifconfig,
+ #endif /* SUPPORT_NETBOOT */
++#ifndef __MINIOS__
+ &builtin_impsprobe,
++#endif
+ &builtin_initrd,
++#ifndef __MINIOS__
+ &builtin_install,
+ &builtin_ioprobe,
++#endif
+ &builtin_kernel,
+ &builtin_lock,
+ &builtin_makeactive,
+@@ -5283,11 +5331,13 @@
+ &builtin_root,
+ &builtin_rootnoverify,
+ &builtin_savedefault,
++#ifndef __MINIOS__
+ #ifdef SUPPORT_SERIAL
+ &builtin_serial,
+ #endif /* SUPPORT_SERIAL */
+ &builtin_setkey,
+ &builtin_setup,
++#endif
+ #ifdef SUPPORT_GRAPHICS
+ &builtin_shade,
+ &builtin_splashimage,
+@@ -5298,16 +5348,20 @@
+ #ifdef SUPPORT_SERIAL
+ &builtin_terminfo,
+ #endif /* SUPPORT_SERIAL */
++#ifndef __MINIOS__
+ &builtin_testload,
+ &builtin_testvbe,
++#endif
+ #ifdef SUPPORT_NETBOOT
+ &builtin_tftpserver,
+ #endif /* SUPPORT_NETBOOT */
+ &builtin_timeout,
+ &builtin_title,
+ &builtin_unhide,
++#ifndef __MINIOS__
+ &builtin_uppermem,
+ &builtin_vbeprobe,
++#endif
+ #ifdef SUPPORT_GRAPHICS
+ &builtin_viewport,
+ #endif
+Index: grub/stage2/char_io.c
+===================================================================
+--- grub.orig/stage2/char_io.c 2008-06-16 15:18:14.516009000 +0100
++++ grub/stage2/char_io.c 2008-06-16 15:18:14.726009000 +0100
+@@ -20,6 +20,7 @@
+
+ #include <shared.h>
+ #include <term.h>
++#include <stdarg.h>
+
+ #ifdef SUPPORT_HERCULES
+ # include <hercules.h>
+@@ -36,6 +37,7 @@
+ #ifndef STAGE1_5
+ struct term_entry term_table[] =
+ {
++#ifdef SUPPORT_CONSOLE
+ {
+ "console",
+ 0,
+@@ -52,6 +54,7 @@
+ 0,
+ 0
+ },
++#endif
+ #ifdef SUPPORT_SERIAL
+ {
+ "serial",
+@@ -131,9 +134,9 @@
+ }
+
+ char *
+-convert_to_ascii (char *buf, int c,...)
++convert_to_ascii (char *buf, int c, int _num)
+ {
+- unsigned long num = *((&c) + 1), mult = 10;
++ unsigned long num = _num, mult = 10;
+ char *ptr = buf;
+
+ #ifndef STAGE1_5
+@@ -182,11 +185,11 @@
+ void
+ grub_printf (const char *format,...)
+ {
+- int *dataptr = (int *) &format;
++ va_list ap;
+ char c, str[16];
+-
+- dataptr++;
+
++ va_start(ap, format);
++
+ while ((c = *(format++)) != 0)
+ {
+ if (c != '%')
+@@ -200,21 +203,32 @@
+ case 'X':
+ #endif
+ case 'u':
+- *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0;
++ {
++ unsigned i = va_arg(ap, unsigned);
++ *convert_to_ascii (str, c, i) = 0;
+ grub_putstr (str);
+ break;
++ }
+
+ #ifndef STAGE1_5
+ case 'c':
+- grub_putchar ((*(dataptr++)) & 0xff);
++ {
++ int c = va_arg(ap, int);
++ grub_putchar (c & 0xff);
+ break;
++ }
+
+ case 's':
+- grub_putstr ((char *) *(dataptr++));
++ {
++ char *s = va_arg(ap, char*);
++ grub_putstr (s);
+ break;
++ }
+ #endif
+ }
+ }
++
++ va_end(ap);
+ }
+
+ #ifndef STAGE1_5
+@@ -223,11 +237,11 @@
+ {
+ /* XXX hohmuth
+ ugly hack -- should unify with printf() */
+- int *dataptr = (int *) &format;
++ va_list ap;
+ char c, *ptr, str[16];
+ char *bp = buffer;
+
+- dataptr++;
++ va_start(ap, format);
+
+ while ((c = *format++) != 0)
+ {
+@@ -237,20 +251,27 @@
+ switch (c = *(format++))
+ {
+ case 'd': case 'u': case 'x':
+- *convert_to_ascii (str, c, *((unsigned long *) dataptr++)) = 0;
++ {
++ unsigned i = va_arg(ap, unsigned);
++ *convert_to_ascii (str, c, i) = 0;
+
+ ptr = str;
+
+ while (*ptr)
+ *bp++ = *(ptr++); /* putchar(*(ptr++)); */
+ break;
++ }
+
+- case 'c': *bp++ = (*(dataptr++))&0xff;
++ case 'c':
++ {
++ int c = va_arg(ap, int);
++ *bp++ = c&0xff;
+ /* putchar((*(dataptr++))&0xff); */
+ break;
++ }
+
+ case 's':
+- ptr = (char *) (*(dataptr++));
++ ptr = va_arg(ap, char *);
+
+ while ((c = *ptr++) != 0)
+ *bp++ = c; /* putchar(c); */
+@@ -258,6 +279,8 @@
+ }
+ }
+
++ va_end(ap);
++
+ *bp = 0;
+ return bp - buffer;
+ }
+@@ -1263,12 +1286,14 @@
+ return ! errnum;
+ #endif /* GRUB_UTIL */
+
++#ifndef __MINIOS__
+ if ((addr < RAW_ADDR (0x1000))
+ || (addr < RAW_ADDR (0x100000)
+ && RAW_ADDR (mbi.mem_lower * 1024) < (addr + len))
+ || (addr >= RAW_ADDR (0x100000)
+ && RAW_ADDR (mbi.mem_upper * 1024) < ((addr - 0x100000) + len)))
+ errnum = ERR_WONT_FIT;
++#endif
+
+ return ! errnum;
+ }
+@@ -1342,7 +1367,7 @@
+ }
+ #endif /* ! STAGE1_5 */
+
+-#ifndef GRUB_UTIL
++#if !defined(GRUB_UTIL) && !defined(__MINIOS__)
+ # undef memcpy
+ /* GCC emits references to memcpy() for struct copies etc. */
+ void *memcpy (void *dest, const void *src, int n) __attribute__ ((alias ("grub_memmove")));
+Index: grub/stage2/disk_io.c
+===================================================================
+--- grub.orig/stage2/disk_io.c 2008-06-16 15:18:03.327932000 +0100
++++ grub/stage2/disk_io.c 2008-06-16 15:18:14.733009000 +0100
+@@ -130,7 +130,14 @@
+ static inline unsigned long
+ log2 (unsigned long word)
+ {
+- asm volatile ("bsfl %1,%0"
++ asm volatile ("bsf"
++#ifdef __i386__
++ "l"
++#endif
++#ifdef __x86_64__
++ "q"
++#endif
++ " %1,%0"
+ : "=r" (word)
+ : "r" (word));
+ return word;
+Index: grub/stage2/fsys_fat.c
+===================================================================
+--- grub.orig/stage2/fsys_fat.c 2008-06-16 15:18:03.337934000 +0100
++++ grub/stage2/fsys_fat.c 2008-06-16 15:18:14.737009000 +0100
+@@ -57,7 +57,14 @@
+ static __inline__ unsigned long
+ log2 (unsigned long word)
+ {
+- __asm__ ("bsfl %1,%0"
++ __asm__ ("bsf"
++#ifdef __i386__
++ "l"
++#endif
++#ifdef __x86_64__
++ "q"
++#endif
++ " %1,%0"
+ : "=r" (word)
+ : "r" (word));
+ return word;
+Index: grub/stage2/pc_slice.h
+===================================================================
+--- grub.orig/stage2/pc_slice.h 2008-06-16 15:18:03.347932000 +0100
++++ grub/stage2/pc_slice.h 2008-06-16 15:18:14.746009000 +0100
+@@ -38,50 +38,50 @@
+ */
+
+ #define PC_MBR_CHECK_SIG(mbr_ptr) \
+- ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \
++ ( *( (unsigned short *) (((long) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \
+ == PC_MBR_SIGNATURE )
+
+ #define PC_MBR_SIG(mbr_ptr) \
+- ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) )
++ ( *( (unsigned short *) (((long) mbr_ptr) + PC_MBR_SIG_OFFSET) ) )
+
+ #define PC_SLICE_FLAG(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_HEAD(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 1 \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 1 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_SEC(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 2 \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 2 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_CYL(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 3 \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 3 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_TYPE(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 4 \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 4 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_EHEAD(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 5 \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 5 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_ESEC(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 6 \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 6 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_ECYL(mbr_ptr, part) \
+- ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 7 \
++ ( *( (unsigned char *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 7 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_START(mbr_ptr, part) \
+- ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 8 \
++ ( *( (unsigned long *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 8 \
+ + (part << 4)) ) )
+
+ #define PC_SLICE_LENGTH(mbr_ptr, part) \
+- ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 12 \
++ ( *( (unsigned long *) (((long) mbr_ptr) + PC_SLICE_OFFSET + 12 \
+ + (part << 4)) ) )
+
+
+Index: grub/stage2/shared.h
+===================================================================
+--- grub.orig/stage2/shared.h 2008-06-16 15:18:14.537009000 +0100
++++ grub/stage2/shared.h 2008-06-17 14:25:08.443906000 +0100
+@@ -39,6 +39,10 @@
+ extern char *grub_scratch_mem;
+ # define RAW_ADDR(x) ((x) + (int) grub_scratch_mem)
+ # define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4)
++#elif defined(__MINIOS__)
++extern char grub_scratch_mem[];
++# define RAW_ADDR(x) ((x) + (int) grub_scratch_mem)
++# define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4)
+ #else
+ # define RAW_ADDR(x) (x)
+ # define RAW_SEG(x) (x)
+@@ -707,7 +711,9 @@
+
+ /* Halt the system, using APM if possible. If NO_APM is true, don't use
+ APM even if it is available. */
++#ifndef __MINIOS__
+ void grub_halt (int no_apm) __attribute__ ((noreturn));
++#endif
+
+ /* Copy MAP to the drive map and set up int13_handler. */
+ void set_int13_handler (unsigned short *map);
+@@ -857,7 +863,8 @@
+ KERNEL_TYPE_BIG_LINUX, /* Big Linux. */
+ KERNEL_TYPE_FREEBSD, /* FreeBSD. */
+ KERNEL_TYPE_NETBSD, /* NetBSD. */
+- KERNEL_TYPE_CHAINLOADER /* Chainloader. */
++ KERNEL_TYPE_CHAINLOADER, /* Chainloader. */
++ KERNEL_TYPE_PV /* Paravirtualized. */
+ }
+ kernel_t;
+
+@@ -890,7 +897,7 @@
+ int grub_strlen (const char *str);
+ char *grub_strcpy (char *dest, const char *src);
+
+-#ifndef GRUB_UTIL
++#if !defined(GRUB_UTIL) && !defined(__MINIOS__)
+ typedef unsigned long grub_jmp_buf[6];
+ #else
+ /* In the grub shell, use the libc jmp_buf instead. */
+@@ -898,7 +905,7 @@
+ # define grub_jmp_buf jmp_buf
+ #endif
+
+-#ifdef GRUB_UTIL
++#if defined(GRUB_UTIL) || defined(__MINIOS__)
+ # define grub_setjmp setjmp
+ # define grub_longjmp longjmp
+ #else /* ! GRUB_UTIL */
+@@ -914,7 +921,7 @@
+ /* misc */
+ void init_page (void);
+ void print_error (void);
+-char *convert_to_ascii (char *buf, int c, ...);
++char *convert_to_ascii (char *buf, int c, int num);
+ int get_cmdline (char *prompt, char *cmdline, int maxlen,
+ int echo_char, int history);
+ int substring (const char *s1, const char *s2);
+Index: grub/netboot/etherboot.h
+===================================================================
+--- grub.orig/netboot/etherboot.h 2008-06-16 15:18:03.446934000 +0100
++++ grub/netboot/etherboot.h 2008-06-16 15:18:14.760009000 +0100
+@@ -246,7 +246,7 @@
+
+ typedef struct
+ {
+- unsigned long s_addr;
++ unsigned int s_addr;
+ }
+ in_addr;
+
+@@ -302,7 +302,7 @@
+ char bp_htype;
+ char bp_hlen;
+ char bp_hops;
+- unsigned long bp_xid;
++ unsigned int bp_xid;
+ unsigned short bp_secs;
+ unsigned short unused;
+ in_addr bp_ciaddr;
+@@ -411,25 +411,25 @@
+
+ struct
+ {
+- long id;
+- long type;
+- long rpcvers;
+- long prog;
+- long vers;
+- long proc;
+- long data[1];
++ int id;
++ int type;
++ int rpcvers;
++ int prog;
++ int vers;
++ int proc;
++ int data[1];
+ }
+ call;
+
+ struct
+ {
+- long id;
+- long type;
+- long rstatus;
+- long verifier;
+- long v2;
+- long astatus;
+- long data[1];
++ int id;
++ int type;
++ int rstatus;
++ int verifier;
++ int v2;
++ int astatus;
++ int data[1];
+ }
+ reply;
+ }
+@@ -517,7 +517,9 @@
+
+ /* misc.c */
+ extern void twiddle (void);
++#ifndef __MINIOS__
+ extern void sleep (int secs);
++#endif
+ extern int getdec (char **s);
+ extern void etherboot_printf (const char *, ...);
+ extern int etherboot_sprintf (char *, const char *, ...);
+Index: grub/stage2/common.c
+===================================================================
+--- grub.orig/stage2/common.c 2008-06-16 15:18:03.366934000 +0100
++++ grub/stage2/common.c 2008-06-16 15:18:14.764009000 +0100
+@@ -137,6 +137,7 @@
+ }
+ #endif /* ! STAGE1_5 */
+
++#ifndef __MINIOS__
+ /* This queries for BIOS information. */
+ void
+ init_bios_info (void)
+@@ -335,3 +336,4 @@
+ /* Start main routine here. */
+ cmain ();
+ }
++#endif
+Index: grub/stage2/serial.c
+===================================================================
+--- grub.orig/stage2/serial.c 2008-06-16 15:18:03.376934000 +0100
++++ grub/stage2/serial.c 2008-06-16 15:18:14.769009000 +0100
+@@ -37,7 +37,7 @@
+
+ /* Hardware-dependent definitions. */
+
+-#ifndef GRUB_UTIL
++#if !defined(GRUB_UTIL) && !defined(__MINIOS__)
+ /* The structure for speed vs. divisor. */
+ struct divisor
+ {
+@@ -222,6 +222,8 @@
+ {('3' | ('~' << 8)), 4},
+ {('5' | ('~' << 8)), 7},
+ {('6' | ('~' << 8)), 3},
++ {('7' | ('~' << 8)), 1},
++ {('8' | ('~' << 8)), 5},
+ };
+
+ /* The buffer must start with ``ESC [''. */
+Index: grub/stage2/tparm.c
+===================================================================
+--- grub.orig/stage2/tparm.c 2008-06-16 15:18:03.390933000 +0100
++++ grub/stage2/tparm.c 2008-06-16 15:18:14.774010000 +0100
+@@ -48,6 +48,7 @@
+ #include "shared.h"
+
+ #include "tparm.h"
++#include <stdarg.h>
+
+ /*
+ * Common/troublesome character definitions
+@@ -320,7 +321,7 @@
+ #define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
+
+ static inline char *
+-tparam_internal(const char *string, int *dataptr)
++tparam_internal(const char *string, va_list ap)
+ {
+ #define NUM_VARS 26
+ char *p_is_s[9];
+@@ -461,9 +462,9 @@
+ * a char* and an int may not be the same size on the stack.
+ */
+ if (p_is_s[i] != 0) {
+- p_is_s[i] = (char *)(*(dataptr++));
++ p_is_s[i] = va_arg(ap, char *);
+ } else {
+- param[i] = (int)(*(dataptr++));
++ param[i] = va_arg(ap, int);
+ }
+ }
+
+@@ -716,11 +717,13 @@
+ grub_tparm(const char *string,...)
+ {
+ char *result;
+- int *dataptr = (int *) &string;
++ va_list ap;
+
+- dataptr++;
++ va_start(ap, string);
+
+- result = tparam_internal(string, dataptr);
++ result = tparam_internal(string, ap);
++
++ va_end(ap);
+
+ return result;
+ }
+Index: grub/stage2/fsys_iso9660.c
+===================================================================
+--- grub.orig/stage2/fsys_iso9660.c 2008-06-16 15:18:03.400933000 +0100
++++ grub/stage2/fsys_iso9660.c 2008-06-16 15:18:14.779009000 +0100
+@@ -59,7 +59,14 @@
+ static inline unsigned long
+ log2 (unsigned long word)
+ {
+- asm volatile ("bsfl %1,%0"
++ asm volatile ("bsf"
++#ifdef __i386__
++ "l"
++#endif
++#ifdef __x86_64__
++ "q"
++#endif
++ " %1,%0"
+ : "=r" (word)
+ : "r" (word));
+ return word;
+Index: grub/stage2/fsys_reiserfs.c
+===================================================================
+--- grub.orig/stage2/fsys_reiserfs.c 2008-06-16 15:18:03.410933000 +0100
++++ grub/stage2/fsys_reiserfs.c 2008-06-16 15:18:14.786009000 +0100
+@@ -369,7 +369,14 @@
+ static __inline__ unsigned long
+ log2 (unsigned long word)
+ {
+- __asm__ ("bsfl %1,%0"
++ __asm__ ("bsf"
++#ifdef __i386__
++ "l"
++#endif
++#ifdef __x86_64__
++ "q"
++#endif
++ " %1,%0"
+ : "=r" (word)
+ : "r" (word));
+ return word;
+Index: grub/netboot/misc.c
+===================================================================
+--- grub.orig/netboot/misc.c 2008-06-16 15:18:03.456934000 +0100
++++ grub/netboot/misc.c 2008-06-16 15:18:14.790009000 +0100
+@@ -21,7 +21,9 @@
+
+ #define GRUB 1
+ #include <etherboot.h>
++#include <stdarg.h>
+
++#ifndef __MINIOS__
+ void
+ sleep (int secs)
+ {
+@@ -30,6 +32,7 @@
+ while (currticks () < tmo)
+ ;
+ }
++#endif
+
+ void
+ twiddle (void)
+@@ -71,7 +74,7 @@
+ Note: width specification not supported
+ **************************************************************************/
+ static int
+-etherboot_vsprintf (char *buf, const char *fmt, const int *dp)
++etherboot_vsprintf (char *buf, const char *fmt, va_list ap)
+ {
+ char *p, *s;
+
+@@ -86,7 +89,7 @@
+
+ if (*++fmt == 's')
+ {
+- for (p = (char *) *dp++; *p != '\0'; p++)
++ for (p = va_arg(ap, char *); *p != '\0'; p++)
+ buf ? *s++ = *p : grub_putchar (*p);
+ }
+ else
+@@ -121,11 +124,9 @@
+ if ((*fmt | 0x20) == 'x')
+ {
+ /* With x86 gcc, sizeof(long) == sizeof(int) */
+- const long *lp = (const long *) dp;
+- long h = *lp++;
++ long h = va_arg(ap, int);
+ int ncase = (*fmt & 0x20);
+
+- dp = (const int *) lp;
+ if (alt)
+ {
+ *q++ = '0';
+@@ -136,7 +137,7 @@
+ }
+ else if (*fmt == 'd')
+ {
+- int i = *dp++;
++ int i = va_arg(ap, int);
+ char *r;
+
+ if (i < 0)
+@@ -171,10 +172,8 @@
+ unsigned char c[4];
+ }
+ u;
+- const long *lp = (const long *) dp;
+
+- u.l = *lp++;
+- dp = (const int *) lp;
++ u.l = va_arg(ap, int);
+
+ for (r = &u.c[0]; r < &u.c[4]; ++r)
+ q += etherboot_sprintf (q, "%d.", *r);
+@@ -184,7 +183,7 @@
+ else if (*fmt == '!')
+ {
+ char *r;
+- p = (char *) *dp++;
++ p = va_arg(ap, char *);
+
+ for (r = p + ETH_ALEN; p < r; ++p)
+ q += etherboot_sprintf (q, "%hhX:", *p);
+@@ -192,7 +191,7 @@
+ --q;
+ }
+ else if (*fmt == 'c')
+- *q++ = *dp++;
++ *q++ = va_arg(ap, int);
+ else
+ *q++ = *fmt;
+
+@@ -211,13 +210,21 @@
+ int
+ etherboot_sprintf (char *buf, const char *fmt, ...)
+ {
+- return etherboot_vsprintf (buf, fmt, ((const int *) &fmt) + 1);
++ va_list ap;
++ int ret;
++ va_start(ap, fmt);
++ ret = etherboot_vsprintf (buf, fmt, ap);
++ va_end(ap);
++ return ret;
+ }
+
+ void
+ etherboot_printf (const char *fmt, ...)
+ {
+- (void) etherboot_vsprintf (0, fmt, ((const int *) &fmt) + 1);
++ va_list ap;
++ va_start(ap, fmt);
++ etherboot_vsprintf (0, fmt, ap);
++ va_end(ap);
+ }
+
+ int
+Index: grub/netboot/main.c
+===================================================================
+--- grub.orig/netboot/main.c 2008-06-16 15:18:03.470932000 +0100
++++ grub/netboot/main.c 2008-06-16 15:18:14.797009000 +0100
+@@ -55,7 +55,7 @@
+ static int vendorext_isvalid;
+ static unsigned long netmask;
+ static struct bootpd_t bootp_data;
+-static unsigned long xid;
++static unsigned int xid;
+
+ #define BOOTP_DATA_ADDR (&bootp_data)
+
+@@ -778,7 +778,7 @@
+
+ arpreply = (struct arprequest *) &nic.packet[ETH_HLEN];
+
+- if (arpreply->opcode == htons (ARP_REPLY)
++ if (arpreply->opcode == htons (ARP_REPLY) && ptr
+ && ! grub_memcmp (arpreply->sipaddr, ptr, sizeof (in_addr))
+ && type == AWAIT_ARP)
+ {
+@@ -827,7 +827,7 @@
+ {
+ arpreply = (struct arprequest *) &nic.packet[ETH_HLEN];
+
+- if (arpreply->opcode == htons (RARP_REPLY)
++ if (arpreply->opcode == htons (RARP_REPLY) && ptr
+ && ! grub_memcmp (arpreply->thwaddr, ptr, ETH_ALEN))
+ {
+ grub_memmove ((char *) arptable[ARP_SERVER].node,
+@@ -1135,7 +1135,7 @@
+ long
+ rfc2131_sleep_interval (int base, int exp)
+ {
+- static long seed = 0;
++ static unsigned seed = 0;
+ long q;
+ unsigned long tmo;
+
+Index: grub/stage2/graphics.c
+===================================================================
+--- grub.orig/stage2/graphics.c 2008-06-16 15:18:14.524009000 +0100
++++ grub/stage2/graphics.c 2008-06-17 14:29:05.204328000 +0100
+@@ -30,7 +30,29 @@
+ #include <shared.h>
+ #include <graphics.h>
+
++#ifdef __MINIOS__
++#include <stdint.h>
++typedef uint8_t Bit8u;
++#include <vgafonts.h>
++#include <fbfront.h>
++#include <malloc.h>
++#define set_int1c_handler() (void)0
++#define unset_int1c_handler() (void)0
++static uint32_t *VIDEOMEM;
++static struct fbfront_dev *fb_dev;
++static uint32_t palette[17];
++short cursorX, cursorY;
++/* TODO: blink */
++uint32_t cursorBuf32[16*8];
++#define WIDTH 640
++#define HEIGHT 480
++#define DEPTH 32
++#define RAMSIZE (WIDTH * HEIGHT * (DEPTH / 8))
++#else
++#define fbfront_update(dev, x, y, w, h) (void)0
+ int saved_videomode;
++#endif
++
+ unsigned char *font8x16;
+
+ int graphics_inited = 0;
+@@ -38,11 +60,15 @@
+
+ int shade = 1, no_cursor = 0;
+
++#ifdef __MINIOS__
++uint32_t VSHADOW[RAMSIZE];
++#else
+ #define VSHADOW VSHADOW1
+ unsigned char VSHADOW1[38400];
+ unsigned char VSHADOW2[38400];
+ unsigned char VSHADOW4[38400];
+ unsigned char VSHADOW8[38400];
++#endif
+
+ /* define the default viewable area */
+ int view_x0 = 0;
+@@ -129,6 +155,8 @@
+ count_lines = k;
+
+ no_scroll = 0;
++
++ fbfront_update(fb_dev, view_x0 * 8, view_y0 * 16, (view_x1 - view_x0) * 8, (view_y1 - view_y0) * 16);
+ }
+
+ /* Set the splash image */
+@@ -154,17 +182,29 @@
+ int graphics_init()
+ {
+ if (!graphics_inited) {
++#ifdef __MINIOS__
++ VIDEOMEM = memalign(PAGE_SIZE, RAMSIZE);
++ if (!(fb_dev = fb_open(VIDEOMEM, WIDTH, HEIGHT, DEPTH))) {
++ free(VIDEOMEM);
++ return 0;
++ }
++#else
+ saved_videomode = set_videomode(0x12);
+ if (get_videomode() != 0x12) {
+ set_videomode(saved_videomode);
+ return 0;
+ }
++#endif
+ graphics_inited = 1;
+ }
+ else
+ return 1;
+
++#ifdef __MINIOS__
++ font8x16 = vgafont16;
++#else
+ font8x16 = (unsigned char*)graphics_get_font();
++#endif
+
+ /* make sure that the highlight color is set correctly */
+ graphics_highlight_color = ((graphics_normal_color >> 4) |
+@@ -176,7 +216,11 @@
+ grub_printf("Failed to read splash image (%s)\n", splashimage);
+ grub_printf("Press any key to continue...");
+ getkey();
++#ifdef __MINIOS__
++ fb_close();
++#else
+ set_videomode(saved_videomode);
++#endif
+ graphics_inited = 0;
+ return 0;
+ }
+@@ -190,8 +234,13 @@
+ void graphics_end(void)
+ {
+ if (graphics_inited) {
++#ifdef __MINIOS__
++ fb_close();
++ free(VIDEOMEM);
++#else
+ unset_int1c_handler();
+ set_videomode(saved_videomode);
++#endif
+ graphics_inited = 0;
+ no_cursor = 0;
+ }
+@@ -204,15 +253,19 @@
+ graphics_cursor(0);
+
+ if (ch == '\n') {
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ if (fonty + 1 < view_y1)
+ graphics_setxy(fontx, fonty + 1);
+ else
+ graphics_scroll();
+ graphics_cursor(1);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ return;
+ } else if (ch == '\r') {
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ graphics_setxy(view_x0, fonty);
+ graphics_cursor(1);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ return;
+ }
+
+@@ -224,6 +277,7 @@
+ text[fonty * 80 + fontx] |= 0x100;
+
+ graphics_cursor(0);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+
+ if ((fontx + 1) >= view_x1) {
+ graphics_setxy(view_x0, fonty);
+@@ -232,13 +286,16 @@
+ else
+ graphics_scroll();
+ graphics_cursor(1);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ do_more ();
+ graphics_cursor(0);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ } else {
+ graphics_setxy(fontx + 1, fonty);
+ }
+
+ graphics_cursor(1);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ }
+
+ /* get the current location of the cursor */
+@@ -248,10 +305,12 @@
+
+ void graphics_gotoxy(int x, int y) {
+ graphics_cursor(0);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+
+ graphics_setxy(x, y);
+
+ graphics_cursor(1);
++ fbfront_update(fb_dev, cursorX, cursorY, 8, 16);
+ }
+
+ void graphics_cls(void) {
+@@ -262,15 +321,21 @@
+ graphics_gotoxy(view_x0, view_y0);
+
+ mem = (unsigned char*)VIDEOMEM;
++#ifndef __MINIOS__
+ s1 = (unsigned char*)VSHADOW1;
+ s2 = (unsigned char*)VSHADOW2;
+ s4 = (unsigned char*)VSHADOW4;
+ s8 = (unsigned char*)VSHADOW8;
++#endif
+
+ for (i = 0; i < 80 * 30; i++)
+ text[i] = ' ';
+ graphics_cursor(1);
+
++#ifdef __MINIOS__
++ memcpy(mem, VSHADOW, RAMSIZE);
++ fbfront_update(fb_dev, 0, 0, 640, 480);
++#else
+ BitMask(0xff);
+
+ /* plane 1 */
+@@ -290,6 +355,7 @@
+ grub_memcpy(mem, s8, 38400);
+
+ MapMask(15);
++#endif
+
+ if (no_cursor) {
+ no_cursor = 0;
+@@ -337,6 +403,11 @@
+ return 0;
+ }
+
++void graphics_set_palette(int idx, int red, int green, int blue)
++{
++ palette[idx] = (red << (16 + 2)) | (green << (8 + 2)) | (blue << 2);
++}
++
+ /* Read in the splashscreen image and set the palette up appropriately.
+ * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
+ * 640x480. */
+@@ -413,18 +484,19 @@
+ }
+
+ if (len == 6 && idx < 15) {
+- int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2;
+- int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2;
+- int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2;
++ int r = ((hex(buf[0]) << 4) | hex(buf[1]));
++ int g = ((hex(buf[2]) << 4) | hex(buf[3]));
++ int b = ((hex(buf[4]) << 4) | hex(buf[5]));
+
+ pal[idx] = base;
+- graphics_set_palette(idx, r, g, b);
++ graphics_set_palette(idx, r / 4, g / 4, b / 4);
+ ++idx;
+ }
+ }
+
+ x = y = len = 0;
+
++#ifndef __MINIOS__
+ s1 = (unsigned char*)VSHADOW1;
+ s2 = (unsigned char*)VSHADOW2;
+ s4 = (unsigned char*)VSHADOW4;
+@@ -432,6 +504,7 @@
+
+ for (i = 0; i < 38400; i++)
+ s1[i] = s2[i] = s4[i] = s8[i] = 0;
++#endif
+
+ /* parse xpm data */
+ while (y < height) {
+@@ -451,6 +524,9 @@
+ break;
+ }
+
++#ifdef __MINIOS__
++ VSHADOW[x + y * 640] = palette[i];
++#else
+ mask = 0x80 >> (x & 7);
+ if (c & 1)
+ s1[len + (x >> 3)] |= mask;
+@@ -460,6 +536,7 @@
+ s4[len + (x >> 3)] |= mask;
+ if (c & 8)
+ s8[len + (x >> 3)] |= mask;
++#endif
+
+ if (++x >= 640) {
+ x = 0;
+@@ -494,7 +571,13 @@
+ }
+
+ void graphics_cursor(int set) {
+- unsigned char *pat, *mem, *ptr, chr[16 << 2];
++ unsigned char *pat;
++#ifdef __MINIOS__
++ uint32_t *mem, *ptr, chr[16 * 8];
++ int j;
++#else
++ unsigned char *mem, *ptr, chr[16 << 2];
++#endif
+ int i, ch, invert, offset;
+
+ if (set && (no_cursor || no_scroll))
+@@ -505,71 +588,127 @@
+ invert = (text[fonty * 80 + fontx] & 0xff00) != 0;
+ pat = font8x16 + (ch << 4);
+
+- mem = (unsigned char*)VIDEOMEM + offset;
++ mem = (unsigned char*)VIDEOMEM + offset
++#ifdef __MINIOS__
++ * 8 * 4
++#endif
++ ;
+
+ if (!set) {
+ for (i = 0; i < 16; i++) {
+ unsigned char mask = pat[i];
+
+ if (!invert) {
++#ifdef __MINIOS__
++ memcpy(chr + i * 8, VSHADOW + offset * 8, 8 * 4);
++#else
+ chr[i ] = ((unsigned char*)VSHADOW1)[offset];
+ chr[16 + i] = ((unsigned char*)VSHADOW2)[offset];
+ chr[32 + i] = ((unsigned char*)VSHADOW4)[offset];
+ chr[48 + i] = ((unsigned char*)VSHADOW8)[offset];
++#endif
+
+ if (shade) {
+ if (ch == DISP_VERT || ch == DISP_LL ||
+ ch == DISP_UR || ch == DISP_LR) {
+ unsigned char pmask = ~(pat[i] >> 1);
+
++#ifdef __MINIOS__
++ for (j = 0; j < 8; j++)
++ if (!(pmask & (1U << j)))
++ chr[i * 8 + (7 - j)] = palette[0];
++#else
+ chr[i ] &= pmask;
+ chr[16 + i] &= pmask;
+ chr[32 + i] &= pmask;
+ chr[48 + i] &= pmask;
++#endif
+ }
+ if (i > 0 && ch != DISP_VERT) {
+ unsigned char pmask = ~(pat[i - 1] >> 1);
+
++#ifdef __MINIOS__
++ for (j = 0; j < 8; j++)
++ if (!(pmask & (1U << j)))
++ chr[i * 8 + (7 - j)] = palette[0];
++#else
+ chr[i ] &= pmask;
+ chr[16 + i] &= pmask;
+ chr[32 + i] &= pmask;
+ chr[48 + i] &= pmask;
++#endif
+ if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) {
+ pmask = ~pat[i - 1];
+
++#ifdef __MINIOS__
++ for (j = 0; j < 8; j++)
++ if (!(pmask & (1U << j)))
++ chr[i * 8 + (7 - j)] = palette[0];
++#else
+ chr[i ] &= pmask;
+ chr[16 + i] &= pmask;
+ chr[32 + i] &= pmask;
+ chr[48 + i] &= pmask;
++#endif
+ }
+ }
+ }
++#ifdef __MINIOS__
++ for (j = 0; j < 8; j++)
++ if (mask & (1U << j))
++ chr[i * 8 + (7 - j)] = palette[15];
++#else
+ chr[i ] |= mask;
+ chr[16 + i] |= mask;
+ chr[32 + i] |= mask;
+ chr[48 + i] |= mask;
++#endif
+
+ offset += 80;
+ }
+ else {
++#ifdef __MINIOS__
++ for (j = 0; j < 8; j++)
++ if (mask & (1U << j))
++ chr[i * 8 + (7 - j)] = palette[15];
++ else
++ chr[i * 8 + (7 - j)] = palette[0];
++#else
+ chr[i ] = mask;
+ chr[16 + i] = mask;
+ chr[32 + i] = mask;
+ chr[48 + i] = mask;
++#endif
+ }
+ }
+ }
+ else {
++#ifdef __MINIOS__
++ ptr = mem;
++ for (i = 0; i < 16; i++, ptr += 80 * 8)
++ for (j = 0; j < 8; j++) {
++ if (pat[i] & (1U << (7 - j)))
++ cursorBuf32[i * 8 + j] = ptr[j] = palette[0];
++ else
++ cursorBuf32[i * 8 + j] = ptr[j] = palette[15];
++ }
++#else
+ MapMask(15);
+ ptr = mem;
+ for (i = 0; i < 16; i++, ptr += 80) {
+ cursorBuf[i] = pat[i];
+ *ptr = ~pat[i];
+ }
++#endif
+ return;
+ }
+
+ offset = 0;
++#ifdef __MINIOS__
++ ptr = mem;
++ for (j = 0; j < 16; j++, ptr += 80 * 8)
++ memcpy(ptr, chr + j * 8 + offset * 8, 8 * 4);
++#else
+ for (i = 1; i < 16; i <<= 1, offset += 16) {
+ int j;
+
+@@ -580,6 +719,7 @@
+ }
+
+ MapMask(15);
++#endif
+ }
+
+ #endif /* SUPPORT_GRAPHICS */
+Index: grub/stage2/graphics.h
+===================================================================
+--- grub.orig/stage2/graphics.h 2008-06-16 15:18:14.527010000 +0100
++++ grub/stage2/graphics.h 2008-06-16 15:18:14.805010000 +0100
+@@ -21,8 +21,10 @@
+ #ifndef GRAPHICS_H
+ #define GRAPHICS_H
+
++#ifndef __MINIOS__
+ /* magic constant */
+ #define VIDEOMEM 0xA0000
++#endif
+
+ /* function prototypes */
+ char *graphics_get_splash(void);
+Index: grub/stage2/stage2.c
+===================================================================
+--- grub.orig/stage2/stage2.c 2008-06-17 11:06:47.873523000 +0100
++++ grub/stage2/stage2.c 2008-06-17 11:07:05.225628000 +0100
+@@ -31,10 +31,10 @@
+ #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS)
+
+ # if defined(PRESET_MENU_STRING)
+-static const char *preset_menu = PRESET_MENU_STRING;
++const char *preset_menu = PRESET_MENU_STRING;
+ # elif defined(SUPPORT_DISKLESS)
+ /* Execute the command "bootp" automatically. */
+-static const char *preset_menu = "bootp\n";
++const char *preset_menu = "bootp\n";
+ # endif /* SUPPORT_DISKLESS */
+
+ static int preset_menu_offset;