[coreboot] New patch to review: 0966f88 Add multiboot header

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Mon Sep 5 13:40:15 CEST 2011


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/197

-gerrit

commit 0966f88267d3723b22d8a5c088cb7daeab21e953
Author: Mathias Krause <mathias.krause at secunet.com>
Date:   Tue Jun 7 13:53:31 2011 +0200

    Add multiboot header
    
    Change-Id: Ibe8e879a3a6f533f97aa8381697afb1f14d1f87d
    Signed-off-by: Mathias Krause <mathias.krause at secunet.com>
    Signed-off-by: Patrick Georgi <patrick.georgi at secunet.com>
---
 Config.in         |    7 +++++++
 i386/ldscript     |    2 +-
 main/Makefile.inc |    1 +
 main/mb_hdr.c     |   32 ++++++++++++++++++++++++++++++++
 4 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/Config.in b/Config.in
index b1da531..251bd2a 100644
--- a/Config.in
+++ b/Config.in
@@ -9,6 +9,13 @@ config TARGET_I386
 	bool
 	default y
 
+config MULTIBOOT_IMAGE
+	bool "Include a MultiBoot header"
+	default y
+	help
+	  Including a MultiBoot header makes FILO chainloadable by MultiBoot
+	  compliant boot loaders like GRUB.
+
 menu "Interface Options"
 
 config USE_GRUB
diff --git a/i386/ldscript b/i386/ldscript
index 7fba856..b260c51 100644
--- a/i386/ldscript
+++ b/i386/ldscript
@@ -40,7 +40,7 @@ SECTIONS
     /* Start of the program. 
      * Now the version string is in the note, we must include it
      * in the program. Otherwise we lose the string after relocation. */
-    . = ALIGN(16);
+    . = ALIGN(4096);
     _start = .;
 
     /* Putting ELF notes near beginning of file might help bootloaders.
diff --git a/main/Makefile.inc b/main/Makefile.inc
index c7290cf..e2fab04 100644
--- a/main/Makefile.inc
+++ b/main/Makefile.inc
@@ -16,6 +16,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
+TARGETS-$(CONFIG_MULTIBOOT_IMAGE) += main/mb_hdr.o
 TARGETS-y += main/filo.o main/strtox.o
 TARGETS-y += main/elfload.o main/ipchecksum.o 
 TARGETS-$(CONFIG_SUPPORT_SOUND) += main/sound.o
diff --git a/main/mb_hdr.c b/main/mb_hdr.c
new file mode 100644
index 0000000..bb01427
--- /dev/null
+++ b/main/mb_hdr.c
@@ -0,0 +1,32 @@
+/*
+ * This file is part of FILO.
+ *
+ * This program 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; version 2 of the License.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+/* Support for MultiBoot */
+#define MB_HEADER_MAGIC		0x1BADB002
+#define MB_RQ_FLAGS_4K		1
+#define MB_REQUESTED_FLAGS	(MB_RQ_FLAGS_4K)
+
+/* this header is parsed by the boot loader that loads FILO, e.g. GRUB */
+struct mb_header {
+	long magic;		/* multiboot magic */
+	long features;	/* requested features */
+	long chksum;	/* chksum for whole structure */
+} mb_header __attribute__((section(".hdr.mb"))) = {
+	.magic = MB_HEADER_MAGIC,
+	.features = MB_REQUESTED_FLAGS,
+	.chksum = -(MB_HEADER_MAGIC + MB_REQUESTED_FLAGS),
+};




More information about the coreboot mailing list