Skip to content

Instantly share code, notes, and snippets.

@nonakap
Last active May 3, 2016 16:03
Show Gist options
  • Select an option

  • Save nonakap/61f8c2c723b29229550411660a21aa04 to your computer and use it in GitHub Desktop.

Select an option

Save nonakap/61f8c2c723b29229550411660a21aa04 to your computer and use it in GitHub Desktop.
GRUB to pass the EFI System Table PA to NetBSD https://mail-index.netbsd.org/tech-kern/2014/05/22/msg017119.html
Index: sysutils/grub2/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/grub2/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- sysutils/grub2/Makefile 3 May 2016 10:54:56 -0000 1.8
+++ sysutils/grub2/Makefile 3 May 2016 15:59:21 -0000
@@ -2,7 +2,7 @@
DISTNAME= grub-2.00
PKGNAME= ${DISTNAME:S/grub/grub2/}
-PKGREVISION= 4
+PKGREVISION= 5
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.gnu.org/gnu/grub/
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
Index: sysutils/grub2/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/grub2/distinfo,v
retrieving revision 1.6
diff -u -p -r1.6 distinfo
--- sysutils/grub2/distinfo 3 May 2016 14:53:14 -0000 1.6
+++ sysutils/grub2/distinfo 3 May 2016 15:59:21 -0000
@@ -9,12 +9,15 @@ RMD160 (unifont-5.1.20080820.pcf.gz) = d
SHA512 (unifont-5.1.20080820.pcf.gz) = 8939e2bc82ca97b60e6678f3ff079a2be7ba9b702f2e8ee289e853af5823695f7baafbf14b674fc5e41071f2a6de4f2dadd56bf8b4653849dd756d59622f1649
Size (unifont-5.1.20080820.pcf.gz) = 1379965 bytes
SHA1 (patch-configure) = 5bc08d640943e59c795113a4375a712c1932ccff
+SHA1 (patch-grub-core_commands_efi_lsefisystab.c) = 384966181023125c4442152c828589ed875a6f68
SHA1 (patch-grub-core_lib_posix__wrap_sys_types.h) = 7510953e7bbed347f5d53e4535c309c365ba2bcd
SHA1 (patch-grub-core_lib_posix__wrap_wchar.h) = 6509696c2d5e008634b710c63cb836664d0f8a89
SHA1 (patch-grub-core_lib_xzembed_xz__dec__lzma2.c) = 9b9be69e60e17b81f4e776579b093d429ac7e22c
+SHA1 (patch-grub-core_loader_i386_bsd.c) = 581d688895c01651e288646b0a563f6f060a9c1e
SHA1 (patch-grub-core_loader_i386_pc_plan9.c) = 07c909c02210ef59647185cd9b7f43b35d58515c
SHA1 (patch-grub-core_net_bootp.c) = 4ba82627a38f1942d3a289eba191f46e0e22603f
SHA1 (patch-grub-core_script_yylex.l) = 1645d167b90d1862b2d9990dfe7c357778d9a952
+SHA1 (patch-include_grub_i386_netbsd_bootinfo.h) = 30c493022fc50aae33d9096a381b9c598a77aa1a
SHA1 (patch-stpcpy-1.diff) = d31f8d607900fdde950d3828279d5b3b09812a39
SHA1 (patch-stpcpy-2-gen.diff) = 8b2d08cfe798386eec7d70a3946e7a9430e75254
SHA1 (patch-util_getroot.c) = 009b499772c864cc82dee75658442a071327a1c9
Index: sysutils/grub2/patches/patch-grub-core_commands_efi_lsefisystab.c
===================================================================
RCS file: sysutils/grub2/patches/patch-grub-core_commands_efi_lsefisystab.c
diff -N sysutils/grub2/patches/patch-grub-core_commands_efi_lsefisystab.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/grub2/patches/patch-grub-core_commands_efi_lsefisystab.c 3 May 2016 15:59:21 -0000
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- grub-core/commands/efi/lsefisystab.c.orig 2011-04-12 04:39:12.000000000 +0900
++++ grub-core/commands/efi/lsefisystab.c 2016-05-04 00:39:58.618933487 +0900
+@@ -51,7 +51,10 @@
+ const grub_efi_system_table_t *st = grub_efi_system_table;
+ grub_efi_configuration_table_t *t;
+ unsigned int i;
++ grub_uint64_t pa;
++ memcpy(&pa, &st, sizeof(pa));
+
++ grub_printf ("Address: %016" PRIxGRUB_UINT64_T "\n", pa);
+ grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n",
+ st->hdr.signature, st->hdr.revision);
+ {
Index: sysutils/grub2/patches/patch-grub-core_loader_i386_bsd.c
===================================================================
RCS file: sysutils/grub2/patches/patch-grub-core_loader_i386_bsd.c
diff -N sysutils/grub2/patches/patch-grub-core_loader_i386_bsd.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/grub2/patches/patch-grub-core_loader_i386_bsd.c 3 May 2016 15:59:21 -0000
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- grub-core/loader/i386/bsd.c.orig 2012-06-07 22:06:00.000000000 +0900
++++ grub-core/loader/i386/bsd.c 2016-05-04 00:39:58.619913680 +0900
+@@ -1129,6 +1129,16 @@
+ if (err)
+ return err;
+
++/* XXX */
++#ifdef GRUB_MACHINE_EFI
++{
++ err = grub_bsd_add_meta (NETBSD_BTINFO_EFI,
++ &grub_efi_system_table, sizeof(void *));
++ if (err)
++ return err;
++}
++#endif
++
+ {
+ struct bsd_tag *tag;
+ tag_buf_len = 0;
Index: sysutils/grub2/patches/patch-include_grub_i386_netbsd_bootinfo.h
===================================================================
RCS file: sysutils/grub2/patches/patch-include_grub_i386_netbsd_bootinfo.h
diff -N sysutils/grub2/patches/patch-include_grub_i386_netbsd_bootinfo.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/grub2/patches/patch-include_grub_i386_netbsd_bootinfo.h 3 May 2016 15:59:21 -0000
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- include/grub/i386/netbsd_bootinfo.h.orig 2011-11-09 23:05:40.000000000 +0900
++++ include/grub/i386/netbsd_bootinfo.h 2016-05-04 00:47:54.165014212 +0900
+@@ -58,6 +58,8 @@
+ #define NETBSD_BTINFO_BOOTWEDGE 10
+ #define NETBSD_BTINFO_MODULES 11
+ #define NETBSD_BTINFO_FRAMEBUF 12
++#define NETBSD_BTINFO_USERCONFCOMMANDS 13
++#define NETBSD_BTINFO_EFI 14
+
+ struct grub_netbsd_bootinfo
+ {
+@@ -146,4 +148,9 @@
+
+ #define GRUB_NETBSD_MAX_ROOTDEVICE_LEN 16
+
++struct grub_netbsd_btinfo_efi
++{
++ void *pa_systbl; /* Physical address of the EFI System Table */
++};
++
+ #endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment