[ipxe-devel] [PATCH 4/6] [multiboot2] stub out multiboot2 support

Doug Goldstein cardoe at cardoe.com
Thu Jan 26 21:34:59 UTC 2017


From: Jonathan Creekmore <jonathan at thecreekmores.org>

Signed-off-by: Jonathan Creekmore <jonathan at thecreekmores.org>
---
 src/arch/x86/image/multiboot2.c     | 76 ++++++++++++++++++++++++++++++-
 src/arch/x86/include/bits/errfile.h |  1 +-
 src/include/ipxe/features.h         |  1 +-
 3 files changed, 78 insertions(+)
 create mode 100644 src/arch/x86/image/multiboot2.c

diff --git a/src/arch/x86/image/multiboot2.c b/src/arch/x86/image/multiboot2.c
new file mode 100644
index 0000000..503a549
--- /dev/null
+++ b/src/arch/x86/image/multiboot2.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2016 Star Lab Corp.
+ *
+ * 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; either version 2 of the
+ * License, or any later version.
+ *
+ * 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 Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+/**
+ * @file
+ *
+ * Multiboot2 image format
+ *
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <assert.h>
+#include <multiboot2.h>
+#include <ipxe/uaccess.h>
+#include <ipxe/image.h>
+#include <ipxe/segment.h>
+#include <ipxe/io.h>
+#include <ipxe/elf.h>
+#include <ipxe/init.h>
+#include <ipxe/features.h>
+#include <ipxe/uri.h>
+#include <ipxe/version.h>
+
+FEATURE ( FEATURE_IMAGE, "MBOOT2", DHCP_EB_FEATURE_MULTIBOOT2, 1 );
+
+/**
+ * Execute multiboot2 image
+ *
+ * @v image		Multiboot image
+ * @ret rc		Return status code
+ */
+static int multiboot2_exec ( struct image *image ) {
+	(void)image;
+	return -ENOEXEC;
+}
+
+/**
+ * Probe multiboot2 image
+ *
+ * @v image		Multiboot file
+ * @ret rc		Return status code
+ */
+static int multiboot2_probe ( struct image *image ) {
+	(void)image;
+	return -ENOEXEC;
+}
+
+/** Multiboot image type */
+struct image_type multiboot2_image_type __image_type ( PROBE_MULTIBOOT2 ) = {
+	.name = "Multiboot 2",
+	.probe = multiboot2_probe,
+	.exec = multiboot2_exec,
+};
diff --git a/src/arch/x86/include/bits/errfile.h b/src/arch/x86/include/bits/errfile.h
index 9d1fed7..3ff20a7 100644
--- a/src/arch/x86/include/bits/errfile.h
+++ b/src/arch/x86/include/bits/errfile.h
@@ -42,6 +42,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define ERRFILE_sdi	       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000b0000 )
 #define ERRFILE_initrd	       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000c0000 )
 #define ERRFILE_pxe_call       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000d0000 )
+#define ERRFILE_multiboot2     ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000e0000 )
 
 #define ERRFILE_undi		 ( ERRFILE_ARCH | ERRFILE_NET | 0x00000000 )
 #define ERRFILE_undiload	 ( ERRFILE_ARCH | ERRFILE_NET | 0x00010000 )
diff --git a/src/include/ipxe/features.h b/src/include/ipxe/features.h
index e86a2d2..985c414 100644
--- a/src/include/ipxe/features.h
+++ b/src/include/ipxe/features.h
@@ -55,6 +55,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define DHCP_EB_FEATURE_MENU		0x27 /**< Menu support */
 #define DHCP_EB_FEATURE_SDI		0x28 /**< SDI image support */
 #define DHCP_EB_FEATURE_NFS		0x29 /**< NFS protocol */
+#define DHCP_EB_FEATURE_MULTIBOOT2	0x2a /**< Multiboot2 format */
 
 /** @} */
 
-- 
git-series 0.9.1



More information about the ipxe-devel mailing list