diff mbox series

[2/4] package/arm-gnu-a-toolchain: new package

Message ID 1581573151-18943-3-git-send-email-sunil@amarulasolutions.com
State Superseded
Headers show
Series Fix ATF v2.2 build for rk3399, add roc-rk3399-pc board | expand

Commit Message

Suniel Mahesh Feb. 13, 2020, 5:52 a.m. UTC
From: Suniel Mahesh <sunil@amarulasolutions.com>

arm trusted firmware requires a bare metal toolchain for its build.
Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
family processors to avoid the following build error.

make[3]: arm-none-eabi-gcc: Command not found

pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
/opt/gcc-arm-none-eabi.

https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
---
 .../arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash   |  3 +++
 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk | 27 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash
 create mode 100644 package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk

Comments

Sergey Matyukevich Feb. 13, 2020, 7:34 a.m. UTC | #1
> arm trusted firmware requires a bare metal toolchain for its build.
> Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> family processors to avoid the following build error.
> 
> make[3]: arm-none-eabi-gcc: Command not found
> 
> pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> /opt/gcc-arm-none-eabi.
> 
> https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> 
> Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
>

Hi,

Could you please clarify why a separate toolchain is required to build
ATF for this platform ? Is there any specific requirements other than
this particular build error ?

Regards,
Sergey
Jagan Teki Feb. 13, 2020, 8:10 a.m. UTC | #2
On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
>
> > arm trusted firmware requires a bare metal toolchain for its build.
> > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> > family processors to avoid the following build error.
> >
> > make[3]: arm-none-eabi-gcc: Command not found
> >
> > pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> > /opt/gcc-arm-none-eabi.
> >
> > https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> >
> > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> >
>
> Hi,
>
> Could you please clarify why a separate toolchain is required to build
> ATF for this platform ? Is there any specific requirements other than
> this particular build error ?

Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
and then environment should have arm32 cross toolchain to make it
build successfully.

I think, Sunil need to write something more on this requirement on
commit message.

Jagan.
Sergey Matyukevich Feb. 13, 2020, 9:20 a.m. UTC | #3
On Thu, Feb 13, 2020 at 01:40:43PM +0530, Jagan Teki wrote:
> On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
> >
> > > arm trusted firmware requires a bare metal toolchain for its build.
> > > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> > > family processors to avoid the following build error.
> > >
> > > make[3]: arm-none-eabi-gcc: Command not found
> > >
> > > pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> > > /opt/gcc-arm-none-eabi.
> > >
> > > https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> > >
> > > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > >
> >
> > Hi,
> >
> > Could you please clarify why a separate toolchain is required to build
> > ATF for this platform ? Is there any specific requirements other than
> > this particular build error ?
> 
> Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> and then environment should have arm32 cross toolchain to make it
> build successfully.
> 
> I think, Sunil need to write something more on this requirement on
> commit message.

Well, I mean that other ATF firmwares can be built with standard buildroot
toolchain. I guess this is the case for Rockchip ATF as well. You just need
to specify available toolchain using environment variable or something.
In the worst case, some patch modifing Makefiles in Rockchip ATF
source tree is needed.

Regards,
Sergey
Jagan Teki Feb. 13, 2020, 9:43 a.m. UTC | #4
On Thu, Feb 13, 2020 at 2:50 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
>
> On Thu, Feb 13, 2020 at 01:40:43PM +0530, Jagan Teki wrote:
> > On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
> > >
> > > > arm trusted firmware requires a bare metal toolchain for its build.
> > > > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm Cortex-A
> > > > family processors to avoid the following build error.
> > > >
> > > > make[3]: arm-none-eabi-gcc: Command not found
> > > >
> > > > pre-built bate metal ARM GNU-A toolchain installs into the host file system folder
> > > > /opt/gcc-arm-none-eabi.
> > > >
> > > > https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> > > >
> > > > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > > >
> > >
> > > Hi,
> > >
> > > Could you please clarify why a separate toolchain is required to build
> > > ATF for this platform ? Is there any specific requirements other than
> > > this particular build error ?
> >
> > Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> > and then environment should have arm32 cross toolchain to make it
> > build successfully.
> >
> > I think, Sunil need to write something more on this requirement on
> > commit message.
>
> Well, I mean that other ATF firmwares can be built with standard buildroot
> toolchain. I guess this is the case for Rockchip ATF as well. You just need
> to specify available toolchain using environment variable or something.
> In the worst case, some patch modifing Makefiles in Rockchip ATF
> source tree is needed.

It is a known requirement that rockchip rk3399 AFT would require arm32
toolchain as well. For testing, if you try to build ATF manually w/o
the environment has arm32 toolchain, build would fail. Since it is not
supported earlier, Thomas has reverted rk3399 boards in previous
release. This is something similar to "32-bit code generation for
Armv8 targets" in this thread [1].

[1] http://lists.busybox.net/pipermail/buildroot/2019-February/242453.html

Jagan.
Suniel Mahesh Feb. 13, 2020, 10:01 a.m. UTC | #5
On Thu, Feb 13, 2020 at 2:50 PM Sergey Matyukevich <geomatsi@gmail.com>
wrote:

> On Thu, Feb 13, 2020 at 01:40:43PM +0530, Jagan Teki wrote:
> > On Thu, Feb 13, 2020 at 1:04 PM Sergey Matyukevich <geomatsi@gmail.com>
> wrote:
> > >
> > > > arm trusted firmware requires a bare metal toolchain for its build.
> > > > Add pre-built cross-compilation ARM-A bare metal toolchain for Arm
> Cortex-A
> > > > family processors to avoid the following build error.
> > > >
> > > > make[3]: arm-none-eabi-gcc: Command not found
> > > >
> > > > pre-built bate metal ARM GNU-A toolchain installs into the host file
> system folder
> > > > /opt/gcc-arm-none-eabi.
> > > >
> > > >
> https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
> > > >
> > > > Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
> > > >
> > >
> > > Hi,
> > >
> > > Could you please clarify why a separate toolchain is required to build
> > > ATF for this platform ? Is there any specific requirements other than
> > > this particular build error ?
> >
> > Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> > and then environment should have arm32 cross toolchain to make it
> > build successfully.
> >
> > I think, Sunil need to write something more on this requirement on
> > commit message.
>
> Well, I mean that other ATF firmwares can be built with standard buildroot
> toolchain. I guess this is the case for Rockchip ATF as well. You just need
> to specify available toolchain using environment variable or something.
> In the worst case, some patch modifing Makefiles in Rockchip ATF
> source tree is needed.
>

One of the requirements to build ATF is to have Baremetal GNU GCC tools.
This is stated in
ATF documentation (ATF/docs/getting_started/user-guide.rst - section Tools)

Suniel

>
> Regards,
> Sergey
>
Thomas Petazzoni Feb. 14, 2020, 4:17 a.m. UTC | #6
On Thu, 13 Feb 2020 12:20:05 +0300
Sergey Matyukevich <geomatsi@gmail.com> wrote:

> > > Could you please clarify why a separate toolchain is required to build
> > > ATF for this platform ? Is there any specific requirements other than
> > > this particular build error ?  
> > 
> > Rockchip rk3399 has cortex-m0 and these changes are build during ATF.
> > and then environment should have arm32 cross toolchain to make it
> > build successfully.
> > 
> > I think, Sunil need to write something more on this requirement on
> > commit message.  
> 
> Well, I mean that other ATF firmwares can be built with standard buildroot
> toolchain. I guess this is the case for Rockchip ATF as well. You just need
> to specify available toolchain using environment variable or something.
> In the worst case, some patch modifing Makefiles in Rockchip ATF
> source tree is needed.

No, this is not correct. Depending on the platform, ATF may include
code that runs on ARM32 co-processors, and ARM32 code cannot be built
with an ARM64 toolchain.

Best regards,

Thomas
Thomas Petazzoni Feb. 14, 2020, 4:19 a.m. UTC | #7
On Thu, 13 Feb 2020 15:31:59 +0530
Sunil Kumar Mahesh <sunil@amarulasolutions.com> wrote:

> One of the requirements to build ATF is to have Baremetal GNU GCC tools.
> This is stated in
> ATF documentation (ATF/docs/getting_started/user-guide.rst - section Tools)

No, the problem is not to have access to baremetal GC tools. On most
platforms we built ATF with a non-bare metal toolchain, and this works
just fine.

What justifies adding this toolchain is that the target platform is
ARM64, but ATF needs to be built bits of code for some ARM32
co-processor, and you can't build ARM32 code with an ARM64 toolchain.

Since all we need for ARM32 is to build bare-metal code, we use a
bare-metal ARM32 toolchain for that. But everything else in ATF will be
built by the regular non-bare-metal ARM64 toolchain built by Buildroot.

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash
new file mode 100644
index 0000000..aa0a23a
--- /dev/null
+++ b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.hash
@@ -0,0 +1,3 @@ 
+# Locally calculated
+#sha256 bb17109f0ee697254a5d4ae6e5e01440e3ea8f0277f2e8169bf95d07c7d5fe69 gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
+sha256 ac952d89ae0fc3543e81099e7d34917efc621f5def112eee843fd1ce755eca8c  gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz
diff --git a/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk
new file mode 100644
index 0000000..74e0bee
--- /dev/null
+++ b/package/arm-gnu-a-toolchain/arm-gnu-a-toolchain.mk
@@ -0,0 +1,27 @@ 
+################################################################################
+#
+# arm-gnu-a-toolchain
+#
+################################################################################
+
+ARM_GNU_A_TOOLCHAIN_SITE = https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel
+ARM_GNU_A_TOOLCHAIN_VERSION = 9.2-2019.12
+ARM_GNU_A_TOOLCHAIN_SOURCE = gcc-arm-$(ARM_GNU_A_TOOLCHAIN_VERSION)-x86_64-arm-none-eabi.tar.xz
+ARM_GNU_A_TOOLCHAIN_LICENSE = GPL-3.0+
+ARM_GNU_A_TOOLCHAIN_LICENSE_FILES =
+
+HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR = $(HOST_DIR)/opt/gcc-arm-none-eabi 
+
+define HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_CMDS
+    rm -rf $(HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR)
+    mkdir -p $(HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR)
+    cp -rf $(@D)/* $(HOST_ARM_GNU_A_TOOLCHAIN_INSTALL_DIR)
+
+    cd $(HOST_DIR)/bin && \
+	for i in $(HOST_DIR)/opt/gcc-arm-none-eabi/bin/*; do \
+        ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
+    done
+
+endef
+
+$(eval $(host-generic-package))