Skip to content

Ported Marvell armhf build on amd64 host for debian buster to use cross-comp…#852

Merged
kcudnik merged 1 commit intosonic-net:masterfrom
gregshpit:master
Jul 21, 2021
Merged

Ported Marvell armhf build on amd64 host for debian buster to use cross-comp…#852
kcudnik merged 1 commit intosonic-net:masterfrom
gregshpit:master

Conversation

@gregshpit
Copy link
Contributor

…ilation instead of qemu emulation

…ilation instead of qemu emulation

Motivation:
Current armhf Sonic build on amd64 host uses qemu emulation. Due to the nature of the emulation it takes a very long time, about 22-24 hours to complete the build. The change I did to improve the building time ports Sonic armhf build on amd64 host for Marvell platform for debian buster to use cross-compilation on arm64 host for armhf target. The overall Sonic armhf building time using cross-compilation is about 6 hours.

The Sonic configure and build for the armhf cross-compilation is as following:
NOJESSIE=1 NOSTRETCH=1 BLDENV=buster CROSS_BLDENV=1 make configure PLATFORM=marvell-armhf PLATFORM_ARCH=armhf
NOJESSIE=1 NOSTRETCH=1 BLDENV=buster CROSS_BLDENV=1 make target/sonic-marvell-armhf.bin

Sonic module should check if $CROSS_BUILD_ENVIRON is 'y' to make sure that it is cross-compilation build.

@ghost
Copy link

ghost commented Jul 1, 2021

CLA assistant check
All CLA requirements met.

import os

os.environ["CC"] = "g++"
if "CROSS_BUILD_ENVIRON" in os.environ and os.environ["CROSS_BUILD_ENVIRON"] == "y":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please refer to my comment opencomputeproject/SAI#1267 (comment)

…ilation instead of qemu emulation

Signed-off-by: marvell <[email protected]>
AM_CONDITIONAL(RTEST, test x$rtest = xtrue)

AM_CONDITIONAL(ARCH64, test `getconf LONG_BIT` = "64")
if test x$CONFIGURED_ARCH = xarmhf && test x$CROSS_BUILD_ENVIRON = xy; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about this one ? CROSS_BUILD_ENVIRON ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know exactly how to fix it. We can't run getconf on host machine to determine ARCH64 of the target machine. Do you want me to pass ARCH64 env. variable and check if it is already defined then do nothing otherwise test getconf ? Any other suggestion ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not that familiar with proper way to pass cross compiling flags and whether that approach will be suitable for sonic, are you the only one working on this? maybe this would require some broader audience ?
i found this example for kernel https://www.centennialsoftwaresolutions.com/post/stop-typing-make-arch-arm-cross_compile-arm-linux-gnueabi-o-when-building-the-linux-kernel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working alone, but Antony Rheneus is helping me. What specifically is not good in the current confugure.ac code ? That CONFIGURED_ARCH and CROSS_BUILD_ENVIRON variables from Sonic are exposed ? That it is not generic solution for cross-compilation ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing wrong, just wondering that there should be already established some common way to crosscompile in makefiles

@kcudnik kcudnik merged commit 00ccc95 into sonic-net:master Jul 21, 2021
pettershao-ragilenetworks pushed a commit to pettershao-ragilenetworks/sonic-sairedis that referenced this pull request Nov 18, 2022
…ilation instead of qemu emulation (sonic-net#852)

Current armhf Sonic build on amd64 host uses qemu emulation. Due to the nature of the emulation it takes a very long time, about 22-24 hours to complete the build. The change I did to improve the building time ports Sonic armhf build on amd64 host for Marvell platform for debian buster to use cross-compilation on arm64 host for armhf target. The overall Sonic armhf building time using cross-compilation is about 6 hours.

The Sonic configure and build for the armhf cross-compilation is as following:
NOJESSIE=1 NOSTRETCH=1 BLDENV=buster CROSS_BLDENV=1 make configure PLATFORM=marvell-armhf PLATFORM_ARCH=armhf
NOJESSIE=1 NOSTRETCH=1 BLDENV=buster CROSS_BLDENV=1 make target/sonic-marvell-armhf.bin

Sonic module should check if $CROSS_BUILD_ENVIRON is 'y' to make sure that it is cross-compilation build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants