Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WPgLX-0007n8-Ll for mharc-grub-devel@gnu.org; Mon, 17 Mar 2014 18:49:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPfpA-00009b-Bv for grub-devel@gnu.org; Mon, 17 Mar 2014 18:16:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPfp0-0000Q3-C8 for grub-devel@gnu.org; Mon, 17 Mar 2014 18:16:00 -0400 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:57279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPfp0-0000Pb-4t for grub-devel@gnu.org; Mon, 17 Mar 2014 18:15:50 -0400 Received: by mail-wi0-f178.google.com with SMTP id bs8so2020738wib.11 for ; Mon, 17 Mar 2014 15:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=56i97jKpEelvP8JUHkqbLsPJHg1CVqL5y5jNXdPtwk4=; b=LSxvP6Z3aOvA74tw1svaE/m9zyYN6Z8IJqn3JEkW1hI6b/DldIZUB3cj7uBP9VdUZt E3kL68/vCsEj5EDJVhlnmSMmuhgPIKF8NnugYF6plTAa7YgvLMKkQzRwIj66Mh0GA7/6 piV7xjOlEWMGPr4xNy/3sr32u0AFdZnfA9QEkrDg6Ea/rLhgX8n42Z2f2eIN26sQsOxB ZgPEFMg+QzrgFcuIePUTi/p9LOZFi/jMsJSweLQZ8xgaDGpS3nGeAvDuHv68VduJI5Bb lw7tBYTR29g5uiddCZGTGiOfe1GxixPxTHEuTuO5ALw8V+ve65xq/3GzPPVJYHbBXzlU TrwA== X-Received: by 10.180.219.44 with SMTP id pl12mr11617069wic.12.1395094548785; Mon, 17 Mar 2014 15:15:48 -0700 (PDT) Received: from localhost.localdomain ([89.101.39.53]) by mx.google.com with ESMTPSA id t5sm41815216wjw.15.2014.03.17.15.15.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Mar 2014 15:15:47 -0700 (PDT) From: Piotr Krysiuk To: grub-devel@gnu.org Subject: [PATCH] Unable to boot very old Linux kernels Date: Mon, 17 Mar 2014 22:15:13 +0000 Message-Id: <1395094513-29201-1-git-send-email-piotras@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::232 Cc: Piotr Krysiuk X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Mar 2014 22:49:26 -0000 Hi, I occasionally need to boot a very old Linux kernel. This works fine with old versions of GRUB, from before relocator was introduced. However the kernel cannot be started by recent versions of GRUB - machine simply restarts as soon as GRUB passes control to Linux. As mentioned above this affects very old Linux only, so very few users (if any) would care. But as I have a patch, here it is. I tracked the issues to code initializing BSS that is used by old Linux kernels. See code following "Clear BSS" on https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/arch/x86_64/boot/compressed/head.S?h=linux-2.6.17.y#n57 AFAIK old Linux kernels do not provide information allowing boot loader to determine end of BSS. As the consequence, current GRUB may place GPT in the area overlapping with BSS sections of old Linux kernels. The location of GPT was changed at the same time when relocator was added, introducing regression. In order to improve compatibility with these old kernels, we could switch back to old strategy and simply place GPT close to end of physical memory. Best regards, Piotr Krysiuk --- ChangeLog | 5 +++++ grub-core/lib/i386/relocator.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 770269c..5a91e5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-03-17 Piotr Krysiuk + + * grub-core/lib/i386/relocator.c: Moved GDT to end of physical memory + to avoid collision with old Linux BSS. + 2014-02-28 Vladimir Serbinenko * include/grub/i386/openbsd_bootarg.h: Add addr and frequency fields. diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c index d2a1b27..523f669 100644 --- a/grub-core/lib/i386/relocator.c +++ b/grub-core/lib/i386/relocator.c @@ -84,7 +84,7 @@ grub_relocator32_boot (struct grub_relocator *rel, err = grub_relocator_alloc_chunk_align (rel, &ch, 0, (0xffffffff - RELOCATOR_SIZEOF (32)) + 1, RELOCATOR_SIZEOF (32), 16, - GRUB_RELOCATOR_PREFERENCE_NONE, + GRUB_RELOCATOR_PREFERENCE_HIGH, avoid_efi_bootservices); if (err) return err; -- 1.7.9.5