All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve McIntyre <steve@einval.com>
To: Andrei Borzenkov <arvidjaar@gmail.com>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH] Add support for running a 64-bit Linux kernel on a 32-bit EFI
Date: Wed, 28 Jan 2015 23:42:14 +0000	[thread overview]
Message-ID: <20150128234208.GK20325@einval.com> (raw)
In-Reply-To: <20150128064201.644640cc@opensuse.site>

On Wed, Jan 28, 2015 at 06:42:01AM +0300, Andrei Borzenkov wrote:
>В Wed, 28 Jan 2015 00:56:30 +0000
>Steve McIntyre <steve@einval.com> пишет:
>
>> 
>> =====================================================================
>> Some platforms might be capable of running a 64-bit Linux kernel but
>> only use a 32-bit EFI.  To support such systems, it is necessary to
>> work out the size of the firmware rather than just the size of the
>> kernel. To enable that, there is now an extra EFI sysfs file to
>> describe the underlying firmware.  Read that if possible, otherwise
>> fall back to the kernel type as before.
>> 
>> Signed-off-by: Steve McIntyre <steve@einval.com>
>> ---
>>  grub-core/osdep/linux/platform.c |   38 +++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 37 insertions(+), 1 deletion(-)
>> 
>> diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c
>> index 4b9f6ef..5668ae5 100644
>> --- a/grub-core/osdep/linux/platform.c
>> +++ b/grub-core/osdep/linux/platform.c
>> @@ -60,6 +60,42 @@ is_64_kernel (void)
>>    return strcmp (un.machine, "x86_64") == 0;
>>  }
>>  
>> +static int
>> +read_platform_size (void)
>> +{
>> +  FILE *fp;
>> +  char *buf = NULL;
>> +  size_t len = 0;
>> +  int ret = 0;
>> +
>> +  /* Newer kernels can tell us directly about the size of the
>> +   * underlying firmware - let's see if that interface is there. */
>> +  fp = grub_util_fopen ("/sys/firmware/efi/fw_platform_size", "r");
>> +  if (fp != NULL)
>> +  {
>> +    if (getline (&buf, &len, fp) > 0)
>
>size >= 2

Yup.

>> +      {
>> +	if (strncmp (buf, "32", 2) == 0)
>> +	  ret = 32;
>> +	else if (strncmp (buf, "64", 2) == 0)
>> +	  ret = 64;
>> +      }
>> +    free (buf);
>> +    fclose (fp);
>> +  }
>> +
>> +  if (ret == 0)
>> +    /* Unrecognised - fall back to matching the kernel size instead */
>> +    {
>
>I usually prefer comments inside braces and indented accordingly.

OK, cool.

>Could you send it suitable for git am? Mentioning platforms in commit
>message would be useful for reference. BTW, re subject - this is
>about installing 32 bit EFI grub on 64 bit Linux, not running, right?
>It already should be able to run kernel if installed appropriately
>manually.

Correct, yes.

v2 coming shortly.

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
Welcome my son, welcome to the machine.



  reply	other threads:[~2015-01-28 23:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  0:56 [PATCH] Add support for running a 64-bit Linux kernel on a 32-bit EFI Steve McIntyre
2015-01-28  3:42 ` Andrei Borzenkov
2015-01-28 23:42   ` Steve McIntyre [this message]
2015-02-02 16:07     ` Steve McIntyre
2015-01-29  0:42   ` [PATCH] Recognise a 64-bit Linux kernel on a 32-bit EFI firmware Steve McIntyre

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=20150128234208.GK20325@einval.com \
    --to=steve@einval.com \
    --cc=arvidjaar@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.