All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms
@ 2020-06-10 16:07 Khasim Mohammed
  2020-06-11 12:20 ` Diego Sueiro
  0 siblings, 1 reply; 5+ messages in thread
From: Khasim Mohammed @ 2020-06-10 16:07 UTC (permalink / raw)
  To: meta-arm; +Cc: nd, Khasim Syed Mohammed

EDK2 Project is a modern, feature-rich, cross-platform
firmware development environment for the UEFI specifications
from www.uefi.org.

This patch adds a new recipe to fetch, configure and build
UEFI EDK2 firmware for Arm platforms.

Change-Id: Icfb157e5b68d87accfd4290f522fc529fe4e849e
Issue-Id: PLATFORMS-3134
Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
---
 meta-arm/recipes-bsp/uefi/edk2-firmware.inc   | 81 +++++++++++++++++++
 .../recipes-bsp/uefi/edk2-firmware_git.bb     | 19 +++++
 2 files changed, 100 insertions(+)
 create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware.inc
 create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb

diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware.inc b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
new file mode 100644
index 0000000..7b9327c
--- /dev/null
+++ b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
@@ -0,0 +1,81 @@
+SUMMARY = "UEFI EDK2 Firmware"
+
+PROVIDES += "virtual/uefi-firmware"
+
+EDK2_BUILD_RELEASE   ?= "0"
+EDK2_PLATFORM        ?= "invalid"
+EDK2_PLATFORM_DSC    ?= ""
+EDK2_BIN_NAME        ?= ""
+EDK2_ARCH            ?= ""
+
+EDK2_BUILD_MODE = "${@bb.utils.contains('EDK2_BUILD_RELEASE', '1', 'RELEASE', 'DEBUG', d)}"
+
+DEPENDS += "util-linux-native iasl-native"
+
+inherit python3native
+inherit deploy
+
+B = "${WORKDIR}/build"
+S = "${WORKDIR}/git"
+
+COMPATIBLE_MACHINE ?= "invalid"
+
+LDFLAGS[unexport] = "1"
+
+# No configure
+do_configure[noexec] = "1"
+
+# Set variables as per envsetup
+export GCC5_AARCH64_PREFIX = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
+export PACKAGES_PATH       = "${S}/edk2:${S}/edk2/edk2-platforms"
+export WORKSPACE           = "${S}/edk2"
+export EDK_TOOLS_PATH      = "${WORKSPACE}/BaseTools"
+export PYTHON_COMMAND      = "${PYTHON}"
+export CONF_PATH           = "${WORKSPACE}/Conf"
+
+export BTOOLS_PATH = "${EDK_TOOLS_PATH}/BinWrappers/PosixLike"
+
+python __anonymous() {
+    # If GCC Version is greater than 4 then pass GCC5
+    # set GCC5 by default
+    d.setVar('GCC_VER', 'GCC5')
+
+    # Otherwise pass the corresponding version
+    G = d.getVar('GCCVERSION',True).split(".")
+    gcc_vlist = ['1', '2', '3', '4']
+    if G[0] in gcc_vlist:
+        d.setVar('GCC_VER', 'GCC'+G[0])
+}
+
+do_compile() {
+    # Copy the templates as we don't run envsetup
+    cp ${EDK_TOOLS_PATH}/Conf/build_rule.template ${WORKSPACE}/Conf/build_rule.txt
+    cp ${EDK_TOOLS_PATH}/Conf/tools_def.template ${WORKSPACE}/Conf/tools_def.txt
+    cp ${EDK_TOOLS_PATH}/Conf/target.template ${WORKSPACE}/Conf/target.txt
+
+    # Build basetools
+    oe_runmake -C ${S}/edk2/BaseTools
+
+    PATH="${WORKSPACE}:${BTOOLS_PATH}:$PATH" \
+    "${S}/edk2/BaseTools/BinWrappers/PosixLike/build" \
+       -a "${EDK2_ARCH}" \
+       -b ${EDK2_BUILD_MODE} \
+       -t ${GCC_VER} \
+       -p "${S}/edk2/edk2-platforms/Platform/ARM/${EDK2_PLATFORM_DSC}"
+}
+
+do_install() {
+    install -d ${D}/firmware
+    install "${S}/edk2/Build/${EDK2_PLATFORM}/${EDK2_BUILD_MODE}_${GCC_VER}/FV/${EDK2_BIN_NAME}" "${D}/firmware/uefi.bin"
+}
+
+FILES_${PN} = "/firmware"
+SYSROOT_DIRS += "/firmware"
+# Skip QA check for relocations in .text of elf binaries
+INSANE_SKIP_${PN} = "textrel"
+
+do_deploy() {
+    # Copy the images to deploy directory
+    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
+}
+addtask deploy after do_install
diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
new file mode 100644
index 0000000..4aadc3c
--- /dev/null
+++ b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
@@ -0,0 +1,19 @@
+DESCRIPTION = "UEFI EDK2 Firmware for Arm reference platforms"
+HOMEPAGE = "https://github.com/tianocore/edk2"
+
+LICENSE = "BSD-2-Clause-Patent"
+
+# EDK2
+LIC_FILES_CHKSUM = "file://edk2/License.txt;md5=2b415520383f7964e96700ae12b4570a"
+# EDK2 Platforms
+LIC_FILES_CHKSUM += "file://edk2/edk2-platforms/License.txt;md5=2b415520383f7964e96700ae12b4570a"
+
+SRC_URI ?= "\
+    git://github.com/tianocore/edk2.git;name=edk2;destsuffix=${S}/edk2;nobranch=1 \
+    git://github.com/tianocore/edk2-platforms.git;name=edk2-platforms;destsuffix=${S}/edk2/edk2-platforms;nobranch=1 \
+"
+SRCREV_edk2           ?= "6ff7c838d09224dd4e4c9b5b93152d8db1b19740"
+SRCREV_edk2-platforms ?= "ed4cc8059ec551032f0d8b8c172e9ec19214a638"
+SRCREV_FORMAT         = "edk2_edk2-platforms"
+
+require edk2-firmware.inc
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms
  2020-06-10 16:07 [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms Khasim Mohammed
@ 2020-06-11 12:20 ` Diego Sueiro
  2020-06-11 14:03   ` [meta-arm] " Jon Mason
  0 siblings, 1 reply; 5+ messages in thread
From: Diego Sueiro @ 2020-06-11 12:20 UTC (permalink / raw)
  To: meta-arm

On Wed, Jun 10, 2020 at 05:08 PM, Khasim Mohammed wrote:

>
> EDK2 Project is a modern, feature-rich, cross-platform
> firmware development environment for the UEFI specifications
> from www.uefi.org.
> 
> This patch adds a new recipe to fetch, configure and build
> UEFI EDK2 firmware for Arm platforms.
> 
> Change-Id: Icfb157e5b68d87accfd4290f522fc529fe4e849e
> Issue-Id: PLATFORMS-3134
> Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>

Reviewed-by: Diego Sueiro <diego.sueiro@arm.com>

> ---
>  meta-arm/recipes-bsp/uefi/edk2-firmware.inc   | 81 +++++++++++++++++++
>  .../recipes-bsp/uefi/edk2-firmware_git.bb     | 19 +++++
>  2 files changed, 100 insertions(+)
>  create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware.inc
>  create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> 
> diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> new file mode 100644
> index 0000000..7b9327c
> --- /dev/null
> +++ b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> @@ -0,0 +1,81 @@
> +SUMMARY = "UEFI EDK2 Firmware"
> +
> +PROVIDES += "virtual/uefi-firmware"
> +
> +EDK2_BUILD_RELEASE   ?= "0"
> +EDK2_PLATFORM        ?= "invalid"
> +EDK2_PLATFORM_DSC    ?= ""
> +EDK2_BIN_NAME        ?= ""
> +EDK2_ARCH            ?= ""
> +
> +EDK2_BUILD_MODE = "${@bb.utils.contains('EDK2_BUILD_RELEASE', '1', 'RELEASE',
> 'DEBUG', d)}"
> +
> +DEPENDS += "util-linux-native iasl-native"
> +
> +inherit python3native
> +inherit deploy
> +
> +B = "${WORKDIR}/build"
> +S = "${WORKDIR}/git"
> +
> +COMPATIBLE_MACHINE ?= "invalid"
> +
> +LDFLAGS[unexport] = "1"
> +
> +# No configure
> +do_configure[noexec] = "1"
> +
> +# Set variables as per envsetup
> +export GCC5_AARCH64_PREFIX = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
> +export PACKAGES_PATH       = "${S}/edk2:${S}/edk2/edk2-platforms"
> +export WORKSPACE           = "${S}/edk2"
> +export EDK_TOOLS_PATH      = "${WORKSPACE}/BaseTools"
> +export PYTHON_COMMAND      = "${PYTHON}"
> +export CONF_PATH           = "${WORKSPACE}/Conf"
> +
> +export BTOOLS_PATH = "${EDK_TOOLS_PATH}/BinWrappers/PosixLike"
> +
> +python __anonymous() {
> +    # If GCC Version is greater than 4 then pass GCC5
> +    # set GCC5 by default
> +    d.setVar('GCC_VER', 'GCC5')
> +
> +    # Otherwise pass the corresponding version
> +    G = d.getVar('GCCVERSION',True).split(".")
> +    gcc_vlist = ['1', '2', '3', '4']
> +    if G[0] in gcc_vlist:
> +        d.setVar('GCC_VER', 'GCC'+G[0])
> +}
> +
> +do_compile() {
> +    # Copy the templates as we don't run envsetup
> +    cp ${EDK_TOOLS_PATH}/Conf/build_rule.template
> ${WORKSPACE}/Conf/build_rule.txt
> +    cp ${EDK_TOOLS_PATH}/Conf/tools_def.template
> ${WORKSPACE}/Conf/tools_def.txt
> +    cp ${EDK_TOOLS_PATH}/Conf/target.template ${WORKSPACE}/Conf/target.txt
> +
> +    # Build basetools
> +    oe_runmake -C ${S}/edk2/BaseTools
> +
> +    PATH="${WORKSPACE}:${BTOOLS_PATH}:$PATH" \
> +    "${S}/edk2/BaseTools/BinWrappers/PosixLike/build" \
> +       -a "${EDK2_ARCH}" \
> +       -b ${EDK2_BUILD_MODE} \
> +       -t ${GCC_VER} \
> +       -p "${S}/edk2/edk2-platforms/Platform/ARM/${EDK2_PLATFORM_DSC}"
> +}
> +
> +do_install() {
> +    install -d ${D}/firmware
> +    install
> "${S}/edk2/Build/${EDK2_PLATFORM}/${EDK2_BUILD_MODE}_${GCC_VER}/FV/${EDK2_BIN_NAME}"
> "${D}/firmware/uefi.bin"
> +}
> +
> +FILES_${PN} = "/firmware"
> +SYSROOT_DIRS += "/firmware"
> +# Skip QA check for relocations in .text of elf binaries
> +INSANE_SKIP_${PN} = "textrel"
> +
> +do_deploy() {
> +    # Copy the images to deploy directory
> +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> +}
> +addtask deploy after do_install
> diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> new file mode 100644
> index 0000000..4aadc3c
> --- /dev/null
> +++ b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> @@ -0,0 +1,19 @@
> +DESCRIPTION = "UEFI EDK2 Firmware for Arm reference platforms"
> +HOMEPAGE = "https://github.com/tianocore/edk2"
> +
> +LICENSE = "BSD-2-Clause-Patent"
> +
> +# EDK2
> +LIC_FILES_CHKSUM =
> "file://edk2/License.txt;md5=2b415520383f7964e96700ae12b4570a"
> +# EDK2 Platforms
> +LIC_FILES_CHKSUM +=
> "file://edk2/edk2-platforms/License.txt;md5=2b415520383f7964e96700ae12b4570a"
> +
> +SRC_URI ?= "\
> +   
> git://github.com/tianocore/edk2.git;name=edk2;destsuffix=${S}/edk2;nobranch=1
> \
> +   
> git://github.com/tianocore/edk2-platforms.git;name=edk2-platforms;destsuffix=${S}/edk2/edk2-platforms;nobranch=1
> \
> +"
> +SRCREV_edk2           ?= "6ff7c838d09224dd4e4c9b5b93152d8db1b19740"
> +SRCREV_edk2-platforms ?= "ed4cc8059ec551032f0d8b8c172e9ec19214a638"
> +SRCREV_FORMAT         = "edk2_edk2-platforms"
> +
> +require edk2-firmware.inc
> -- 
> 2.17.1
> 
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-arm] [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms
  2020-06-11 12:20 ` Diego Sueiro
@ 2020-06-11 14:03   ` Jon Mason
  2020-06-11 15:46     ` Khasim Mohammed
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Mason @ 2020-06-11 14:03 UTC (permalink / raw)
  To: Diego Sueiro; +Cc: meta-arm

On Thu, Jun 11, 2020 at 05:20:54AM -0700, Diego Sueiro wrote:
> On Wed, Jun 10, 2020 at 05:08 PM, Khasim Mohammed wrote:
> 
> >
> > EDK2 Project is a modern, feature-rich, cross-platform
> > firmware development environment for the UEFI specifications
> > from www.uefi.org.
> > 
> > This patch adds a new recipe to fetch, configure and build
> > UEFI EDK2 firmware for Arm platforms.
> > 
> > Change-Id: Icfb157e5b68d87accfd4290f522fc529fe4e849e
> > Issue-Id: PLATFORMS-3134
> > Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
> 
> Reviewed-by: Diego Sueiro <diego.sueiro@arm.com>

Applied to the master branch.

Thanks,
Jon

> 
> > ---
> >  meta-arm/recipes-bsp/uefi/edk2-firmware.inc   | 81 +++++++++++++++++++
> >  .../recipes-bsp/uefi/edk2-firmware_git.bb     | 19 +++++
> >  2 files changed, 100 insertions(+)
> >  create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> >  create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> > 
> > diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> > b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> > new file mode 100644
> > index 0000000..7b9327c
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> > @@ -0,0 +1,81 @@
> > +SUMMARY = "UEFI EDK2 Firmware"
> > +
> > +PROVIDES += "virtual/uefi-firmware"
> > +
> > +EDK2_BUILD_RELEASE   ?= "0"
> > +EDK2_PLATFORM        ?= "invalid"
> > +EDK2_PLATFORM_DSC    ?= ""
> > +EDK2_BIN_NAME        ?= ""
> > +EDK2_ARCH            ?= ""
> > +
> > +EDK2_BUILD_MODE = "${@bb.utils.contains('EDK2_BUILD_RELEASE', '1', 'RELEASE',
> > 'DEBUG', d)}"
> > +
> > +DEPENDS += "util-linux-native iasl-native"
> > +
> > +inherit python3native
> > +inherit deploy
> > +
> > +B = "${WORKDIR}/build"
> > +S = "${WORKDIR}/git"
> > +
> > +COMPATIBLE_MACHINE ?= "invalid"
> > +
> > +LDFLAGS[unexport] = "1"
> > +
> > +# No configure
> > +do_configure[noexec] = "1"
> > +
> > +# Set variables as per envsetup
> > +export GCC5_AARCH64_PREFIX = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
> > +export PACKAGES_PATH       = "${S}/edk2:${S}/edk2/edk2-platforms"
> > +export WORKSPACE           = "${S}/edk2"
> > +export EDK_TOOLS_PATH      = "${WORKSPACE}/BaseTools"
> > +export PYTHON_COMMAND      = "${PYTHON}"
> > +export CONF_PATH           = "${WORKSPACE}/Conf"
> > +
> > +export BTOOLS_PATH = "${EDK_TOOLS_PATH}/BinWrappers/PosixLike"
> > +
> > +python __anonymous() {
> > +    # If GCC Version is greater than 4 then pass GCC5
> > +    # set GCC5 by default
> > +    d.setVar('GCC_VER', 'GCC5')
> > +
> > +    # Otherwise pass the corresponding version
> > +    G = d.getVar('GCCVERSION',True).split(".")
> > +    gcc_vlist = ['1', '2', '3', '4']
> > +    if G[0] in gcc_vlist:
> > +        d.setVar('GCC_VER', 'GCC'+G[0])
> > +}
> > +
> > +do_compile() {
> > +    # Copy the templates as we don't run envsetup
> > +    cp ${EDK_TOOLS_PATH}/Conf/build_rule.template
> > ${WORKSPACE}/Conf/build_rule.txt
> > +    cp ${EDK_TOOLS_PATH}/Conf/tools_def.template
> > ${WORKSPACE}/Conf/tools_def.txt
> > +    cp ${EDK_TOOLS_PATH}/Conf/target.template ${WORKSPACE}/Conf/target.txt
> > +
> > +    # Build basetools
> > +    oe_runmake -C ${S}/edk2/BaseTools
> > +
> > +    PATH="${WORKSPACE}:${BTOOLS_PATH}:$PATH" \
> > +    "${S}/edk2/BaseTools/BinWrappers/PosixLike/build" \
> > +       -a "${EDK2_ARCH}" \
> > +       -b ${EDK2_BUILD_MODE} \
> > +       -t ${GCC_VER} \
> > +       -p "${S}/edk2/edk2-platforms/Platform/ARM/${EDK2_PLATFORM_DSC}"
> > +}
> > +
> > +do_install() {
> > +    install -d ${D}/firmware
> > +    install
> > "${S}/edk2/Build/${EDK2_PLATFORM}/${EDK2_BUILD_MODE}_${GCC_VER}/FV/${EDK2_BIN_NAME}"
> > "${D}/firmware/uefi.bin"
> > +}
> > +
> > +FILES_${PN} = "/firmware"
> > +SYSROOT_DIRS += "/firmware"
> > +# Skip QA check for relocations in .text of elf binaries
> > +INSANE_SKIP_${PN} = "textrel"
> > +
> > +do_deploy() {
> > +    # Copy the images to deploy directory
> > +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> > +}
> > +addtask deploy after do_install
> > diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> > b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> > new file mode 100644
> > index 0000000..4aadc3c
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> > @@ -0,0 +1,19 @@
> > +DESCRIPTION = "UEFI EDK2 Firmware for Arm reference platforms"
> > +HOMEPAGE = "https://github.com/tianocore/edk2"
> > +
> > +LICENSE = "BSD-2-Clause-Patent"
> > +
> > +# EDK2
> > +LIC_FILES_CHKSUM =
> > "file://edk2/License.txt;md5=2b415520383f7964e96700ae12b4570a"
> > +# EDK2 Platforms
> > +LIC_FILES_CHKSUM +=
> > "file://edk2/edk2-platforms/License.txt;md5=2b415520383f7964e96700ae12b4570a"
> > +
> > +SRC_URI ?= "\
> > +   
> > git://github.com/tianocore/edk2.git;name=edk2;destsuffix=${S}/edk2;nobranch=1
> > \
> > +   
> > git://github.com/tianocore/edk2-platforms.git;name=edk2-platforms;destsuffix=${S}/edk2/edk2-platforms;nobranch=1
> > \
> > +"
> > +SRCREV_edk2           ?= "6ff7c838d09224dd4e4c9b5b93152d8db1b19740"
> > +SRCREV_edk2-platforms ?= "ed4cc8059ec551032f0d8b8c172e9ec19214a638"
> > +SRCREV_FORMAT         = "edk2_edk2-platforms"
> > +
> > +require edk2-firmware.inc
> > -- 
> > 2.17.1
> > 
> >

> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-arm] [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms
  2020-06-11 14:03   ` [meta-arm] " Jon Mason
@ 2020-06-11 15:46     ` Khasim Mohammed
  2020-06-11 16:21       ` Ross Burton
  0 siblings, 1 reply; 5+ messages in thread
From: Khasim Mohammed @ 2020-06-11 15:46 UTC (permalink / raw)
  To: jdmason, Diego Sueiro; +Cc: meta-arm

[-- Attachment #1: Type: text/plain, Size: 6284 bytes --]

Hi Jon,

Please apply this patch to dunfell branch as well.

Thanks

Regards

Khasim

Sent from Outlook Mobile<https://aka.ms/blhgte>
________________________________
From: meta-arm@lists.yoctoproject.org <meta-arm@lists.yoctoproject.org> on behalf of Jon Mason via lists.yoctoproject.org <jdmason=kudzu.us@lists.yoctoproject.org>
Sent: Thursday, June 11, 2020 7:33:40 PM
To: Diego Sueiro <Diego.Sueiro@arm.com>
Cc: meta-arm@lists.yoctoproject.org <meta-arm@lists.yoctoproject.org>
Subject: Re: [meta-arm] [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms

On Thu, Jun 11, 2020 at 05:20:54AM -0700, Diego Sueiro wrote:
> On Wed, Jun 10, 2020 at 05:08 PM, Khasim Mohammed wrote:
>
> >
> > EDK2 Project is a modern, feature-rich, cross-platform
> > firmware development environment for the UEFI specifications
> > from www.uefi.org<http://www.uefi.org>.
> >
> > This patch adds a new recipe to fetch, configure and build
> > UEFI EDK2 firmware for Arm platforms.
> >
> > Change-Id: Icfb157e5b68d87accfd4290f522fc529fe4e849e
> > Issue-Id: PLATFORMS-3134
> > Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
>
> Reviewed-by: Diego Sueiro <diego.sueiro@arm.com>

Applied to the master branch.

Thanks,
Jon

>
> > ---
> >  meta-arm/recipes-bsp/uefi/edk2-firmware.inc   | 81 +++++++++++++++++++
> >  .../recipes-bsp/uefi/edk2-firmware_git.bb     | 19 +++++
> >  2 files changed, 100 insertions(+)
> >  create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> >  create mode 100644 meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> >
> > diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> > b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> > new file mode 100644
> > index 0000000..7b9327c
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/uefi/edk2-firmware.inc
> > @@ -0,0 +1,81 @@
> > +SUMMARY = "UEFI EDK2 Firmware"
> > +
> > +PROVIDES += "virtual/uefi-firmware"
> > +
> > +EDK2_BUILD_RELEASE   ?= "0"
> > +EDK2_PLATFORM        ?= "invalid"
> > +EDK2_PLATFORM_DSC    ?= ""
> > +EDK2_BIN_NAME        ?= ""
> > +EDK2_ARCH            ?= ""
> > +
> > +EDK2_BUILD_MODE = "${@bb.utils.contains('EDK2_BUILD_RELEASE', '1', 'RELEASE',
> > 'DEBUG', d)}"
> > +
> > +DEPENDS += "util-linux-native iasl-native"
> > +
> > +inherit python3native
> > +inherit deploy
> > +
> > +B = "${WORKDIR}/build"
> > +S = "${WORKDIR}/git"
> > +
> > +COMPATIBLE_MACHINE ?= "invalid"
> > +
> > +LDFLAGS[unexport] = "1"
> > +
> > +# No configure
> > +do_configure[noexec] = "1"
> > +
> > +# Set variables as per envsetup
> > +export GCC5_AARCH64_PREFIX = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
> > +export PACKAGES_PATH       = "${S}/edk2:${S}/edk2/edk2-platforms"
> > +export WORKSPACE           = "${S}/edk2"
> > +export EDK_TOOLS_PATH      = "${WORKSPACE}/BaseTools"
> > +export PYTHON_COMMAND      = "${PYTHON}"
> > +export CONF_PATH           = "${WORKSPACE}/Conf"
> > +
> > +export BTOOLS_PATH = "${EDK_TOOLS_PATH}/BinWrappers/PosixLike"
> > +
> > +python __anonymous() {
> > +    # If GCC Version is greater than 4 then pass GCC5
> > +    # set GCC5 by default
> > +    d.setVar('GCC_VER', 'GCC5')
> > +
> > +    # Otherwise pass the corresponding version
> > +    G = d.getVar('GCCVERSION',True).split(".")
> > +    gcc_vlist = ['1', '2', '3', '4']
> > +    if G[0] in gcc_vlist:
> > +        d.setVar('GCC_VER', 'GCC'+G[0])
> > +}
> > +
> > +do_compile() {
> > +    # Copy the templates as we don't run envsetup
> > +    cp ${EDK_TOOLS_PATH}/Conf/build_rule.template
> > ${WORKSPACE}/Conf/build_rule.txt
> > +    cp ${EDK_TOOLS_PATH}/Conf/tools_def.template
> > ${WORKSPACE}/Conf/tools_def.txt
> > +    cp ${EDK_TOOLS_PATH}/Conf/target.template ${WORKSPACE}/Conf/target.txt
> > +
> > +    # Build basetools
> > +    oe_runmake -C ${S}/edk2/BaseTools
> > +
> > +    PATH="${WORKSPACE}:${BTOOLS_PATH}:$PATH" \
> > +    "${S}/edk2/BaseTools/BinWrappers/PosixLike/build" \
> > +       -a "${EDK2_ARCH}" \
> > +       -b ${EDK2_BUILD_MODE} \
> > +       -t ${GCC_VER} \
> > +       -p "${S}/edk2/edk2-platforms/Platform/ARM/${EDK2_PLATFORM_DSC}"
> > +}
> > +
> > +do_install() {
> > +    install -d ${D}/firmware
> > +    install
> > "${S}/edk2/Build/${EDK2_PLATFORM}/${EDK2_BUILD_MODE}_${GCC_VER}/FV/${EDK2_BIN_NAME}"
> > "${D}/firmware/uefi.bin"
> > +}
> > +
> > +FILES_${PN} = "/firmware"
> > +SYSROOT_DIRS += "/firmware"
> > +# Skip QA check for relocations in .text of elf binaries
> > +INSANE_SKIP_${PN} = "textrel"
> > +
> > +do_deploy() {
> > +    # Copy the images to deploy directory
> > +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> > +}
> > +addtask deploy after do_install
> > diff --git a/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> > b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> > new file mode 100644
> > index 0000000..4aadc3c
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb
> > @@ -0,0 +1,19 @@
> > +DESCRIPTION = "UEFI EDK2 Firmware for Arm reference platforms"
> > +HOMEPAGE = "https://github.com/tianocore/edk2"
> > +
> > +LICENSE = "BSD-2-Clause-Patent"
> > +
> > +# EDK2
> > +LIC_FILES_CHKSUM =
> > "file://edk2/License.txt;md5=2b415520383f7964e96700ae12b4570a"
> > +# EDK2 Platforms
> > +LIC_FILES_CHKSUM +=
> > "file://edk2/edk2-platforms/License.txt;md5=2b415520383f7964e96700ae12b4570a"
> > +
> > +SRC_URI ?= "\
> > +
> > git://github.com/tianocore/edk2.git;name=edk2;destsuffix=${S}/edk2;nobranch=1
> > \
> > +
> > git://github.com/tianocore/edk2-platforms.git;name=edk2-platforms;destsuffix=${S}/edk2/edk2-platforms;nobranch=1
> > \
> > +"
> > +SRCREV_edk2           ?= "6ff7c838d09224dd4e4c9b5b93152d8db1b19740"
> > +SRCREV_edk2-platforms ?= "ed4cc8059ec551032f0d8b8c172e9ec19214a638"
> > +SRCREV_FORMAT         = "edk2_edk2-platforms"
> > +
> > +require edk2-firmware.inc
> > --
> > 2.17.1
> >
> >

>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[-- Attachment #2: Type: text/html, Size: 11569 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-arm] [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms
  2020-06-11 15:46     ` Khasim Mohammed
@ 2020-06-11 16:21       ` Ross Burton
  0 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2020-06-11 16:21 UTC (permalink / raw)
  To: Khasim Mohammed; +Cc: jdmason, Diego Sueiro, meta-arm

On Thu, 11 Jun 2020 at 16:46, Khasim Mohammed <khasim.mohammed@arm.com> wrote:
> Please apply this patch to dunfell branch as well.

Let's not just yet.

| gcc  -o ../bin/DevicePath   DevicePath.o UefiDevicePathLib.o
DevicePathFromText.o  DevicePathUtilities.o -L../libs -lCommon -luuid
| /home/ross/Yocto/build/tmp/hosttools/ld: cannot find -luuid
ERROR: Task (/home/ross/Yocto/meta-arm/meta-arm/recipes-bsp/uefi/edk2-firmware_git.bb:do_compile)
failed with exit code '1'

Note how it's not passing any of the linker flags that would be needed
to compile native code correctly.  This only works for people who it
has worked for because they have util-linux-dev installed on their
host.

oe-core already has a EDK2 recipe of sorts, ovmf_git.bb.  Brace
yourself before looking at this, because the twists it goes through to
build EDK2 correctly is not pretty.  Specifically fix_toolchain() and
friends look relevant.  My hunch is that it's time oe-core has a
common EDK2 include file or skeleton recipe that everyone else can
extend.

Also, can we please stop creating separate bb/inc files unless there's
a good reason.  It just complicates reading the recipe without any
advantages.

Ross

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-11 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 16:07 [PATCH] meta-arm: Add UEFI EDK2 support for Arm platforms Khasim Mohammed
2020-06-11 12:20 ` Diego Sueiro
2020-06-11 14:03   ` [meta-arm] " Jon Mason
2020-06-11 15:46     ` Khasim Mohammed
2020-06-11 16:21       ` Ross Burton

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.