Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 21, 2021

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.

@@ -3,7 +3,11 @@ from distutils.command.build_ext import build_ext
from distutils.sysconfig import customize_compiler
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 <marvell@cpss-build3.marvell.com>
@@ -79,7 +79,11 @@ AC_ARG_ENABLE(redis-test,
esac],[rtest=false])
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