grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Unable to boot very old Linux kernels


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] Unable to boot very old Linux kernels
Date: Sun, 23 Mar 2014 20:09:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.3.0

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  <address@hidden>
> +
> +     * 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  <address@hidden>
>  
>       * 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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]