All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] Unable to boot very old Linux kernels
Date: Sun, 23 Mar 2014 20:09:04 +0100	[thread overview]
Message-ID: <532F3150.8020302@gmail.com> (raw)
In-Reply-To: <1395094513-29201-1-git-send-email-piotras@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2651 bytes --]

On 17.03.2014 23:15, Piotr Krysiuk wrote:
> 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.
> 
Top of memory doesn't sound like a right place. Could you try with

>    err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
>  					  (0xa0000 - RELOCATOR_SIZEOF (32)), ...
This will put GDT in low memory

> 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  <piotras@gmail.com>
> +
> +	* 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  <phcoder@gmail.com>
>  
>  	* 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;
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 274 bytes --]

  reply	other threads:[~2014-03-23 19:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 22:15 [PATCH] Unable to boot very old Linux kernels Piotr Krysiuk
2014-03-23 19:09 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2014-03-23 22:50   ` Piotras
2014-03-23 23:16     ` Fwd: " Piotras
2014-03-24  6:45     ` Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532F3150.8020302@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.