diff -u -r grub-orig/ChangeLog grub/ChangeLog
--- grub-orig/ChangeLog	Sun Sep 24 23:17:19 2000
+++ grub/ChangeLog	Mon Sep 25 15:43:25 2000
@@ -1,3 +1,9 @@
+2000-09-20  Matt Yourst  <yourst@mit.edu>
+
+	* Added APM BIOS detection and pass APM version/entrypoint data
+	according to Multiboot specification (revised/clarified for APM.)
+	* Preparation for Linux 2.4 Multiboot capabilities.
+	
 2000-09-12  OKUJI Yoshinori  <okuji@gnu.org>
 
 	Add additional magic to avoid a bug in Linux. *sigh*
diff -u -r grub-orig/NEWS grub/NEWS
--- grub-orig/NEWS	Sun Sep 24 23:17:18 2000
+++ grub/NEWS	Mon Sep 25 15:44:42 2000
@@ -35,6 +35,8 @@
 * New command, "savedefault". Now you can save current entry number to
   your disk with this command and then you can set the default boot
   entry to it by the command "default saved".
+* Linux 2.4 Multiboot kernel support: APM BIOS tables and video mode
+	information can now be passed to Multiboot kernels.
 
 New in 0.5.95 - 2000-06-27:
 * NetBSD ELF kernel support is added. You have to specify the new option
diff -u -r grub-orig/README grub/README
--- grub-orig/README	Sun Sep 24 23:17:18 2000
+++ grub/README	Mon Sep 25 15:39:07 2000
@@ -6,8 +6,8 @@
   - recognizes fdisk partitions and BSD disklabels
   - can dynamically read Linux ext2fs and ReiserFS, BSD ufs, MS-DOS
     FAT16 and FAT32, and Minix fs filesystems, plus hardcoded blocklists
-  - can boot Multiboot-compliant kernels (such as GNU Mach), as well
-    as standard Linux and *BSD kernels
+  - can boot Multiboot-compliant kernels (such as GNU Mach and some
+		Linux 2.4 kernels), as well as standard Linux and *BSD kernels
 
 See the file NEWS for a description of recent changes to GRUB.
 
diff -u -r grub-orig/THANKS grub/THANKS
--- grub-orig/THANKS	Sun Sep 24 23:17:18 2000
+++ grub/THANKS	Mon Sep 25 15:40:35 2000
@@ -34,6 +34,7 @@
 Kunihiro Ishiguro <kunihiro@zebra.org>
 M. Meiarashi <mes@st.rim.or.jp>
 Mark Lundeberg <aa026@pgfn.bc.ca>
+Matt Yourst <yourst@mit.edu>
 Matthias Kretschmer <m.kretschmer@bsdger.org>
 Michael Hohmuth <hohmuth@innocent.com>
 Mike Meyer <mwm@mired.org>
diff -u -r grub-orig/grub/asmstub.c grub/grub/asmstub.c
--- grub-orig/grub/asmstub.c	Sun Sep 24 23:17:18 2000
+++ grub/grub/asmstub.c	Mon Sep 25 00:34:37 2000
@@ -423,6 +423,12 @@
   return 0;
 }
 
+void grub_get_apm_info (void)
+{
+	return;
+}
+
+struct apm_bios_info apm_bios_info = {0, };
 
 /* low-level timing info */
 int
diff -u -r grub-orig/stage2/asm.S grub/stage2/asm.S
--- grub-orig/stage2/asm.S	Sun Sep 24 23:17:19 2000
+++ grub/stage2/asm.S	Mon Sep 25 00:29:34 2000
@@ -275,7 +275,80 @@
 	/* shouldn't reach here */
 	jmp	EXT_C(hard_stop)
 	.code32
-	
+
+ENTRY(grub_get_apm_info)
+	pushl	%ebp
+	movl	%esp, %ebp
+
+	pushl	%ebx
+	pushl	%edi
+	pushl	%esi
+
+	call	EXT_C(prot_to_real)
+	.code16
+#	movw	$0, 0x40			# version = 0 means no APM BIOS (??? ++MTY)
+	movw	$0x05300, %ax			# APM BIOS installation check
+	xorw	%bx, %bx
+	int	$0x15
+	DATA32 jc	done_apm_bios			# Nope, no APM BIOS
+
+	cmpw	$0x0504d, %bx			# Check for "PM" signature
+	DATA32 jne	done_apm_bios			# No signature, no APM BIOS
+
+	andw	$0x02, %cx			# Is 32 bit supported?
+	DATA32 je	done_apm_bios			# No 32-bit, no (good) APM BIOS
+
+	movw	$0x05304, %ax			# Disconnect first just in case
+	xorw	%bx, %bx
+	DATA32 int	$0x15				# ignore return code
+	movw	$0x05303, %ax			# 32 bit connect
+	xorl	%ebx, %ebx
+	xorw	%cx, %cx			# paranoia :-)
+	xorw	%dx, %dx			#   ...
+	xorl	%esi, %esi			#   ...
+	xorw	%di, %di			#   ...
+	int	$0x15
+	DATA32 jc	no_32_apm_bios			# Ack, error. 
+
+	movw	%ax,  (ABS(apm_bios_info)+2) 	# BIOS code segment
+	movl	%ebx, (ABS(apm_bios_info)+4)	# BIOS entry point offset
+	movw	%cx,  (ABS(apm_bios_info)+8)	# BIOS 16 bit code segment
+	movw	%dx,  (ABS(apm_bios_info)+10)	# BIOS data segment
+	movl	%esi, (ABS(apm_bios_info)+14)	# BIOS code segment lengths
+	movw	%di,  (ABS(apm_bios_info)+18)	# BIOS data segment length
+# Redo the installation check as the 32 bit connect
+# modifies the flags returned on some BIOSs
+	movw	$0x05300, %ax			# APM BIOS installation check
+	xorw	%bx, %bx
+	xorw	%cx, %cx			# paranoia
+	int	$0x15
+	DATA32 jc	apm_disconnect			# error -> should not happen
+
+	cmpw	$0x0504d, %bx			# check for "PM" signature
+	DATA32 jne	apm_disconnect			# no sig -> should not happen
+
+	movw	%ax, (ABS(apm_bios_info)+0) 	# record the APM BIOS version
+	movw	%cx, (ABS(apm_bios_info)+12)	# and flags
+	DATA32 jmp	done_apm_bios
+
+apm_disconnect:					# Tidy up
+	movw	$0x05304, %ax			# Disconnect
+	xorw	%bx, %bx
+	int	$0x15				# ignore return code
+
+	DATA32 jmp	done_apm_bios
+
+no_32_apm_bios:
+	andw	$0xfffd, (76)			# remove 32 bit support bit
+done_apm_bios:
+	DATA32	call EXT_C(real_to_prot)
+	.code32
+	popl  %esi
+	popl  %edi
+	popl  %ebx
+	popl  %ebp
+	ret
+
 /*
  * track_int13(int drive)
  *
@@ -2123,6 +2196,18 @@
 segment:
 	.word	0
 
+/* Linux-style APM BIOS information table */
+VARIABLE(apm_bios_info)
+	.word 0 /* version */
+	.word 0 /* cseg */
+	.long 0 /* offset */
+	.word 0 /* cseg_16 */
+	.word 0 /* dseg */
+	.word 0 /* flags */
+	.word 0 /* cseg_len */
+	.word 0 /* cseg_16_len */
+	.word 0 /* dseg_len */	
+	
 /*
  * This is the Global Descriptor Table
  *
diff -u -r grub-orig/stage2/builtins.c grub/stage2/builtins.c
--- grub-orig/stage2/builtins.c	Sun Sep 24 23:17:19 2000
+++ grub/stage2/builtins.c	Mon Sep 25 00:48:16 2000
@@ -860,6 +860,46 @@
 };
 
 
+
+/* apmbios */
+static int
+apminfo_func (char *arg, int flags)
+{
+	struct apm_bios_info* apm;
+
+	if (!(mbi.flags & MB_INFO_APM_TABLE)) {
+		grub_printf("APM BIOS was not detected\n");
+		return -1;
+	}
+
+	apm = (struct apm_bios_info*)mbi.apm_table;
+
+	grub_printf("APM BIOS Information:\n\n");
+
+	grub_printf("APM BIOS version:      0x%x\n", apm->version);
+	grub_printf("Entry CS:              0x%x\n", apm->cseg);
+	grub_printf("Entry offset:          0x%x\n", apm->offset);
+	grub_printf("Entry 16-bit CS:       0x%x\n", apm->cseg_16);
+	grub_printf("Entry DS:              0x%x\n", apm->dseg);
+	grub_printf("Flags:                 0x%x\n", apm->flags);
+	grub_printf("Entry CS length:       0x%x\n", apm->cseg_len);
+	grub_printf("Entry CS16 length:     0x%x\n", apm->cseg_16_len);
+	grub_printf("Entry DS length:       0x%x\n", apm->dseg_len);
+	grub_printf("\n");
+
+  return 0;
+}
+
+static struct builtin builtin_apminfo =
+{
+  "apminfo",
+  apminfo_func,
+  BUILTIN_CMDLINE,
+  "apminfo",
+  "Display the APM BIOS information table, if an APM BIOS was detected."
+};
+
+
 /* embed */
 /* Embed a Stage 1.5 in the first cylinder after MBR or in the
    bootloader block in a FFS.  */
@@ -3704,6 +3744,7 @@
 /* The table of builtin commands. Sorted in dictionary order.  */
 struct builtin *builtin_table[] =
 {
+  &builtin_apminfo,
   &builtin_blocklist,
   &builtin_boot,
   &builtin_bootp,
diff -u -r grub-orig/stage2/common.c grub/stage2/common.c
--- grub-orig/stage2/common.c	Sun Sep 24 23:17:19 2000
+++ grub/stage2/common.c	Mon Sep 25 00:39:01 2000
@@ -266,6 +266,17 @@
 
   mbi.flags = MB_INFO_MEMORY | MB_INFO_CMDLINE | MB_INFO_BOOTDEV;
 
+	/*
+	 *  Get the APM information from the APM BIOS (if any)
+	 */
+	grub_get_apm_info();
+	if (apm_bios_info.version) {
+		mbi.flags |= MB_INFO_APM_TABLE;
+		mbi.apm_table = (unsigned long)&apm_bios_info;
+	} else {
+		mbi.apm_table = NULL;
+	}
+
 #endif /* STAGE1_5 */
 
 #ifdef SUPPORT_DISKLESS
diff -u -r grub-orig/stage2/mb_info.h grub/stage2/mb_info.h
--- grub-orig/stage2/mb_info.h	Sun Sep 24 23:17:19 2000
+++ grub/stage2/mb_info.h	Mon Sep 25 00:20:06 2000
@@ -110,6 +110,22 @@
     /* Memory Mapping buffer */
     unsigned long mmap_length;
     unsigned long mmap_addr;
+
+		/* Drive Parameters */
+		unsigned long drives_count;
+		unsigned long drives_addr;
+
+		/* BIOS configuration table */
+		unsigned long config_table;
+
+		/* Boot loader name string */
+		unsigned long boot_loader_name;
+
+		/* APM BIOS information table */
+		unsigned long apm_table;
+
+		/* VESA/VGA graphics table */
+		unsigned long graphics_table;
   };
 
 /*
@@ -134,6 +150,16 @@
 
 /* is there a full memory map? */
 #define MB_INFO_MEM_MAP         0x40
+/* is the hard drive parameter table present? */
+#define MB_INFO_DRIVE_PARAMS    0x80
+/* is the BIOS configuration table present? */
+#define MB_INFO_BIOS_CONFIG     0x100
+/* is the name of the boot loader present? */
+#define MB_INFO_BOOT_LOADER     0x200
+/* is the APM BIOS information table present? */
+#define MB_INFO_APM_TABLE       0x400
+/* is the VESA/VGA graphics table present? */
+#define MB_INFO_GRAPHICS_TABLE  0x800
 
 /*
  *  The following value must be present in the EAX register.
diff -u -r grub-orig/stage2/shared.h grub/stage2/shared.h
--- grub-orig/stage2/shared.h	Sun Sep 24 23:17:19 2000
+++ grub/stage2/shared.h	Mon Sep 25 00:02:05 2000
@@ -474,6 +474,20 @@
 extern char config_file[];
 extern unsigned long linux_text_len;
 
+struct apm_bios_info {
+	unsigned short	version;
+	unsigned short	cseg;
+	unsigned long	offset;
+	unsigned short	cseg_16;
+	unsigned short	dseg;
+	unsigned short	flags;
+	unsigned short	cseg_len;
+	unsigned short	cseg_16_len;
+	unsigned short	dseg_len;
+};
+
+extern struct apm_bios_info apm_bios_info;
+
 #ifdef GRUB_UTIL
 /* If not using config file, this variable is set to zero,
    otherwise non-zero.  */
@@ -593,6 +607,10 @@
 /* Halt the system, using APM if possible. If NO_APM is true, don't use
    APM even if it is available.  */
 void grub_halt (int no_apm) __attribute__ ((noreturn));
+
+/* Fill in the apm_bios_info structure with the APM BIOS info,
+   if an APM BIOS is present.  */
+void grub_get_apm_info (void);
 
 /* Copy MAP to the drive map and set up int13_handler.  */
 void set_int13_handler (unsigned short *map);
