mbox series

[v6,0/3] arm64: Support HP Envy X2

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

Message

Alexander Graf Jan. 28, 2019, 1:35 p.m. UTC
I got a new toy recently: 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.

The reason behind that is simple: Its firmware tries to ensure NX protection
flags and can do so only when the code is 4K aligned.

So to maintain compatibility with that device, this patch set just bumps all
PE alignments to 4K always on all efi targets. This way we improve overall
compatibility - there surely will be more devices coming with similar
constraints.

This gets us into alignment with how the MS tools build UEFI applications,
so we should not run into compatibility problems about alignment going forward.

v1 -> v2:

  - Remove explicit device wording from patch
  - Use GRUB_EFI_PAGE_SIZE

v2 -> v3:

  - Apply alignment to all architectures
  - new patch: mkimage: Align efi sections on 4k boundary

v3 -> v4:

  - Reduce everything down to 1 patch which just adapts *all* alignment
    to GRUB_EFI_PAGE_SIZE (4k).

v4 -> v5:

  - Use GRUB_EFI_PAGE_SIZE
  - Add include to have above const defined
  - new patch: mkimage: Clarify file alignment in efi case

v5 -> v6:

  - Change EFIxxHEADER_SIZE macros too
  - Fix comment

Alexander Graf (3):
  mkimage: Use EFI32_HEADER_SIZE define in arm-efi case
  mkimage: Align efi sections on 4k boundary
  mkimage: Clarify file alignment in efi case

 include/grub/efi/pe32.h | 11 +++++++++--
 util/mkimage.c          | 19 +++++++------------
 2 files changed, 16 insertions(+), 14 deletions(-)

-- 
2.12.3


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

Comments

Daniel Kiper Jan. 29, 2019, 10:11 p.m. UTC | #1
On Mon, Jan 28, 2019 at 02:35:26PM +0100, Alexander Graf wrote:
> I got a new toy recently: 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.

>

> The reason behind that is simple: Its firmware tries to ensure NX protection

> flags and can do so only when the code is 4K aligned.

>

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

> PE alignments to 4K always on all efi targets. This way we improve overall

> compatibility - there surely will be more devices coming with similar

> constraints.

>

> This gets us into alignment with how the MS tools build UEFI applications,

> so we should not run into compatibility problems about alignment going forward.

>

> v1 -> v2:

>

>   - Remove explicit device wording from patch

>   - Use GRUB_EFI_PAGE_SIZE

>

> v2 -> v3:

>

>   - Apply alignment to all architectures

>   - new patch: mkimage: Align efi sections on 4k boundary

>

> v3 -> v4:

>

>   - Reduce everything down to 1 patch which just adapts *all* alignment

>     to GRUB_EFI_PAGE_SIZE (4k).

>

> v4 -> v5:

>

>   - Use GRUB_EFI_PAGE_SIZE

>   - Add include to have above const defined

>   - new patch: mkimage: Clarify file alignment in efi case

>

> v5 -> v6:

>

>   - Change EFIxxHEADER_SIZE macros too

>   - Fix comment

>

> Alexander Graf (3):

>   mkimage: Use EFI32_HEADER_SIZE define in arm-efi case

>   mkimage: Align efi sections on 4k boundary

>   mkimage: Clarify file alignment in efi case

>

>  include/grub/efi/pe32.h | 11 +++++++++--

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

>  2 files changed, 16 insertions(+), 14 deletions(-)


Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>


Adding Julien.

Julien, may I ask you to test this patch set on your machine?
This is what I am going to push if you confirm that it works.

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Julien ROBIN Jan. 30, 2019, 2:04 a.m. UTC | #2
Hi,

Happy to give some help, so I tried with and without those patches on 
the current version of Grub available trough Git here : git clone 
git://git.savannah.gnu.org/grub.git

I can confirm that the patch set is working fine with the Asus NovaGo 
TP370QL (same SoC than HP Envy X2, Qualcomm Snapdragon 835) !

It's ok with grub-mkstandalone, also ok with grub-mkrescue on a Debian 
Installer (Buster) - on which kernel, initrd and device-tree are tuned 
for this kind of laptop
And even ok by completely replacing the grub files (efi file, and 
arm64-lib files) on the Ubuntu image available here 
https://github.com/aarch64-laptops/ (I used grub-mkimage, a 
grub-early.cfg file to tell him to find the filesystem by it's UUID).

I'm also able to confirm that without the patch it doesn't work (hangs 
up on the Asus logo) so the patch is clearly doing the difference.

Photos of it working :

  * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021120.jpg
  * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021830.jpg
  * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-024934.jpg

Thanks again, and best regards

Julien ROBIN

On 1/29/19 11:11 PM, Daniel Kiper wrote:
> On Mon, Jan 28, 2019 at 02:35:26PM +0100, Alexander Graf wrote:

>> I got a new toy recently: 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.

>>

>> The reason behind that is simple: Its firmware tries to ensure NX protection

>> flags and can do so only when the code is 4K aligned.

>>

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

>> PE alignments to 4K always on all efi targets. This way we improve overall

>> compatibility - there surely will be more devices coming with similar

>> constraints.

>>

>> This gets us into alignment with how the MS tools build UEFI applications,

>> so we should not run into compatibility problems about alignment going forward.

>>

>> v1 -> v2:

>>

>>    - Remove explicit device wording from patch

>>    - Use GRUB_EFI_PAGE_SIZE

>>

>> v2 -> v3:

>>

>>    - Apply alignment to all architectures

>>    - new patch: mkimage: Align efi sections on 4k boundary

>>

>> v3 -> v4:

>>

>>    - Reduce everything down to 1 patch which just adapts *all* alignment

>>      to GRUB_EFI_PAGE_SIZE (4k).

>>

>> v4 -> v5:

>>

>>    - Use GRUB_EFI_PAGE_SIZE

>>    - Add include to have above const defined

>>    - new patch: mkimage: Clarify file alignment in efi case

>>

>> v5 -> v6:

>>

>>    - Change EFIxxHEADER_SIZE macros too

>>    - Fix comment

>>

>> Alexander Graf (3):

>>    mkimage: Use EFI32_HEADER_SIZE define in arm-efi case

>>    mkimage: Align efi sections on 4k boundary

>>    mkimage: Clarify file alignment in efi case

>>

>>   include/grub/efi/pe32.h | 11 +++++++++--

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

>>   2 files changed, 16 insertions(+), 14 deletions(-)

> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

>

> Adding Julien.

>

> Julien, may I ask you to test this patch set on your machine?

> This is what I am going to push if you confirm that it works.

>

> Daniel
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi,</p>
    <p>Happy to give some help, so I tried with and without those
      patches on the current version of Grub available trough Git here :
      git clone git://git.savannah.gnu.org/grub.git<br>
    </p>
    <p>I can confirm that the patch set is working fine with the Asus
      NovaGo TP370QL (same SoC than HP Envy X2, Qualcomm Snapdragon 835)
      ! <br>
    </p>
    <p>It's ok with grub-mkstandalone, also ok with grub-mkrescue on a
      Debian Installer (Buster) - on which kernel, initrd and
      device-tree are tuned for this kind of laptop<br>
      And even ok by completely replacing the grub files (efi file, and
      arm64-lib files) on the Ubuntu image available here
      <a class="moz-txt-link-freetext" href="https://github.com/aarch64-laptops/">https://github.com/aarch64-laptops/</a> (I used grub-mkimage, a
      grub-early.cfg file to tell him to find the filesystem by it's
      UUID).</p>
    <p>I'm also able to confirm that without the patch it doesn't work
      (hangs up on the Asus logo) so the patch is clearly doing the
      difference.</p>
    <p>Photos of it working :</p>
    <ul>
      <li><a class="moz-txt-link-freetext" href="https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021120.jpg">https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021120.jpg</a></li>
      <li><a class="moz-txt-link-freetext" href="https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021830.jpg">https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021830.jpg</a></li>
      <li><a class="moz-txt-link-freetext" href="https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-024934.jpg">https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-024934.jpg</a><br>
      </li>
    </ul>
    <p>Thanks again, and best regards</p>
    <p>Julien ROBIN<br>
    </p>
    <div class="moz-cite-prefix">On 1/29/19 11:11 PM, Daniel Kiper
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20190129221115.uujczym2nxd7gnbj@tomti.i.net-space.pl">
      <pre class="moz-quote-pre" wrap="">On Mon, Jan 28, 2019 at 02:35:26PM +0100, Alexander Graf wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">I got a new toy recently: 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.

The reason behind that is simple: Its firmware tries to ensure NX protection
flags and can do so only when the code is 4K aligned.

So to maintain compatibility with that device, this patch set just bumps all
PE alignments to 4K always on all efi targets. This way we improve overall
compatibility - there surely will be more devices coming with similar
constraints.

This gets us into alignment with how the MS tools build UEFI applications,
so we should not run into compatibility problems about alignment going forward.

v1 -&gt; v2:

  - Remove explicit device wording from patch
  - Use GRUB_EFI_PAGE_SIZE

v2 -&gt; v3:

  - Apply alignment to all architectures
  - new patch: mkimage: Align efi sections on 4k boundary

v3 -&gt; v4:

  - Reduce everything down to 1 patch which just adapts *all* alignment
    to GRUB_EFI_PAGE_SIZE (4k).

v4 -&gt; v5:

  - Use GRUB_EFI_PAGE_SIZE
  - Add include to have above const defined
  - new patch: mkimage: Clarify file alignment in efi case

v5 -&gt; v6:

  - Change EFIxxHEADER_SIZE macros too
  - Fix comment

Alexander Graf (3):
  mkimage: Use EFI32_HEADER_SIZE define in arm-efi case
  mkimage: Align efi sections on 4k boundary
  mkimage: Clarify file alignment in efi case

 include/grub/efi/pe32.h | 11 +++++++++--
 util/mkimage.c          | 19 +++++++------------
 2 files changed, 16 insertions(+), 14 deletions(-)
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Reviewed-by: Daniel Kiper <a class="moz-txt-link-rfc2396E" href="mailto:daniel.kiper@oracle.com">&lt;daniel.kiper@oracle.com&gt;</a>


Adding Julien.

Julien, may I ask you to test this patch set on your machine?
This is what I am going to push if you confirm that it works.

Daniel
</pre>
    </blockquote>
  </body>
</html>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Daniel Kiper Jan. 31, 2019, 2:59 p.m. UTC | #3
On Wed, Jan 30, 2019 at 03:04:08AM +0100, Julien ROBIN wrote:
> Hi,

>

> Happy to give some help, so I tried with and without those patches on the

> current version of Grub available trough Git here : git clone

> git://git.savannah.gnu.org/grub.git

>

> I can confirm that the patch set is working fine with the Asus NovaGo

> TP370QL (same SoC than HP Envy X2, Qualcomm Snapdragon 835) !

>

> It's ok with grub-mkstandalone, also ok with grub-mkrescue on a Debian

> Installer (Buster) - on which kernel, initrd and device-tree are tuned for

> this kind of laptop

> And even ok by completely replacing the grub files (efi file, and arm64-lib

> files) on the Ubuntu image available here

> https://github.com/aarch64-laptops/ (I used grub-mkimage, a grub-early.cfg

> file to tell him to find the filesystem by it's UUID).

>

> I'm also able to confirm that without the patch it doesn't work (hangs up on

> the Asus logo) so the patch is clearly doing the difference.

>

> Photos of it working :

>

>  * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021120.jpg

>  * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021830.jpg

>  * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-024934.jpg

>

> Thanks again, and best regards


Great! May I add "Tested-by: Julien ROBIN <julien.robin28@free.fr>" to the patches?

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Julien ROBIN Jan. 31, 2019, 9:06 p.m. UTC | #4
Hi, Yes that's fine, I assume that the name of the creator of the patch 
also deserves to appear ;) he did more than me!

Julien

Le 31/01/2019 à 15:59, Daniel Kiper a écrit :
> On Wed, Jan 30, 2019 at 03:04:08AM +0100, Julien ROBIN wrote:
>> Hi,
>>
>> Happy to give some help, so I tried with and without those patches on the
>> current version of Grub available trough Git here : git clone
>> git://git.savannah.gnu.org/grub.git
>>
>> I can confirm that the patch set is working fine with the Asus NovaGo
>> TP370QL (same SoC than HP Envy X2, Qualcomm Snapdragon 835) !
>>
>> It's ok with grub-mkstandalone, also ok with grub-mkrescue on a Debian
>> Installer (Buster) - on which kernel, initrd and device-tree are tuned for
>> this kind of laptop
>> And even ok by completely replacing the grub files (efi file, and arm64-lib
>> files) on the Ubuntu image available here
>> https://github.com/aarch64-laptops/ (I used grub-mkimage, a grub-early.cfg
>> file to tell him to find the filesystem by it's UUID).
>>
>> I'm also able to confirm that without the patch it doesn't work (hangs up on
>> the Asus logo) so the patch is clearly doing the difference.
>>
>> Photos of it working :
>>
>>   * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021120.jpg
>>   * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-021830.jpg
>>   * https://image.noelshack.com/fichiers/2019/05/3/1548813125-img-20190130-024934.jpg
>>
>> Thanks again, and best regards
> Great! May I add "Tested-by: Julien ROBIN <julien.robin28@free.fr>" to the patches?
>
> Daniel
Daniel Kiper Feb. 1, 2019, 10:11 a.m. UTC | #5
On Thu, Jan 31, 2019 at 10:06:25PM +0100, Julien ROBIN wrote:
> Hi, Yes that's fine, I assume that the name of the creator of the patch also


Thanks a lot!

> deserves to appear ;) he did more than me!


Yes, patch will have his SOB.

Daniel

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