diff --git a/0070-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0070-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 0a8b4d1..245c977 100644 --- a/0070-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0070-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -1,4 +1,4 @@ -From 93653ab62a8c139654fc798fc4c7d74db267b2ee Mon Sep 17 00:00:00 2001 +From f14de1eb2cbd8aa451a231c9000f157a6e29b093 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 6 Oct 2015 16:09:25 -0400 Subject: [PATCH 70/88] Make any of the loaders that link in efi mode honor @@ -24,9 +24,11 @@ Signed-off-by: Peter Jones grub-core/loader/xnu.c | 7 +++++ include/grub/efi/efi.h | 1 - include/grub/efi/sb.h | 29 +++++++++++++++++++ - 15 files changed, 146 insertions(+), 29 deletions(-) + include/grub/powerpc/linux.h | 23 +++++++++++++++ + 16 files changed, 169 insertions(+), 29 deletions(-) create mode 100644 grub-core/kern/efi/sb.c create mode 100644 include/grub/efi/sb.h + create mode 100644 include/grub/powerpc/linux.h diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 04e9395..fd715a8 100644 @@ -469,6 +471,35 @@ index 0000000..9629fbb +int EXPORT_FUNC (grub_efi_secure_boot) (void); + +#endif /* ! GRUB_EFI_SB_HEADER */ +diff --git a/include/grub/powerpc/linux.h b/include/grub/powerpc/linux.h +new file mode 100644 +index 0000000..6cecb2e +--- /dev/null ++++ b/include/grub/powerpc/linux.h +@@ -0,0 +1,23 @@ ++/* linux.h - PowerPC linux specific definitions */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 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 . ++ */ ++ ++#ifndef GRUB_LINUX_CPU_HEADER ++#define GRUB_LINUX_CPU_HEADER 1 ++ ++#endif /* ! GRUB_LINUX_CPU_HEADER */ -- 2.5.5 diff --git a/0071-Fix-security-issue-when-reading-username-and-passwor.patch b/0071-Fix-security-issue-when-reading-username-and-passwor.patch index 7add7ef..aea437e 100644 --- a/0071-Fix-security-issue-when-reading-username-and-passwor.patch +++ b/0071-Fix-security-issue-when-reading-username-and-passwor.patch @@ -1,4 +1,4 @@ -From 115128428dfd5552605152180ebe227d4b1e7b4e Mon Sep 17 00:00:00 2001 +From a350e596100ebdea5f698f81a58332118aee9841 Mon Sep 17 00:00:00 2001 From: Hector Marco-Gisbert Date: Fri, 13 Nov 2015 16:21:09 +0100 Subject: [PATCH 71/88] Fix security issue when reading username and password diff --git a/0072-01_users-Handle-GRUB_PASSWORD-better.patch b/0072-01_users-Handle-GRUB_PASSWORD-better.patch index afee8d3..8f9b933 100644 --- a/0072-01_users-Handle-GRUB_PASSWORD-better.patch +++ b/0072-01_users-Handle-GRUB_PASSWORD-better.patch @@ -1,4 +1,4 @@ -From 2a3ab6ddcff1015e9c6df6a1f61779d581e9a26d Mon Sep 17 00:00:00 2001 +From 8deb795073874f4f2153a6e26bfe3fb8dd03a301 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 4 Dec 2015 09:28:38 -0500 Subject: [PATCH 72/88] 01_users: Handle GRUB_PASSWORD better. diff --git a/0073-Core-TPM-support.patch b/0073-Core-TPM-support.patch index a5b377a..10d0301 100644 --- a/0073-Core-TPM-support.patch +++ b/0073-Core-TPM-support.patch @@ -1,4 +1,4 @@ -From 4fa25a258abddce2c1c8a27decc4b9f554f731b8 Mon Sep 17 00:00:00 2001 +From 5517beacf74d58f5f80b0ca8b9b739ef4594930d Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 14 Jul 2015 17:06:35 -0700 Subject: [PATCH 73/88] Core TPM support diff --git a/0074-Measure-kernel-initrd.patch b/0074-Measure-kernel-initrd.patch index 42be695..ba17ee1 100644 --- a/0074-Measure-kernel-initrd.patch +++ b/0074-Measure-kernel-initrd.patch @@ -1,4 +1,4 @@ -From d24a5cf53175a3498b9c67a97ca6ad5604d0a678 Mon Sep 17 00:00:00 2001 +From ef38c89ec0a5898df9e9d50707baa3e705d60921 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Thu, 16 Jul 2015 15:22:34 -0700 Subject: [PATCH 74/88] Measure kernel + initrd diff --git a/0075-Add-BIOS-boot-measurement.patch b/0075-Add-BIOS-boot-measurement.patch index 23062cd..907f7eb 100644 --- a/0075-Add-BIOS-boot-measurement.patch +++ b/0075-Add-BIOS-boot-measurement.patch @@ -1,4 +1,4 @@ -From 69b26d3068903f543e0a7ba949c76d63467b10d5 Mon Sep 17 00:00:00 2001 +From 4990275dd9084a0ad3e544a5ca841b8cd0e06254 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 15:48:51 -0700 Subject: [PATCH 75/88] Add BIOS boot measurement diff --git a/0076-Rework-linux-command.patch b/0076-Rework-linux-command.patch index 7385d1b..59979ec 100644 --- a/0076-Rework-linux-command.patch +++ b/0076-Rework-linux-command.patch @@ -1,4 +1,4 @@ -From 47beae47e49806881000c479a5912d3bf2990da4 Mon Sep 17 00:00:00 2001 +From 7774b9780271782da56834b49f4f4ffd8e5b40c4 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:12:39 -0700 Subject: [PATCH 76/88] Rework linux command diff --git a/0077-Rework-linux16-command.patch b/0077-Rework-linux16-command.patch index a613d8e..55f06db 100644 --- a/0077-Rework-linux16-command.patch +++ b/0077-Rework-linux16-command.patch @@ -1,4 +1,4 @@ -From 4cd88ca039d62e64ee4ccbe46a4ea3500a70a6be Mon Sep 17 00:00:00 2001 +From a696b8eb6ea6e5a2a17b697f8b8f9ed0a57a0a96 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:20:58 -0700 Subject: [PATCH 77/88] Rework linux16 command diff --git a/0078-Measure-kernel-and-initrd-on-BIOS-systems.patch b/0078-Measure-kernel-and-initrd-on-BIOS-systems.patch index a87b474..7eaf8ce 100644 --- a/0078-Measure-kernel-and-initrd-on-BIOS-systems.patch +++ b/0078-Measure-kernel-and-initrd-on-BIOS-systems.patch @@ -1,4 +1,4 @@ -From 05f686df4b9a012035854b082bb4c3b7c745da28 Mon Sep 17 00:00:00 2001 +From 443457897a9b415e6b7f7f41e93f78947b15d206 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:28:29 -0700 Subject: [PATCH 78/88] Measure kernel and initrd on BIOS systems diff --git a/0079-Measure-the-kernel-commandline.patch b/0079-Measure-the-kernel-commandline.patch index 7747be2..0cbd62b 100644 --- a/0079-Measure-the-kernel-commandline.patch +++ b/0079-Measure-the-kernel-commandline.patch @@ -1,4 +1,4 @@ -From 2ab937cba72f43241667db08b5e36cd31a77f331 Mon Sep 17 00:00:00 2001 +From 484cfd345f144e98639816de5c28696a1085f06f Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:32:29 -0700 Subject: [PATCH 79/88] Measure the kernel commandline diff --git a/0080-Measure-commands.patch b/0080-Measure-commands.patch index 570e887..472d2d5 100644 --- a/0080-Measure-commands.patch +++ b/0080-Measure-commands.patch @@ -1,4 +1,4 @@ -From e3aae28751e0f0128d877ed25b28d4d2f875b71a Mon Sep 17 00:00:00 2001 +From e6dbf1fb12a951b9d3c3e19b80852ce6c53b516c Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Mon, 10 Aug 2015 15:27:12 -0700 Subject: [PATCH 80/88] Measure commands diff --git a/0081-Measure-multiboot-images-and-modules.patch b/0081-Measure-multiboot-images-and-modules.patch index 66656fa..31786ef 100644 --- a/0081-Measure-multiboot-images-and-modules.patch +++ b/0081-Measure-multiboot-images-and-modules.patch @@ -1,4 +1,4 @@ -From ee0acf80b073cf652a949673bd750e7a9a302d37 Mon Sep 17 00:00:00 2001 +From cdcff708c76890986b9e3ae9be084da6b152adde Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 1 Sep 2015 16:02:55 -0700 Subject: [PATCH 81/88] Measure multiboot images and modules diff --git a/0082-Make-grub-editenv-build-again.patch b/0082-Make-grub-editenv-build-again.patch index ce04883..a7f27a3 100644 --- a/0082-Make-grub-editenv-build-again.patch +++ b/0082-Make-grub-editenv-build-again.patch @@ -1,4 +1,4 @@ -From 1c4338a7d3921e18364c696c679e77e23e7193b3 Mon Sep 17 00:00:00 2001 +From 0b2a179c9e1da39556fffd6a70ced539e41652e5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 4 Mar 2016 16:29:13 -0500 Subject: [PATCH 82/88] Make grub-editenv build again. diff --git a/0083-Fix-locale-issue-in-grub-setpassword-1294243.patch b/0083-Fix-locale-issue-in-grub-setpassword-1294243.patch index 18a80a1..a2c3c89 100644 --- a/0083-Fix-locale-issue-in-grub-setpassword-1294243.patch +++ b/0083-Fix-locale-issue-in-grub-setpassword-1294243.patch @@ -1,4 +1,4 @@ -From d477086463fd9ea61a3df4b55a4adde56c386215 Mon Sep 17 00:00:00 2001 +From ee96c8d2dc827a1a4016bc9641d01b95c82155dd Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Fri, 29 Jan 2016 17:34:02 -0500 Subject: [PATCH 83/88] Fix locale issue in grub-setpassword (#1294243) diff --git a/0084-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0084-Fix-up-some-man-pages-rpmdiff-noticed.patch index adf6cb3..12ef7b5 100644 --- a/0084-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0084-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -1,4 +1,4 @@ -From b4e66576c9fd1602aeb924b13cdc39d8c59a4255 Mon Sep 17 00:00:00 2001 +From 30a9147b7c93cbfd673fb0811d2e0f22b98cc498 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 23 Sep 2014 09:58:49 -0400 Subject: [PATCH 84/88] Fix up some man pages rpmdiff noticed. diff --git a/0085-Handle-rssd-storage-devices.patch b/0085-Handle-rssd-storage-devices.patch index 91a66c9..01c68d9 100644 --- a/0085-Handle-rssd-storage-devices.patch +++ b/0085-Handle-rssd-storage-devices.patch @@ -1,4 +1,4 @@ -From 54d0f8d24fc634b71e8525703a6eea8c23f4c9e5 Mon Sep 17 00:00:00 2001 +From e78fda79e6171ab84d1d332197e46455b695f259 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 30 Jun 2015 15:50:41 -0400 Subject: [PATCH 85/88] Handle rssd storage devices. diff --git a/0086-Fix-boot-when-there-s-no-TPM.patch b/0086-Fix-boot-when-there-s-no-TPM.patch index f48cb4f..60f1f2e 100644 --- a/0086-Fix-boot-when-there-s-no-TPM.patch +++ b/0086-Fix-boot-when-there-s-no-TPM.patch @@ -1,4 +1,4 @@ -From a9c95bf3bb50ee171c80e9fe643da618afa8fdf9 Mon Sep 17 00:00:00 2001 +From d06b75f95d8d61d55b4af0b0dcb0c6717fe228d0 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 23 Mar 2016 16:49:42 -0700 Subject: [PATCH 86/88] Fix boot when there's no TPM diff --git a/0087-Rework-TPM-measurements.patch b/0087-Rework-TPM-measurements.patch index d67d9cb..45b29fd 100644 --- a/0087-Rework-TPM-measurements.patch +++ b/0087-Rework-TPM-measurements.patch @@ -1,4 +1,4 @@ -From 1388967d903a07c92a39fa4e8573f7ba12f45357 Mon Sep 17 00:00:00 2001 +From dd5035e338e7362db6ef5560e3dff09a255ef797 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 23 Mar 2016 17:03:43 -0700 Subject: [PATCH 87/88] Rework TPM measurements diff --git a/0088-Fix-event-log-prefix.patch b/0088-Fix-event-log-prefix.patch index 3d087f2..2aae18e 100644 --- a/0088-Fix-event-log-prefix.patch +++ b/0088-Fix-event-log-prefix.patch @@ -1,4 +1,4 @@ -From 3fded5274e9d0968fac6d37ee16f2f2d53b8594d Mon Sep 17 00:00:00 2001 +From 84b0d0562f890820097726827e98f27a789011fc Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 29 Mar 2016 15:36:49 -0700 Subject: [PATCH 88/88] Fix event log prefix diff --git a/10001-Put-the-correct-.file-directives-in-our-.S-files.patch b/10001-Put-the-correct-.file-directives-in-our-.S-files.patch index d6891f3..d06775a 100644 --- a/10001-Put-the-correct-.file-directives-in-our-.S-files.patch +++ b/10001-Put-the-correct-.file-directives-in-our-.S-files.patch @@ -1,7 +1,7 @@ -From b29ab8b194e3543aa481568e4af0e9ffbad01636 Mon Sep 17 00:00:00 2001 +From 1b2af2de1b5d9d5780cf6803124c18f460466c3c Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 21 Jul 2015 20:30:00 -0400 -Subject: [PATCH 1/6] Put the correct .file directives in our .S files. +Subject: [PATCH 10001/10006] Put the correct .file directives in our .S files. The wrong path makes generating debuginfo not work correctly. @@ -41,10 +41,10 @@ Signed-off-by: Peter Jones 31 files changed, 32 insertions(+), 32 deletions(-) diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S -index ea167fe..96ced2f 100644 +index c1df86d..8eb8fc8 100644 --- a/grub-core/boot/i386/pc/boot.S +++ b/grub-core/boot/i386/pc/boot.S -@@ -108,7 +108,7 @@ cylinder_start: +@@ -112,7 +112,7 @@ cylinder_start: /* more space... */ .endm @@ -67,10 +67,10 @@ index de4f809..d30b4be 100644 #define CODE_ADDR 0x6000 #define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200) diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S -index c8b87ed..14c6d83 100644 +index 05dd7fa..9c0b32a 100644 --- a/grub-core/boot/i386/pc/diskboot.S +++ b/grub-core/boot/i386/pc/diskboot.S -@@ -25,7 +25,7 @@ +@@ -27,7 +27,7 @@ #define MSG(x) movw $x, %si; call LOCAL(message) @@ -360,7 +360,7 @@ index a5373d3..6f58685 100644 GRUB_MOD_LICENSE "GPLv3+" diff --git a/grub-core/lib/arm64/setjmp.S b/grub-core/lib/arm64/setjmp.S -index eabfd99..006660b 100644 +index ffcabf6..7755d06 100644 --- a/grub-core/lib/arm64/setjmp.S +++ b/grub-core/lib/arm64/setjmp.S @@ -19,7 +19,7 @@ @@ -399,12 +399,12 @@ index a0382d8..dba2cbf 100644 GRUB_MOD_LICENSE "GPLv2+" diff --git a/grub-core/lib/mips/setjmp.S b/grub-core/lib/mips/setjmp.S -index f012945..365824c 100644 +index 895235b..fa9c16e 100644 --- a/grub-core/lib/mips/setjmp.S +++ b/grub-core/lib/mips/setjmp.S -@@ -19,7 +19,7 @@ - #include +@@ -20,7 +20,7 @@ #include + #include - .file "setjmp.S" + .file "grub-core/lib/mips/setjmp.S" @@ -451,5 +451,5 @@ index 6b151bc..c975897 100644 GRUB_MOD_LICENSE "GPLv3+" -- -2.4.3 +2.5.0 diff --git a/10002-Make-efi-machines-load-an-env-block-from-a-variable.patch b/10002-Make-efi-machines-load-an-env-block-from-a-variable.patch deleted file mode 100644 index eb89e2e..0000000 --- a/10002-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 5804ce3d46ef5792ea4aa53e1460c341137961e9 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 25 Jun 2015 11:59:09 -0400 -Subject: [PATCH 2/6] Make efi machines load an env block from a variable - -Signed-off-by: Peter Jones ---- - grub-core/Makefile.core.def | 1 + - grub-core/kern/efi/init.c | 32 ++++++++++++++++++++++++++++++++ - 2 files changed, 33 insertions(+) - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 38291ce..b3ba5ed 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -174,6 +174,7 @@ kernel = { - efi = kern/efi/init.c; - efi = kern/efi/mm.c; - efi = term/efi/console.c; -+ efi = lib/envblk.c; - - x86 = kern/i386/tsc.c; - -diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index e9c85de..d17d18e 100644 ---- a/grub-core/kern/efi/init.c -+++ b/grub-core/kern/efi/init.c -@@ -25,9 +25,40 @@ - #include - #include - #include -+#include - - grub_addr_t grub_modbase; - -+#define GRUB_EFI_GRUB_VARIABLE_GUID \ -+ { 0x91376aff, 0xcba6, 0x42be, \ -+ { 0x94, 0x9d, 0x06, 0xfd, 0xe8, 0x11, 0x28, 0xe8 } \ -+ } -+ -+/* Helper for grub_efi_env_init */ -+static int -+set_var (const char *name, const char *value, -+ void *whitelist __attribute__((__unused__))) -+{ -+ grub_env_set (name, value); -+ return 0; -+} -+ -+static void -+grub_efi_env_init (void) -+{ -+ grub_efi_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID; -+ struct grub_envblk envblk_s = { NULL, 0 }; -+ grub_envblk_t envblk = &envblk_s; -+ -+ envblk_s.buf = grub_efi_get_variable ("GRUB_ENV", &efi_grub_guid, -+ &envblk_s.size); -+ if (!envblk_s.buf || envblk_s.size < 1) -+ return; -+ -+ grub_envblk_iterate (envblk, NULL, set_var); -+ grub_free (envblk_s.buf); -+} -+ - void - grub_efi_init (void) - { -@@ -42,6 +73,7 @@ grub_efi_init (void) - efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer, - 0, 0, 0, NULL); - -+ grub_efi_env_init (); - grub_efidisk_init (); - } - --- -2.4.3 - diff --git a/10002-Make-it-possible-to-enabled-build-id-sha1.patch b/10002-Make-it-possible-to-enabled-build-id-sha1.patch new file mode 100644 index 0000000..1f100e3 --- /dev/null +++ b/10002-Make-it-possible-to-enabled-build-id-sha1.patch @@ -0,0 +1,64 @@ +From 5334ed8ae9c8f15928139be986a1e877e9837630 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 25 Jun 2015 15:41:06 -0400 +Subject: [PATCH 10002/10006] Make it possible to enabled --build-id=sha1 + +Signed-off-by: Peter Jones +--- + acinclude.m4 | 19 +++++++++++++++++++ + configure.ac | 8 ++++++++ + 2 files changed, 27 insertions(+) + +diff --git a/acinclude.m4 b/acinclude.m4 +index 526f97a..48ccecc 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then + fi + ]) + ++dnl Supply --build-id=sha1 to ld if building modules. ++dnl This suppresses warnings from ld on some systems ++AC_DEFUN([grub_PROG_LD_BUILD_ID_SHA1], ++[AC_MSG_CHECKING([whether linker accepts --build-id=sha1]) ++AC_CACHE_VAL(grub_cv_prog_ld_build_id_sha1, ++[save_LDFLAGS="$LDFLAGS" ++LDFLAGS="$LDFLAGS -Wl,--build-id=sha1" ++AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_prog_ld_build_id_sha1=yes], ++ [grub_cv_prog_ld_build_id_sha1=no]) ++LDFLAGS="$save_LDFLAGS" ++]) ++AC_MSG_RESULT([$grub_cv_prog_ld_build_id_sha1]) ++ ++if test "x$grub_cv_prog_ld_build_id_sha1" = xyes; then ++ TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=sha1" ++fi ++]) ++ + dnl Check nm + AC_DEFUN([grub_PROG_NM_WORKS], + [AC_MSG_CHECKING([whether nm works]) +diff --git a/configure.ac b/configure.ac +index d6ef6c3..3e897bd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1323,7 +1323,15 @@ grub_PROG_TARGET_CC + if test "x$TARGET_APPLE_LINKER" != x1 ; then + grub_PROG_OBJCOPY_ABSOLUTE + fi ++ ++AC_ARG_ENABLE([build-id], ++ [AS_HELP_STRING([--enable-build-id], ++ [ask the linker to supply build-id notes (default=no)])]) ++if test x$enable_build_id = xyes; then ++grub_PROG_LD_BUILD_ID_SHA1 ++else + grub_PROG_LD_BUILD_ID_NONE ++fi + if test "x$target_cpu" = xi386; then + if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then + if test ! -z "$TARGET_IMG_LDSCRIPT"; then +-- +2.5.0 + diff --git a/10003-Don-t-tell-the-compiler-to-do-annoying-things-with-.patch b/10003-Don-t-tell-the-compiler-to-do-annoying-things-with-.patch new file mode 100644 index 0000000..82f8e86 --- /dev/null +++ b/10003-Don-t-tell-the-compiler-to-do-annoying-things-with-.patch @@ -0,0 +1,88 @@ +From ddc6702d0b258e12f67f0df7c3c915a04ede1067 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 28 Jun 2015 17:57:24 -0400 +Subject: [PATCH 10003/10006] Don't tell the compiler to do annoying things + with -f. + +--- + configure.ac | 48 ++---------------------------------------------- + 1 file changed, 2 insertions(+), 46 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 3e897bd..65f7f43 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -548,8 +548,8 @@ LDFLAGS="$TARGET_LDFLAGS" + LIBS="" + + # debug flags. +-TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" +-TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" ++TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g3 -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" ++TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g3" + + if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then + TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align" +@@ -908,21 +908,6 @@ if test x"$target_cpu" = xsparc64 ; then + TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax" + fi + +-# By default, GCC 4.4 generates .eh_frame sections containing unwind +-# information in some cases where it previously did not. GRUB doesn't need +-# these and they just use up vital space. Restore the old compiler +-# behaviour. +-AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ +- CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], +- [grub_cv_cc_fno_dwarf2_cfi_asm=yes], +- [grub_cv_cc_fno_dwarf2_cfi_asm=no]) +-]) +- +-if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then +- TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" +-fi +- + if test x"$target_os" = xcygwin; then + AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [ + CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" +@@ -947,37 +932,8 @@ if test "x$grub_cv_cc_mno_stack_arg_probe" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" + fi + +- +-# By default, GCC 4.6 generates .eh_frame sections containing unwind +-# information in some cases where it previously did not. GRUB doesn't need +-# these and they just use up vital space. Restore the old compiler +-# behaviour. +-AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [ +- CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], +- [grub_cv_cc_fno_asynchronous_unwind_tables=yes], +- [grub_cv_cc_fno_asynchronous_unwind_tables=no]) +-]) +- +-if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then +- TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables" +-fi +- +-AC_CACHE_CHECK([whether -fno-unwind-tables works], [grub_cv_cc_fno_unwind_tables], [ +- CFLAGS="$TARGET_CFLAGS -fno-unwind-tables" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], +- [grub_cv_cc_fno_unwind_tables=yes], +- [grub_cv_cc_fno_unwind_tables=no]) +-]) +- +-if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then +- TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables" +-fi +- +- + CFLAGS="$TARGET_CFLAGS" + +- + if test x"$platform" = xemu ; then + TARGET_OBJ2ELF= + grub_cv_target_cc_link_format= +-- +2.5.0 + diff --git a/10003-Make-it-possible-to-enabled-build-id-sha1.patch b/10003-Make-it-possible-to-enabled-build-id-sha1.patch deleted file mode 100644 index ab53021..0000000 --- a/10003-Make-it-possible-to-enabled-build-id-sha1.patch +++ /dev/null @@ -1,64 +0,0 @@ -From bdcd66a767a861370e55a3c2d624383a1f2ec2f5 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 25 Jun 2015 15:41:06 -0400 -Subject: [PATCH 3/6] Make it possible to enabled --build-id=sha1 - -Signed-off-by: Peter Jones ---- - acinclude.m4 | 19 +++++++++++++++++++ - configure.ac | 8 ++++++++ - 2 files changed, 27 insertions(+) - -diff --git a/acinclude.m4 b/acinclude.m4 -index 609c4f2..8dd0989 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then - fi - ]) - -+dnl Supply --build-id=sha1 to ld if building modules. -+dnl This suppresses warnings from ld on some systems -+AC_DEFUN([grub_PROG_LD_BUILD_ID_SHA1], -+[AC_MSG_CHECKING([whether linker accepts --build-id=sha1]) -+AC_CACHE_VAL(grub_cv_prog_ld_build_id_sha1, -+[save_LDFLAGS="$LDFLAGS" -+LDFLAGS="$LDFLAGS -Wl,--build-id=sha1" -+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -+ [grub_cv_prog_ld_build_id_sha1=yes], -+ [grub_cv_prog_ld_build_id_sha1=no]) -+LDFLAGS="$save_LDFLAGS" -+]) -+AC_MSG_RESULT([$grub_cv_prog_ld_build_id_sha1]) -+ -+if test "x$grub_cv_prog_ld_build_id_sha1" = xyes; then -+ TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=sha1" -+fi -+]) -+ - dnl Check nm - AC_DEFUN([grub_PROG_NM_WORKS], - [AC_MSG_CHECKING([whether nm works]) -diff --git a/configure.ac b/configure.ac -index 991cb15..8d780e3 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1202,7 +1202,15 @@ grub_PROG_TARGET_CC - if test "x$TARGET_APPLE_LINKER" != x1 ; then - grub_PROG_OBJCOPY_ABSOLUTE - fi -+ -+AC_ARG_ENABLE([build-id], -+ [AS_HELP_STRING([--enable-build-id], -+ [ask the linker to supply build-id notes (default=no)])]) -+if test x$enable_build_id = xyes; then -+grub_PROG_LD_BUILD_ID_SHA1 -+else - grub_PROG_LD_BUILD_ID_NONE -+fi - if test "x$target_cpu" = xi386; then - if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then - if test ! -z "$TARGET_IMG_LDSCRIPT"; then --- -2.4.3 - diff --git a/10004-Add-grub_qdprintf-grub_dprintf-without-the-file-lin.patch b/10004-Add-grub_qdprintf-grub_dprintf-without-the-file-lin.patch new file mode 100644 index 0000000..d83eeac --- /dev/null +++ b/10004-Add-grub_qdprintf-grub_dprintf-without-the-file-lin.patch @@ -0,0 +1,59 @@ +From 5e50fc35ba1c2f03cc9ccbd6ae2f49dcb0ffd560 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 28 Jun 2015 13:09:58 -0400 +Subject: [PATCH 10004/10006] Add grub_qdprintf() - grub_dprintf() without the + file+line number. + +This just makes copy+paste of our debug loading info easier. + +Signed-off-by: Peter Jones +--- + grub-core/kern/misc.c | 18 ++++++++++++++++++ + include/grub/misc.h | 2 ++ + 2 files changed, 20 insertions(+) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index d7dcd97..8e12a62 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -179,6 +179,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, + } + } + ++void ++grub_qdprintf (const char *condition, const char *fmt, ...) ++{ ++ va_list args; ++ const char *debug = grub_env_get ("debug"); ++ ++ if (! debug) ++ return; ++ ++ if (grub_strword (debug, "all") || grub_strword (debug, condition)) ++ { ++ va_start (args, fmt); ++ grub_vprintf (fmt, args); ++ va_end (args); ++ grub_refresh (); ++ } ++} ++ + #define PREALLOC_SIZE 255 + + int +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 0620814..4cb1ba5 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -326,6 +326,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, + const int line, + const char *condition, + const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5))); ++void EXPORT_FUNC(grub_qdprintf) (const char *condition, ++ const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3))); + int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args); + int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...) + __attribute__ ((format (GNU_PRINTF, 3, 4))); +-- +2.5.0 + diff --git a/10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch b/10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch deleted file mode 100644 index 5b5db09..0000000 --- a/10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 22ba237a041b493cd0b7bb3e1c3fcd0a34dbdc2d Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Sun, 28 Jun 2015 17:57:24 -0400 -Subject: [PATCH 4/6] Don't tell the compiler to do annoying things with -f. - ---- - configure.ac | 34 ++-------------------------------- - 1 file changed, 2 insertions(+), 32 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 8d780e3..5e2529a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -548,8 +548,8 @@ LDFLAGS="$TARGET_LDFLAGS" - LIBS="" - - # debug flags. --TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" --TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" -+TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g3 -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" -+TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g3" - - if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then - TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align" -@@ -809,21 +809,6 @@ if test x"$target_cpu" = xsparc64 ; then - TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax" - fi - --# By default, GCC 4.4 generates .eh_frame sections containing unwind --# information in some cases where it previously did not. GRUB doesn't need --# these and they just use up vital space. Restore the old compiler --# behaviour. --AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ -- CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" -- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -- [grub_cv_cc_fno_dwarf2_cfi_asm=yes], -- [grub_cv_cc_fno_dwarf2_cfi_asm=no]) --]) -- --if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then -- TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" --fi -- - if test x"$target_os" = xcygwin; then - AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [ - CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" -@@ -837,21 +822,6 @@ if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xy - TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" - fi - --# By default, GCC 4.6 generates .eh_frame sections containing unwind --# information in some cases where it previously did not. GRUB doesn't need --# these and they just use up vital space. Restore the old compiler --# behaviour. --AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [ -- CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" -- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], -- [grub_cv_cc_fno_asynchronous_unwind_tables=yes], -- [grub_cv_cc_fno_asynchronous_unwind_tables=no]) --]) -- --if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then -- TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables" --fi -- - AC_ARG_ENABLE([efiemu], - [AS_HELP_STRING([--enable-efiemu], - [build and install the efiemu runtimes (default=guessed)])]) --- -2.4.3 - diff --git a/10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch deleted file mode 100644 index 9843899..0000000 --- a/10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +++ /dev/null @@ -1,59 +0,0 @@ -From fa89f53a982350e80fcabbceb8c7066636b30761 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Sun, 28 Jun 2015 13:09:58 -0400 -Subject: [PATCH 5/6] Add grub_qdprintf() - grub_dprintf() without the - file+line number. - -This just makes copy+paste of our debug loading info easier. - -Signed-off-by: Peter Jones ---- - grub-core/kern/misc.c | 18 ++++++++++++++++++ - include/grub/misc.h | 2 ++ - 2 files changed, 20 insertions(+) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index be6aa63..71f597d 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -178,6 +178,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, - } - } - -+void -+grub_qdprintf (const char *condition, const char *fmt, ...) -+{ -+ va_list args; -+ const char *debug = grub_env_get ("debug"); -+ -+ if (! debug) -+ return; -+ -+ if (grub_strword (debug, "all") || grub_strword (debug, condition)) -+ { -+ va_start (args, fmt); -+ grub_vprintf (fmt, args); -+ va_end (args); -+ grub_refresh (); -+ } -+} -+ - #define PREALLOC_SIZE 255 - - int -diff --git a/include/grub/misc.h b/include/grub/misc.h -index 2a9f87c..da44520 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -326,6 +326,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, - const int line, - const char *condition, - const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5))); -+void EXPORT_FUNC(grub_qdprintf) (const char *condition, -+ const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3))); - int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args); - int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...) - __attribute__ ((format (GNU_PRINTF, 3, 4))); --- -2.4.3 - diff --git a/10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch new file mode 100644 index 0000000..598f254 --- /dev/null +++ b/10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -0,0 +1,192 @@ +From 5dbc4254266d8d8d64d5d2fe2ad02ff200f4a7a6 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 25 Jun 2015 15:11:36 -0400 +Subject: [PATCH 10005/10006] Make a "gdb" dprintf that tells us load + addresses. + +This makes a grub_dprintf() call during platform init and during module +loading that tells us the virtual addresses of the .text and .data +sections of grub-core/kernel.exec and any modules it loads. + +Specifically, it displays them in the gdb "add-symbol-file" syntax, with +the presumption that there's a variable $grubdir that reflects the path +to any such binaries. + +Signed-off-by: Peter Jones +--- + grub-core/kern/dl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ + grub-core/kern/efi/efi.c | 5 +++-- + grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++- + include/grub/efi/efi.h | 2 +- + 4 files changed, 81 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 247cd0a..f29691c 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -457,6 +457,24 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) + return NULL; + } + ++static long ++grub_dl_find_section_index (Elf_Ehdr *e, const char *name) ++{ ++ Elf_Shdr *s; ++ const char *str; ++ unsigned i; ++ ++ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); ++ str = (char *) e + s->sh_offset; ++ ++ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); ++ i < e->e_shnum; ++ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) ++ if (grub_strcmp (str + s->sh_name, name) == 0) ++ return (long)i; ++ return -1; ++} ++ + /* Me, Vladimir Serbinenko, hereby I add this module check as per new + GNU module policy. Note that this license check is informative only. + Modules have to be licensed under GPLv3 or GPLv3+ (optionally +@@ -600,6 +618,38 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + return GRUB_ERR_NONE; + } + ++static void ++grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) ++{ ++ void *text, *data = NULL; ++ long idx; ++ ++ idx = grub_dl_find_section_index (e, ".text"); ++ if (idx < 0) ++ return; ++ ++ text = grub_dl_get_section_addr (mod, idx); ++ if (!text) ++ return; ++ ++ idx = grub_dl_find_section_index (e, ".data"); ++ if (idx >= 0) ++ data = grub_dl_get_section_addr (mod, idx); ++ ++ if (data) ++ grub_qdprintf ("gdb", "add-symbol-file \\\n" ++ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " ++ "\\\n %p -s .data %p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, ++ mod->name, text, data); ++ else ++ grub_qdprintf ("gdb", "add-symbol-file \\\n" ++ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " ++ "\\\n%p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, ++ mod->name, text); ++} ++ + /* Load a module from core memory. */ + grub_dl_t + grub_dl_load_core_noinit (void *addr, grub_size_t size) +@@ -658,6 +708,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) + grub_dprintf ("modules", "module name: %s\n", mod->name); + grub_dprintf ("modules", "init function: %p\n", mod->init); + ++ grub_dl_print_gdb_info (mod, e); ++ + if (grub_dl_add (mod)) + { + grub_dl_unload (mod); +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 101307f..7492f9d 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -274,7 +274,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, + /* Search the mods section from the PE32/PE32+ image. This code uses + a PE32 header, but should work with PE32+ as well. */ + grub_addr_t +-grub_efi_modules_addr (void) ++grub_efi_section_addr (const char *section_name) + { + grub_efi_loaded_image_t *image; + struct grub_pe32_header *header; +@@ -288,6 +288,7 @@ grub_efi_modules_addr (void) + if (! image) + return 0; + ++ + header = image->image_base; + coff_header = &(header->coff_header); + sections +@@ -299,7 +300,7 @@ grub_efi_modules_addr (void) + i < coff_header->num_sections; + i++, section++) + { +- if (grub_strcmp (section->name, "mods") == 0) ++ if (grub_strcmp (section->name, section_name) == 0) + break; + } + +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index a5b6c1d..9939fde 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -59,10 +59,33 @@ grub_efi_env_init (void) + grub_free (envblk_s.buf); + } + ++static void ++grub_efi_print_gdb_info (void) ++{ ++ grub_addr_t text; ++ grub_addr_t data; ++ ++ text = grub_efi_section_addr (".text"); ++ if (!text) ++ return; ++ ++ data = grub_efi_section_addr (".data"); ++ if (data) ++ grub_qdprintf ("gdb", ++ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" ++ "kernel.exec %p -s .data %p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text, (void *)data); ++ else ++ grub_qdprintf ("gdb", ++ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" ++ "kernel.exec %p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text); ++} ++ + void + grub_efi_init (void) + { +- grub_modbase = grub_efi_modules_addr (); ++ grub_modbase = grub_efi_section_addr ("mods"); + /* First of all, initialize the console so that GRUB can display + messages. */ + grub_console_init (); +@@ -74,6 +97,7 @@ grub_efi_init (void) + 0, 0, 0, NULL); + + grub_efi_env_init (); ++ grub_efi_print_gdb_info (); + grub_efidisk_init (); + } + +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 9a2da0e..37d57d8 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -84,7 +84,7 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, + char **device, + char **path); + +-grub_addr_t grub_efi_modules_addr (void); ++grub_addr_t grub_efi_section_addr (const char *section); + + void grub_efi_mm_init (void); + void grub_efi_mm_fini (void); +-- +2.5.0 + diff --git a/10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch deleted file mode 100644 index 0d95328..0000000 --- a/10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 2053c4610482deff681feb96f2637933c44f8f3f Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 25 Jun 2015 15:11:36 -0400 -Subject: [PATCH 6/6] Make a "gdb" dprintf that tells us load addresses. - -This makes a grub_dprintf() call during platform init and during module -loading that tells us the virtual addresses of the .text and .data -sections of grub-core/kernel.exec and any modules it loads. - -Specifically, it displays them in the gdb "add-symbol-file" syntax, with -the presumption that there's a variable $grubdir that reflects the path -to any such binaries. - -Signed-off-by: Peter Jones ---- - grub-core/kern/dl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ - grub-core/kern/efi/efi.c | 5 +++-- - grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++- - include/grub/efi/efi.h | 2 +- - 4 files changed, 81 insertions(+), 4 deletions(-) - -diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 58931fa..82c7abd 100644 ---- a/grub-core/kern/dl.c -+++ b/grub-core/kern/dl.c -@@ -453,6 +453,24 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) - return NULL; - } - -+static long -+grub_dl_find_section_index (Elf_Ehdr *e, const char *name) -+{ -+ Elf_Shdr *s; -+ const char *str; -+ unsigned i; -+ -+ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); -+ str = (char *) e + s->sh_offset; -+ -+ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); -+ i < e->e_shnum; -+ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) -+ if (grub_strcmp (str + s->sh_name, name) == 0) -+ return (long)i; -+ return -1; -+} -+ - /* Me, Vladimir Serbinenko, hereby I add this module check as per new - GNU module policy. Note that this license check is informative only. - Modules have to be licensed under GPLv3 or GPLv3+ (optionally -@@ -593,6 +611,38 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) - return GRUB_ERR_NONE; - } - -+static void -+grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) -+{ -+ void *text, *data = NULL; -+ long idx; -+ -+ idx = grub_dl_find_section_index (e, ".text"); -+ if (idx < 0) -+ return; -+ -+ text = grub_dl_get_section_addr (mod, idx); -+ if (!text) -+ return; -+ -+ idx = grub_dl_find_section_index (e, ".data"); -+ if (idx >= 0) -+ data = grub_dl_get_section_addr (mod, idx); -+ -+ if (data) -+ grub_qdprintf ("gdb", "add-symbol-file \\\n" -+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " -+ "\\\n %p -s .data %p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, -+ mod->name, text, data); -+ else -+ grub_qdprintf ("gdb", "add-symbol-file \\\n" -+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " -+ "\\\n%p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, -+ mod->name, text); -+} -+ - /* Load a module from core memory. */ - grub_dl_t - grub_dl_load_core_noinit (void *addr, grub_size_t size) -@@ -651,6 +701,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) - grub_dprintf ("modules", "module name: %s\n", mod->name); - grub_dprintf ("modules", "init function: %p\n", mod->init); - -+ grub_dl_print_gdb_info (mod, e); -+ - if (grub_dl_add (mod)) - { - grub_dl_unload (mod); -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 95c75d4..d757b2a 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -298,7 +298,7 @@ grub_efi_secure_boot (void) - /* Search the mods section from the PE32/PE32+ image. This code uses - a PE32 header, but should work with PE32+ as well. */ - grub_addr_t --grub_efi_modules_addr (void) -+grub_efi_section_addr (const char *section_name) - { - grub_efi_loaded_image_t *image; - struct grub_pe32_header *header; -@@ -312,6 +312,7 @@ grub_efi_modules_addr (void) - if (! image) - return 0; - -+ - header = image->image_base; - coff_header = &(header->coff_header); - sections -@@ -323,7 +324,7 @@ grub_efi_modules_addr (void) - i < coff_header->num_sections; - i++, section++) - { -- if (grub_strcmp (section->name, "mods") == 0) -+ if (grub_strcmp (section->name, section_name) == 0) - break; - } - -diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index d17d18e..86935c6 100644 ---- a/grub-core/kern/efi/init.c -+++ b/grub-core/kern/efi/init.c -@@ -59,10 +59,33 @@ grub_efi_env_init (void) - grub_free (envblk_s.buf); - } - -+static void -+grub_efi_print_gdb_info (void) -+{ -+ grub_addr_t text; -+ grub_addr_t data; -+ -+ text = grub_efi_section_addr (".text"); -+ if (!text) -+ return; -+ -+ data = grub_efi_section_addr (".data"); -+ if (data) -+ grub_qdprintf ("gdb", -+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" -+ "kernel.exec %p -s .data %p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text, (void *)data); -+ else -+ grub_qdprintf ("gdb", -+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" -+ "kernel.exec %p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text); -+} -+ - void - grub_efi_init (void) - { -- grub_modbase = grub_efi_modules_addr (); -+ grub_modbase = grub_efi_section_addr ("mods"); - /* First of all, initialize the console so that GRUB can display - messages. */ - grub_console_init (); -@@ -74,6 +97,7 @@ grub_efi_init (void) - 0, 0, 0, NULL); - - grub_efi_env_init (); -+ grub_efi_print_gdb_info (); - grub_efidisk_init (); - } - -diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 2245632..6aa0106 100644 ---- a/include/grub/efi/efi.h -+++ b/include/grub/efi/efi.h -@@ -85,7 +85,7 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, - char **device, - char **path); - --grub_addr_t grub_efi_modules_addr (void); -+grub_addr_t grub_efi_section_addr (const char *section); - - void grub_efi_mm_init (void); - void grub_efi_mm_fini (void); --- -2.4.3 - diff --git a/10006-Try-it-in-gentpl-again.patch b/10006-Try-it-in-gentpl-again.patch new file mode 100644 index 0000000..e2798b8 --- /dev/null +++ b/10006-Try-it-in-gentpl-again.patch @@ -0,0 +1,66 @@ +From ede25cf0ee4a6078f21d580f10d62de238b1729b Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 22 Jul 2015 16:09:59 -0400 +Subject: [PATCH 10006/10006] Try it in gentpl again... + +--- + grub-core/Makefile.core.def | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 9fa9790..eed40d2 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -44,6 +44,18 @@ transform_data = { + enable = powerpc_ieee1275; + }; + ++library = { ++ name = kernel_noemu_nodist_symlist.a; ++ noemu_nodist = symlist.c; ++ ia64_efi_cflags = '-fno-builtin -fpic -minline-int-divide-max-throughput -g0'; ++ x86_64_xen_cppflags = '$(CPPFLAGS_XEN) -g0'; ++ i386_xen_cppflags = '$(CPPFLAGS_XEN) -g0'; ++ mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR) -g0'; ++ i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR) -g0'; ++ emu_cflags = '$(CFLAGS_GNULIB) -g0'; ++ emu_cppflags = '$(CPPFLAGS_GNULIB) -g0'; ++}; ++ + kernel = { + name = kernel; + +@@ -133,7 +145,7 @@ kernel = { + noemu = kern/time.c; + noemu = kern/generic/millisleep.c; + +- noemu_nodist = symlist.c; ++ ldadd = kernel_noemu_nodist_symlist.a; + + mips = kern/generic/rtc_get_time_ms.c; + +@@ -350,6 +362,13 @@ program = { + enable = emu; + }; + ++library = { ++ name = emu_nodist_symlist.a; ++ emu_nodist = symlist.c; ++ cflags = '-g0'; ++ cppflags = '-g0'; ++}; ++ + program = { + name = grub-emu-lite; + +@@ -357,6 +376,7 @@ program = { + emu_nodist = symlist.c; + + ldadd = 'kernel.exec$(EXEEXT)'; ++ ldadd = emu_nodist_symlist.a; + ldadd = 'gnulib/libgnu.a $(LIBINTL) $(LIBUTIL) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + + enable = emu; +-- +2.5.0 + diff --git a/do-rebase b/do-rebase index 4e8d92d..d36bdbd 100755 --- a/do-rebase +++ b/do-rebase @@ -21,6 +21,7 @@ if ! git status | grep -q 'nothing to commit, working directory clean' ; then fi releasever="" +amend="" declare -a savedargs while [ $# -gt 0 ]; do @@ -35,6 +36,9 @@ while [ $# -gt 0 ]; do shift releasever=$1 ;; + --amend) + amend="--amend" + ;; *) savedargs[${#savedargs[@]}]="$1" ;; @@ -108,6 +112,12 @@ echo Patch0000: grub-2.02-beta3-to-origin-master.patch > grub.patches for x in $patches ; do echo Patch$(echo ${x} | cut -d- -f1): ${x} >> grub.patches done -rpmdev-bumpspec -c "- Rebased to newer upstream for ${releasever}" grub2.spec +if [ -z "$amend" ]; then + rpmdev-bumpspec -c "- Rebased to newer upstream for ${releasever}" grub2.spec +fi git add 0*.patch grub2.spec grub-2.02-beta3-to-origin-master.patch grub.patches -fedpkg commit -s -c +if [ -z "$amend" ]; then + fedpkg commit -s -c $amend +else + git commit -m "" --amend +fi diff --git a/gitignore b/gitignore index 2b0156a..18ab8e8 100644 --- a/gitignore +++ b/gitignore @@ -58,6 +58,8 @@ grub-emu.exe grub-emu-lite.exe grub_emu_init.c grub_emu_init.h +/grub-file +/grub-file.exe grub-fstest grub-fstest.exe grub_fstest_init.c @@ -66,6 +68,8 @@ grub_func_test grub-install grub-install.exe grub-kbdcomp +/grub-macbless +/grub-macbless.exe grub-macho2img /grub-menulst2cfg /grub-menulst2cfg.exe @@ -120,6 +124,8 @@ grub-shell grub-shell-tester grub-sparc64-setup grub-sparc64-setup.exe +/grub-syslinux2cfg +/grub-syslinux2cfg.exe gzcompress_test hddboot_test help_test @@ -194,6 +200,7 @@ grub-core/modinfo.sh grub-core/*.module grub-core/*.module.exe grub-core/*.pp +grub-core/kernel.img.bin util/bash-completion.d/grub grub-core/gnulib/alloca.h grub-core/gnulib/arg-nonnull.h diff --git a/grub2.spec b/grub2.spec index 259e23c..7ceec8e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -45,7 +45,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 0.27%{?dist} +Release: 0.29%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base @@ -66,16 +66,16 @@ Source7: grub.patches # git checkout debuginfo # git format-patch fedora-23.. Patch10001: 10001-Put-the-correct-.file-directives-in-our-.S-files.patch -Patch10002: 10002-Make-efi-machines-load-an-env-block-from-a-variable.patch -Patch10003: 10003-Make-it-possible-to-enabled-build-id-sha1.patch -#Patch10004: 10004-Don-t-tell-the-compiler-to-do-annoying-things-with-f.patch -Patch10005: 10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch10006: 10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch10002: 10002-Make-it-possible-to-enabled-build-id-sha1.patch +#Patch10003: 10003-Don-t-tell-the-compiler-to-do-annoying-things-with-.patch +Patch10004: 10004-Add-grub_qdprintf-grub_dprintf-without-the-file-lin.patch +Patch10005: 10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +#Patch10006: 10006-Try-it-in-gentpl-again.patch BuildRequires: flex bison binutils python -BuildRequires: pkgconfig(ncurses) xz-devel bzip2-devel +BuildRequires: ncurses-devel xz-devel bzip2-devel BuildRequires: freetype-devel libusb-devel -BuildRequires: pkgconfig(rpm) +BuildRequires: rpm-devel %ifarch %{sparc} x86_64 aarch64 ppc64le # sparc builds need 64 bit glibc-devel - also for 32 bit userland BuildRequires: /usr/lib64/crt1.o glibc-static @@ -111,7 +111,7 @@ provides support for PC BIOS systems. %ifarch %{efiarchs} %package efi -Summary: GRUB for EFI systems +Summary: GRUB for EFI systems. Group: System Environment/Base Requires: %{name}-tools = %{epoch}:%{version}-%{release} Obsoletes: grub2-efi <= 1:2.00-20%{?dist} @@ -136,7 +136,7 @@ provides support for rebuilding your own grub.efi on EFI systems. %endif %package tools -Summary: Support tools for GRUB +Summary: Support tools for GRUB. Group: System Environment/Base Requires: gettext os-prober which file system-logos @@ -147,7 +147,7 @@ file systems, computer architectures and hardware devices. This subpackage provides tools for support of all platforms. %package starfield-theme -Summary: An example theme for GRUB +Summary: An example theme for GRUB. Group: System Environment/Base Requires: system-logos Obsoletes: grub2 <= 1:2.00-20%{?dist} @@ -544,10 +544,16 @@ fi %{_datarootdir}/grub/themes/starfield %changelog +* Thu Apr 07 2016 Peter Jones - 2.02-0.29 +- Fix ppc64 build failure and rebase to newer f24 code. + * Tue Apr 05 2016 pjones - 1:2.02-0.27 - Pull TPM updates from mjg59. Resolves: rhbz#1318067 +* Tue Mar 08 2016 pjones - 1:2.02-0.27 +- Fix aarch64 build problem. + * Fri Mar 04 2016 Peter Jones - 2.02-0.26 - Rebased to newer upstream (grub-2.02-beta3) for fedora-24