This patch is to introduce multiboot 2 loading capabilities to grub2

for powerpc & i386-pc. This patch was more so started by Hollis
Blanchard getting multiboot 2 working for powerpc and I added to it
and cleaned it up.

One of the ideas with this patch is to keep everything under one
command for the user. So instead of having a "multiboot2" & "module2"
command, I created a proxy like mechanism so that you have only one
command for both multiboot 1 & 2 ... "multiboot". This is where
"loader/multiboot_loader.c" comes from. I could have integrated things
more but I figure the current approach will less likely break
anything.

So if your OS is multiboot 2 capable, the user would do the following
to load it up from a grub prompt:

grub> multiboot <location of kernel> <kernel args>
grub> module <some image> <multiboot tag> <image arguments>
grub> module <isome mage> <multiboot tag> <image arguments>
grub .....


The other thing that this patch does is it begins to make the
multiboot 1 code a bit more architecture agnostic so IF someone wanted
to implement it on another architecture they can.

A bit of file moving around and definition renaming is also apart of
this patch. I have also taken the time to make sure that it does not
break multiboot 1 loading on i386-pc. But mulitboot 2 may still need a
little more testing and work for i386-pc. Powerpc multiboot 2 has been
heavily tested and does work.
This commit is contained in:
jerone 2007-07-25 00:44:03 +00:00
parent daf0f0ba3e
commit e5dfe7775a
17 changed files with 1315 additions and 300 deletions

View file

@ -49,7 +49,8 @@
#include <grub/machine/console.h>
#include <grub/cpu/linux.h>
#include <grub/machine/kernel.h>
#include <grub/machine/multiboot.h>
#include <multiboot.h>
#include <multiboot2.h>
#define ABS(x) ((x) - EXT_C(start) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
@ -813,10 +814,31 @@ FUNCTION(grub_multiboot_real_boot)
cli
/* Move the magic value into eax and jump to the kernel. */
movl $GRUB_MB_MAGIC2,%eax
movl $MULTIBOOT_MAGIC2,%eax
popl %ecx
jmp *%ecx
/*
* This starts the multiboot 2 kernel.
*/
FUNCTION(grub_multiboot2_real_boot)
/* Push the entry address on the stack. */
pushl %eax
/* Move the address of the multiboot information structure to ebx. */
movl %edx,%ebx
/* Unload all modules and stop the floppy driver. */
call EXT_C(grub_dl_unload_all)
call EXT_C(grub_stop_floppy)
/* Interrupts should be disabled. */
cli
/* Move the magic value into eax and jump to the kernel. */
movl $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
popl %ecx
jmp *%ecx
/*
* int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)