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:
parent
daf0f0ba3e
commit
e5dfe7775a
17 changed files with 1315 additions and 300 deletions
107
include/multiboot2.h
Normal file
107
include/multiboot2.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
/* multiboot2.h - multiboot 2 header file. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MULTIBOOT2_HEADER
|
||||
#define MULTIBOOT2_HEADER 1
|
||||
|
||||
/* How many bytes from the start of the file we search for the header. */
|
||||
#define MULTIBOOT2_HEADER_SEARCH 8192
|
||||
|
||||
/* The magic field should contain this. */
|
||||
#define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
|
||||
|
||||
/* Passed from the bootloader to the kernel. */
|
||||
#define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
|
||||
|
||||
/* Alignment of multiboot modules. */
|
||||
#define MULTIBOOT2_MOD_ALIGN 0x00001000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
/* XXX not portable? */
|
||||
#if __WORDSIZE == 64
|
||||
typedef uint64_t multiboot_word;
|
||||
#else
|
||||
typedef uint32_t multiboot_word;
|
||||
#endif
|
||||
|
||||
struct multiboot_header
|
||||
{
|
||||
uint32_t magic;
|
||||
};
|
||||
|
||||
struct multiboot_tag_header
|
||||
{
|
||||
uint32_t key;
|
||||
uint32_t len;
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_RESERVED1 0
|
||||
#define MULTIBOOT2_TAG_RESERVED2 (~0)
|
||||
|
||||
#define MULTIBOOT2_TAG_START 1
|
||||
struct multiboot_tag_start
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
multiboot_word size; /* Total size of all multiboot tags. */
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_NAME 2
|
||||
struct multiboot_tag_name
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
char name[1];
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_MODULE 3
|
||||
struct multiboot_tag_module
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
multiboot_word addr;
|
||||
multiboot_word size;
|
||||
unsigned char type[36];
|
||||
unsigned char cmdline[1];
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_MEMORY 4
|
||||
struct multiboot_tag_memory
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
multiboot_word addr;
|
||||
multiboot_word size;
|
||||
multiboot_word type;
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_UNUSED 5
|
||||
struct multiboot_tag_unused
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_END 0xffff
|
||||
struct multiboot_tag_end
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
};
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! MULTIBOOT2_HEADER */
|
Loading…
Add table
Add a link
Reference in a new issue