Skip to content

Changes for armhf cross compilation build (instead of using qemu) th…#52

Open
gregshpit wants to merge 3 commits into
Marvell-OpenNOS:masterfrom
gregshpit:master
Open

Changes for armhf cross compilation build (instead of using qemu) th…#52
gregshpit wants to merge 3 commits into
Marvell-OpenNOS:masterfrom
gregshpit:master

Conversation

@gregshpit

Copy link
Copy Markdown

…at reduced building time to about 6 hours

Why I did it

How I did it

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

@gregshpit

Copy link
Copy Markdown
Author

@rdanda, @arheneus
Antony, please review my cross-compilation changes and let me know if they are OK.

Thanks,

Gregory


PACKAGE_PRE_NAME := mrvlprestera
ifeq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= 4.19.0-12-2-armmp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible to use variables from rules/kernel.mk instead hard coding

Comment thread scripts/prepare_docker_buildinfo.sh Outdated
mkdir -p $BUILDINFO_VERSION_PATH

if [[ $CROSS_BUILD_ENVIRON == y ]]; then
# Copy pre-compiled (cross-compiled) python wheels used in dockers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

need to intend the if/fi block

DOCKERFILE_PATH=$(dirname "$DOCKERFILE_TARGE")
BUILDINFO_PATH="${DOCKERFILE_PATH}/buildinfo"
BUILDINFO_VERSION_PATH="${BUILDINFO_PATH}/versions"
if [[ $CROSS_BUILD_ENVIRON == y ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

indent the if/fi blck

Comment thread sonic-slave-buster/Dockerfile.j2 Outdated

COPY ./cross-build-arm-python-reqirements.sh ./
# Cross-compile the heaviest python packages for arm
RUN PATH=/python_virtualenv/env2/bin/:/python_virtualenv/env3/bin/:$PATH CC=$CROSS_CC /bin/bash -c ./cross-build-arm-python-reqirements.sh && ls -l TARGET

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename TARGET to PRE_BIN_TARGET_$(CONFIGUREAD_ARCH) or something which is readable instead more generic

@@ -0,0 +1,35 @@
#!/bin/bash

declare -a pkgs=("grpcio==1.38.0" "grpcio-tools==1.20.0" "m2crypto==0.36.0" "bitarray==1.5.3" "lxml==4.6.3")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where and how you got the versions numbers?
Is there any way it can maintained some where common?

if [ $count != 0 ]
then
tar xvf wheel-download/*.gz -C wheel-download/sources
cd wheel-download/sources/* && CC=$CC LDSHARED="$CC -shared" python3 -u -c "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\ri\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" --verbose bdist_wheel --plat-name linux_armv7l -d ../../../TARGET && cd ../../../

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can use pushdand popd , instead of cd

Comment thread src/sonic-frr/Makefile Outdated
sed -i "s/doc\/manpages/build\/doc\/manpages/g" debian/frr.manpages
sed -i "s/doc\/user\/_build\/texinfo/build\/doc\/user\/_build\/texinfo/g" debian/frr-doc.info

CFLAGS="-I $$CROSS_PKGS_LIB_PATH/perl/5.28.1/CORE/" LDFLAGS=" -L $$CROSS_PKGS_LIB_PATH" CONFIG_SITE=/etc/dpkg-cross/cross-config.$(CONFIGURED_ARCH) LD_LIBRARY_PATH=$(CROSS_LIB_PATH) dpkg-buildpackage -rfakeroot -b -d -us -uc -Ppkg.frr.nortrlib -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Plrease check perl version can be kept at common place..

Comment thread src/sonic-frr/Makefile Outdated
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Build the package
pushd ./frr
ifeq ($(CROSS_BUILD_ENVIRON), y)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you need this for cross?

override_dh_auto_build:
override_dh_auto_install:
ifeq ($(CROSS_BUILD_ENVIRON), y)
make CROSS_COMPILE=$(CROSS_COMPILE) CC=$(CROSS_CC) LD_LIBRARY_PATH=$(CROSS_LIB_PATH) systemd-sonic-generator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why dont you define "CROSS_COMPILE=$(CROSS_COMPILE) CC=$(CROSS_CC) LD_LIBRARY_PATH=$(CROSS_LIB_PATH)" as a make CROSS_FLAGS variable and then

add use it in all debian rules.. without if checks?

@antony-rheneus antony-rheneus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please fix indentation of if/endif blocks

Also update README.md on cross build usage

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