Bug#775202: Add support for running a 64-bit Linux kernel on a 32-bit EFI

Colin Watson cjwatson at debian.org
Mon Jan 12 15:17:39 UTC 2015


On Mon, Jan 12, 2015 at 03:03:30PM +0000, Steve McIntyre wrote:
> I've got a patch accepted for the kernel to expose the size of the
> underlying UEFI firmware for x86, and Ben's happy to take it for the
> Debian kernel (#775191). I've written and tested a grub patch to match
> (see http://blog.einval.com/2015/01/11#Jessie-EFI_5) which adds
> support for this extra interface. Here it is. I'd appreciate it if we
> can get this in for Jessie, and and of course it'd be lovely if this
> went upstream too as it's generic.

It would be helpful if you could send this to grub-devel yourself.
There'll probably be some minor differences to resolve, but nothing
serious as far as I can see.

> --- a/grub-core/osdep/linux/platform.c	2015-01-10 00:44:06.905703004 +0000
> +++ b/grub-core/osdep/linux/platform.c	2015-01-10 01:25:11.742486599 +0000
> @@ -63,2 +63,2 @@
>    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;
> +
> +  fp = grub_util_fopen ("/sys/firmware/efi/fw_platform_size", "r");
> +  if (! fp)
> +    return 0; /* Can't read, fall through to other methods */

This all looks reasonable enough, but why not "return is_64_kernel () ?
64 : 32;" here?  Then you could simplify
grub_install_get_default_x86_platform to just conditionalise on "if
(read_platform_size () == 64)" and avoid duplication.

Thanks,

-- 
Colin Watson                                       [cjwatson at debian.org]



More information about the Pkg-grub-devel mailing list