diff mbox series

[v3,25/33] tests/docker: Add fedora-win10sdk-cross image

Message ID 20190924210106.27117-26-alex.bennee@linaro.org
State New
Headers show
Series testing/next (docker,tcg, alpha ;-) | expand

Commit Message

Alex Bennée Sept. 24, 2019, 9 p.m. UTC
From: Philippe Mathieu-Daudé <philmd@redhat.com>


To build WHPX (Windows Hypervisor) binaries, we need the WHPX
headers provided by the Windows SDK.

Add a script that fetches the required MSI/CAB files from the
latest SDK (currently 10.0.18362.1).

Headers are accessible under /opt/win10sdk/include.

Set the QEMU_CONFIGURE_OPTS environment variable accordingly,
enabling HAX and WHPX. Due to CPP warnings related to Microsoft
specific #pragmas, we also need to use the '--disable-werror'
configure flag.

Cc: Justin Terry <juterry@microsoft.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20190920113329.16787-3-philmd@redhat.com>
---
 tests/docker/Makefile.include                 |  2 ++
 .../dockerfiles/fedora-win10sdk-cross.docker  | 23 ++++++++++++++++
 tests/docker/dockerfiles/win10sdk-dl.sh       | 27 +++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-win10sdk-cross.docker
 create mode 100755 tests/docker/dockerfiles/win10sdk-dl.sh

-- 
2.20.1

Comments

Philippe Mathieu-Daudé Sept. 25, 2019, 8:27 p.m. UTC | #1
Hi Alex,

On 9/24/19 11:00 PM, Alex Bennée wrote:
> From: Philippe Mathieu-Daudé <philmd@redhat.com>

> 

> To build WHPX (Windows Hypervisor) binaries, we need the WHPX

> headers provided by the Windows SDK.


Justin is checking with his company if this patch is OK with them,
I'd rather wait before merging it:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg646351.html

Can you unqueue this and the next patch (which depends of it) meanwhile
please?

Thanks,

Phil.

> Add a script that fetches the required MSI/CAB files from the

> latest SDK (currently 10.0.18362.1).

> 

> Headers are accessible under /opt/win10sdk/include.

> 

> Set the QEMU_CONFIGURE_OPTS environment variable accordingly,

> enabling HAX and WHPX. Due to CPP warnings related to Microsoft

> specific #pragmas, we also need to use the '--disable-werror'

> configure flag.

> 

> Cc: Justin Terry <juterry@microsoft.com>

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> Message-Id: <20190920113329.16787-3-philmd@redhat.com>

> ---

>  tests/docker/Makefile.include                 |  2 ++

>  .../dockerfiles/fedora-win10sdk-cross.docker  | 23 ++++++++++++++++

>  tests/docker/dockerfiles/win10sdk-dl.sh       | 27 +++++++++++++++++++

>  3 files changed, 52 insertions(+)

>  create mode 100644 tests/docker/dockerfiles/fedora-win10sdk-cross.docker

>  create mode 100755 tests/docker/dockerfiles/win10sdk-dl.sh

> 

> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

> index 3fc7a863e51..e85e73025ba 100644

> --- a/tests/docker/Makefile.include

> +++ b/tests/docker/Makefile.include

> @@ -125,6 +125,8 @@ docker-image-debian-ppc64-cross: docker-image-debian10

>  docker-image-debian-riscv64-cross: docker-image-debian10

>  docker-image-debian-sh4-cross: docker-image-debian10

>  docker-image-debian-sparc64-cross: docker-image-debian10

> +docker-image-fedora-win10sdk-cross: docker-image-fedora

> +docker-image-fedora-win10sdk-cross: EXTRA_FILES:=$(DOCKER_FILES_DIR)/win10sdk-dl.sh

>  

>  docker-image-travis: NOUSER=1

>  

> diff --git a/tests/docker/dockerfiles/fedora-win10sdk-cross.docker b/tests/docker/dockerfiles/fedora-win10sdk-cross.docker

> new file mode 100644

> index 00000000000..55ca933d40d

> --- /dev/null

> +++ b/tests/docker/dockerfiles/fedora-win10sdk-cross.docker

> @@ -0,0 +1,23 @@

> +#

> +# Docker MinGW64 cross-compiler target with WHPX header installed

> +#

> +# This docker target builds on the Fedora 30 base image.

> +#

> +# SPDX-License-Identifier: GPL-2.0-or-later

> +#

> +FROM qemu:fedora

> +

> +RUN dnf install -y \

> +        cabextract \

> +        msitools \

> +        wget

> +

> +# Install WHPX headers from Windows Software Development Kit:

> +# https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

> +ADD win10sdk-dl.sh /usr/local/bin/win10sdk-dl.sh

> +RUN /usr/local/bin/win10sdk-dl.sh

> +

> +ENV QEMU_CONFIGURE_OPTS ${QEMU_CONFIGURE_OPTS} \

> +    --cross-prefix=x86_64-w64-mingw32- \

> +    --extra-cflags=-I/opt/win10sdk/include --disable-werror \

> +    --enable-hax --enable-whpx

> diff --git a/tests/docker/dockerfiles/win10sdk-dl.sh b/tests/docker/dockerfiles/win10sdk-dl.sh

> new file mode 100755

> index 00000000000..1c35c2a2524

> --- /dev/null

> +++ b/tests/docker/dockerfiles/win10sdk-dl.sh

> @@ -0,0 +1,27 @@

> +#!/bin/bash

> +#

> +# Install WHPX headers from Windows Software Development Kit

> +# https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

> +#

> +# SPDX-License-Identifier: GPL-2.0-or-later

> +

> +WINDIR=/opt/win10sdk

> +mkdir -p ${WINDIR}

> +pushd ${WINDIR}

> +# Get the bundle base for Windows SDK v10.0.18362.1

> +BASE_URL=$(curl --silent --include 'http://go.microsoft.com/fwlink/?prd=11966&pver=1.0&plcid=0x409&clcid=0x409&ar=Windows10&sar=SDK&o1=10.0.18362.1' | sed -nE 's_Location: (.*)/\r_\1_p')/Installers

> +# Fetch the MSI containing the headers

> +wget --no-verbose ${BASE_URL}/'Windows SDK Desktop Headers x86-x86_en-us.msi'

> +while true; do

> +    # Fetch all cabinets required by this MSI

> +    CAB_NAME=$(msiextract Windows\ SDK\ Desktop\ Headers\ x86-x86_en-us.msi 3>&1 2>&3 3>&-| sed -nE "s_.*Error opening file $PWD/(.*): No such file or directory_\1_p")

> +    test -z "${CAB_NAME}" && break

> +    wget --no-verbose ${BASE_URL}/${CAB_NAME}

> +done

> +rm *.{cab,msi}

> +mkdir /opt/win10sdk/include

> +# Only keep the WHPX headers

> +for inc in "${WINDIR}/Program Files/Windows Kits/10/Include/10.0.18362.0/um"/WinHv*; do

> +    ln -s "${inc}" /opt/win10sdk/include

> +done

> +popd > /dev/null

>
Alex Bennée Sept. 25, 2019, 9:08 p.m. UTC | #2
Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Hi Alex,

>

> On 9/24/19 11:00 PM, Alex Bennée wrote:

>> From: Philippe Mathieu-Daudé <philmd@redhat.com>

>>

>> To build WHPX (Windows Hypervisor) binaries, we need the WHPX

>> headers provided by the Windows SDK.

>

> Justin is checking with his company if this patch is OK with them,

> I'd rather wait before merging it:

> https://www.mail-archive.com/qemu-devel@nongnu.org/msg646351.html

>

> Can you unqueue this and the next patch (which depends of it) meanwhile

> please?

>


OK, done.

> Thanks,

>

> Phil.

>

>> Add a script that fetches the required MSI/CAB files from the

>> latest SDK (currently 10.0.18362.1).

>>

>> Headers are accessible under /opt/win10sdk/include.

>>

>> Set the QEMU_CONFIGURE_OPTS environment variable accordingly,

>> enabling HAX and WHPX. Due to CPP warnings related to Microsoft

>> specific #pragmas, we also need to use the '--disable-werror'

>> configure flag.

>>

>> Cc: Justin Terry <juterry@microsoft.com>

>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> Message-Id: <20190920113329.16787-3-philmd@redhat.com>

>> ---

>>  tests/docker/Makefile.include                 |  2 ++

>>  .../dockerfiles/fedora-win10sdk-cross.docker  | 23 ++++++++++++++++

>>  tests/docker/dockerfiles/win10sdk-dl.sh       | 27 +++++++++++++++++++

>>  3 files changed, 52 insertions(+)

>>  create mode 100644 tests/docker/dockerfiles/fedora-win10sdk-cross.docker

>>  create mode 100755 tests/docker/dockerfiles/win10sdk-dl.sh

>>

>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

>> index 3fc7a863e51..e85e73025ba 100644

>> --- a/tests/docker/Makefile.include

>> +++ b/tests/docker/Makefile.include

>> @@ -125,6 +125,8 @@ docker-image-debian-ppc64-cross: docker-image-debian10

>>  docker-image-debian-riscv64-cross: docker-image-debian10

>>  docker-image-debian-sh4-cross: docker-image-debian10

>>  docker-image-debian-sparc64-cross: docker-image-debian10

>> +docker-image-fedora-win10sdk-cross: docker-image-fedora

>> +docker-image-fedora-win10sdk-cross: EXTRA_FILES:=$(DOCKER_FILES_DIR)/win10sdk-dl.sh

>>

>>  docker-image-travis: NOUSER=1

>>

>> diff --git a/tests/docker/dockerfiles/fedora-win10sdk-cross.docker b/tests/docker/dockerfiles/fedora-win10sdk-cross.docker

>> new file mode 100644

>> index 00000000000..55ca933d40d

>> --- /dev/null

>> +++ b/tests/docker/dockerfiles/fedora-win10sdk-cross.docker

>> @@ -0,0 +1,23 @@

>> +#

>> +# Docker MinGW64 cross-compiler target with WHPX header installed

>> +#

>> +# This docker target builds on the Fedora 30 base image.

>> +#

>> +# SPDX-License-Identifier: GPL-2.0-or-later

>> +#

>> +FROM qemu:fedora

>> +

>> +RUN dnf install -y \

>> +        cabextract \

>> +        msitools \

>> +        wget

>> +

>> +# Install WHPX headers from Windows Software Development Kit:

>> +# https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

>> +ADD win10sdk-dl.sh /usr/local/bin/win10sdk-dl.sh

>> +RUN /usr/local/bin/win10sdk-dl.sh

>> +

>> +ENV QEMU_CONFIGURE_OPTS ${QEMU_CONFIGURE_OPTS} \

>> +    --cross-prefix=x86_64-w64-mingw32- \

>> +    --extra-cflags=-I/opt/win10sdk/include --disable-werror \

>> +    --enable-hax --enable-whpx

>> diff --git a/tests/docker/dockerfiles/win10sdk-dl.sh b/tests/docker/dockerfiles/win10sdk-dl.sh

>> new file mode 100755

>> index 00000000000..1c35c2a2524

>> --- /dev/null

>> +++ b/tests/docker/dockerfiles/win10sdk-dl.sh

>> @@ -0,0 +1,27 @@

>> +#!/bin/bash

>> +#

>> +# Install WHPX headers from Windows Software Development Kit

>> +# https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

>> +#

>> +# SPDX-License-Identifier: GPL-2.0-or-later

>> +

>> +WINDIR=/opt/win10sdk

>> +mkdir -p ${WINDIR}

>> +pushd ${WINDIR}

>> +# Get the bundle base for Windows SDK v10.0.18362.1

>> +BASE_URL=$(curl --silent --include 'http://go.microsoft.com/fwlink/?prd=11966&pver=1.0&plcid=0x409&clcid=0x409&ar=Windows10&sar=SDK&o1=10.0.18362.1' | sed -nE 's_Location: (.*)/\r_\1_p')/Installers

>> +# Fetch the MSI containing the headers

>> +wget --no-verbose ${BASE_URL}/'Windows SDK Desktop Headers x86-x86_en-us.msi'

>> +while true; do

>> +    # Fetch all cabinets required by this MSI

>> +    CAB_NAME=$(msiextract Windows\ SDK\ Desktop\ Headers\ x86-x86_en-us.msi 3>&1 2>&3 3>&-| sed -nE "s_.*Error opening file $PWD/(.*): No such file or directory_\1_p")

>> +    test -z "${CAB_NAME}" && break

>> +    wget --no-verbose ${BASE_URL}/${CAB_NAME}

>> +done

>> +rm *.{cab,msi}

>> +mkdir /opt/win10sdk/include

>> +# Only keep the WHPX headers

>> +for inc in "${WINDIR}/Program Files/Windows Kits/10/Include/10.0.18362.0/um"/WinHv*; do

>> +    ln -s "${inc}" /opt/win10sdk/include

>> +done

>> +popd > /dev/null

>>



--
Alex Bennée
diff mbox series

Patch

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 3fc7a863e51..e85e73025ba 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -125,6 +125,8 @@  docker-image-debian-ppc64-cross: docker-image-debian10
 docker-image-debian-riscv64-cross: docker-image-debian10
 docker-image-debian-sh4-cross: docker-image-debian10
 docker-image-debian-sparc64-cross: docker-image-debian10
+docker-image-fedora-win10sdk-cross: docker-image-fedora
+docker-image-fedora-win10sdk-cross: EXTRA_FILES:=$(DOCKER_FILES_DIR)/win10sdk-dl.sh
 
 docker-image-travis: NOUSER=1
 
diff --git a/tests/docker/dockerfiles/fedora-win10sdk-cross.docker b/tests/docker/dockerfiles/fedora-win10sdk-cross.docker
new file mode 100644
index 00000000000..55ca933d40d
--- /dev/null
+++ b/tests/docker/dockerfiles/fedora-win10sdk-cross.docker
@@ -0,0 +1,23 @@ 
+#
+# Docker MinGW64 cross-compiler target with WHPX header installed
+#
+# This docker target builds on the Fedora 30 base image.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+FROM qemu:fedora
+
+RUN dnf install -y \
+        cabextract \
+        msitools \
+        wget
+
+# Install WHPX headers from Windows Software Development Kit:
+# https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
+ADD win10sdk-dl.sh /usr/local/bin/win10sdk-dl.sh
+RUN /usr/local/bin/win10sdk-dl.sh
+
+ENV QEMU_CONFIGURE_OPTS ${QEMU_CONFIGURE_OPTS} \
+    --cross-prefix=x86_64-w64-mingw32- \
+    --extra-cflags=-I/opt/win10sdk/include --disable-werror \
+    --enable-hax --enable-whpx
diff --git a/tests/docker/dockerfiles/win10sdk-dl.sh b/tests/docker/dockerfiles/win10sdk-dl.sh
new file mode 100755
index 00000000000..1c35c2a2524
--- /dev/null
+++ b/tests/docker/dockerfiles/win10sdk-dl.sh
@@ -0,0 +1,27 @@ 
+#!/bin/bash
+#
+# Install WHPX headers from Windows Software Development Kit
+# https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+WINDIR=/opt/win10sdk
+mkdir -p ${WINDIR}
+pushd ${WINDIR}
+# Get the bundle base for Windows SDK v10.0.18362.1
+BASE_URL=$(curl --silent --include 'http://go.microsoft.com/fwlink/?prd=11966&pver=1.0&plcid=0x409&clcid=0x409&ar=Windows10&sar=SDK&o1=10.0.18362.1' | sed -nE 's_Location: (.*)/\r_\1_p')/Installers
+# Fetch the MSI containing the headers
+wget --no-verbose ${BASE_URL}/'Windows SDK Desktop Headers x86-x86_en-us.msi'
+while true; do
+    # Fetch all cabinets required by this MSI
+    CAB_NAME=$(msiextract Windows\ SDK\ Desktop\ Headers\ x86-x86_en-us.msi 3>&1 2>&3 3>&-| sed -nE "s_.*Error opening file $PWD/(.*): No such file or directory_\1_p")
+    test -z "${CAB_NAME}" && break
+    wget --no-verbose ${BASE_URL}/${CAB_NAME}
+done
+rm *.{cab,msi}
+mkdir /opt/win10sdk/include
+# Only keep the WHPX headers
+for inc in "${WINDIR}/Program Files/Windows Kits/10/Include/10.0.18362.0/um"/WinHv*; do
+    ln -s "${inc}" /opt/win10sdk/include
+done
+popd > /dev/null