mbox series

[0/2] arm64: Support HP Envy X2

Message ID 20181128143107.37583-1-agraf@suse.de
Headers show
Series arm64: Support HP Envy X2 | expand

Message

Alexander Graf Nov. 28, 2018, 2:31 p.m. UTC
I got a new toy this week: An HP Envy X2 system. This is one of those shiny
new Qualcomm Snapdragon based Windows tablet/notebook hybrid things.

While running Windows on those is actually not a terribly bad experience now
that WSL is out, I would like to see Linux run on those as well in the future.

Unfortunately as far as I'm aware so far nobody was able to run self built
binaries on the built-in UEFI version.

Turns out, it's a problem with aligning the start of the header to 4k. Once
we do that, binaries can be loaded just fine and run.

So to maintain compatibility with that device, this patch set just bumps the
header alignment to 4K always on arm64-efi. This shouldn't hurt too much for
not affected targets and allows us to have a single grub binary that can then
chain load Linux properly.


Alex

Alexander Graf (2):
  mkimage: Simplify header size logic
  mkimage: arm64-efi: Align first section to page

 util/mkimage.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

-- 
2.19.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Leif Lindholm Nov. 29, 2018, 9:02 a.m. UTC | #1
Hi Alex,

On Wed, Nov 28, 2018 at 03:31:05PM +0100, Alexander Graf wrote:
> I got a new toy this week: An HP Envy X2 system. This is one of those shiny

> new Qualcomm Snapdragon based Windows tablet/notebook hybrid things.

> 

> While running Windows on those is actually not a terribly bad experience now

> that WSL is out, I would like to see Linux run on those as well in the future.

> 

> Unfortunately as far as I'm aware so far nobody was able to run self built

> binaries on the built-in UEFI version.

> 

> Turns out, it's a problem with aligning the start of the header to 4k. Once

> we do that, binaries can be loaded just fine and run.


Nice job!
 
> So to maintain compatibility with that device, this patch set just bumps the

> header alignment to 4K always on arm64-efi. This shouldn't hurt too much for

> not affected targets and allows us to have a single grub binary that can then

> chain load Linux properly.


While I really appreciate this work, let's start by trying to get HP
to fix their device. Shouldn't be too hard to get a firmware update
rolled out.

Then we might want to add a test to now-opensource UEFI SCT :)

I'm going to be a bit busy today, but will put together a simpler
proof-of-concept (i.e. edk2 HelloWorld) tomorrow and test on my own
Envy X2, and send it to HP.

Regards,

Leif

> 

> Alex

> 

> Alexander Graf (2):

>   mkimage: Simplify header size logic

>   mkimage: arm64-efi: Align first section to page

> 

>  util/mkimage.c | 8 +++-----

>  1 file changed, 3 insertions(+), 5 deletions(-)

> 

> -- 

> 2.19.0

> 


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Jon Masters Nov. 29, 2018, 10:01 a.m. UTC | #2
On 11/28/18 9:31 AM, Alexander Graf wrote:

> I got a new toy this week: An HP Envy X2 system. This is one of those shiny

> new Qualcomm Snapdragon based Windows tablet/notebook hybrid things.


Cool! I've got one too, and hadn't poked since we looked a while back,
so it'll be great to have a motivation to look at this again soon!

> While running Windows on those is actually not a terribly bad experience now

> that WSL is out, I would like to see Linux run on those as well in the future.

> 

> Unfortunately as far as I'm aware so far nobody was able to run self built

> binaries on the built-in UEFI version.

> 

> Turns out, it's a problem with aligning the start of the header to 4k. Once

> we do that, binaries can be loaded just fine and run.

> 

> So to maintain compatibility with that device, this patch set just bumps the

> header alignment to 4K always on arm64-efi. This shouldn't hurt too much for

> not affected targets and allows us to have a single grub binary that can then

> chain load Linux properly.


This is awesome work. Obvious when you know it, but glad you did the
hard work to figure that out. I'm thinking Leif is right, we should try
to get HP to fix their firmware, especially since we know what is
broken. If Leif ends up needing any help prodding HP, we can try to
figure out who to talk to, or ask some other friends for assistance.

I owe you another tea ;)

Jon.

-- 
Computer Architect | Sent with my Fedora powered laptop

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Alexander Graf Nov. 29, 2018, 5:19 p.m. UTC | #3
On 11/29/2018 11:01 AM, Jon Masters wrote:
> On 11/28/18 9:31 AM, Alexander Graf wrote:

>

>> I got a new toy this week: An HP Envy X2 system. This is one of those shiny

>> new Qualcomm Snapdragon based Windows tablet/notebook hybrid things.

> Cool! I've got one too, and hadn't poked since we looked a while back,

> so it'll be great to have a motivation to look at this again soon!

>

>> While running Windows on those is actually not a terribly bad experience now

>> that WSL is out, I would like to see Linux run on those as well in the future.

>>

>> Unfortunately as far as I'm aware so far nobody was able to run self built

>> binaries on the built-in UEFI version.

>>

>> Turns out, it's a problem with aligning the start of the header to 4k. Once

>> we do that, binaries can be loaded just fine and run.

>>

>> So to maintain compatibility with that device, this patch set just bumps the

>> header alignment to 4K always on arm64-efi. This shouldn't hurt too much for

>> not affected targets and allows us to have a single grub binary that can then

>> chain load Linux properly.

> This is awesome work. Obvious when you know it, but glad you did the

> hard work to figure that out. I'm thinking Leif is right, we should try

> to get HP to fix their firmware, especially since we know what is

> broken. If Leif ends up needing any help prodding HP, we can try to

> figure out who to talk to, or ask some other friends for assistance.


If you manage to convince them (and MS to roll it out automatically), 
that would obviously be the better alternative. They seem to have 
capsule updates on there, so I assume there are channels in place.

While you're at it, could you also poke them to up their FADT to 5.1? 
The fact they're on 5.0 is the main reason Linux doesn't boot.

> I owe you another tea ;)


Oh, memories :). I'll tell you what happened after that tea next time we 
bump into each other ;). Maybe for that I'll need something stronger though.


Cheers,

Alex


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Leif Lindholm Dec. 11, 2018, 12:11 p.m. UTC | #4
On Wed, Nov 28, 2018 at 03:31:05PM +0100, Alexander Graf wrote:
> I got a new toy this week: An HP Envy X2 system. This is one of those shiny

> new Qualcomm Snapdragon based Windows tablet/notebook hybrid things.

> 

> While running Windows on those is actually not a terribly bad experience now

> that WSL is out, I would like to see Linux run on those as well in the future.

> 

> Unfortunately as far as I'm aware so far nobody was able to run self built

> binaries on the built-in UEFI version.

> 

> Turns out, it's a problem with aligning the start of the header to 4k. Once

> we do that, binaries can be loaded just fine and run.

> 

> So to maintain compatibility with that device, this patch set just bumps the

> header alignment to 4K always on arm64-efi. This shouldn't hurt too much for

> not affected targets and allows us to have a single grub binary that can then

> chain load Linux properly.


After further conversations with HP, they appear to be doing this in
order to be able to enforce no-execute properties on the image
header. Also, it seems Visual Studio always does this.

So if you could tweak your set to refer to this aspect rather than a
specific platform, drop mentions of HP Envy from other than the cover
letter, and use EFI_PAGE_SIZE rather than 4096 in 2/2, I think this
change is the right thing to do.

We're going to move to this being the default for AArch64 in EDK2:
https://lists.01.org/pipermail/edk2-devel/2018-December/033708.html

(That the Envy X2 shouldn't hang silently on encountering a
non-4K-aligned code offset is a different story, and an ongoing
conversation.)

/
    Leif

> 

> Alex

> 

> Alexander Graf (2):

>   mkimage: Simplify header size logic

>   mkimage: arm64-efi: Align first section to page

> 

>  util/mkimage.c | 8 +++-----

>  1 file changed, 3 insertions(+), 5 deletions(-)

> 

> -- 

> 2.19.0

> 


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel