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

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gregshpit
Copy link

…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
Author

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

Thanks,

Gregory

@@ -3,7 +3,11 @@
include /usr/share/dpkg/pkg-info.mk

PACKAGE_PRE_NAME := mrvlprestera
ifeq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= 4.19.0-12-2-armmp
Copy link
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


[ -d $BUILDINFO_PATH ] && rm -rf $BUILDINFO_PATH
mkdir -p $BUILDINFO_VERSION_PATH

if [[ $CROSS_BUILD_ENVIRON == y ]]; then
# Copy pre-compiled (cross-compiled) python wheels used in dockers
Copy link
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

@@ -11,10 +11,20 @@ DISTRO=$5
DOCKERFILE_PATH=$(dirname "$DOCKERFILE_TARGE")
BUILDINFO_PATH="${DOCKERFILE_PATH}/buildinfo"
BUILDINFO_VERSION_PATH="${BUILDINFO_PATH}/versions"
if [[ $CROSS_BUILD_ENVIRON == y ]]; then
Copy link
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


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
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
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
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

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
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..

@@ -10,13 +10,39 @@ STG_BRANCH = stg_temp.$(SUFFIX)
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Build the package
pushd ./frr
ifeq ($(CROSS_BUILD_ENVIRON), y)
Copy link
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?

@@ -11,8 +11,17 @@ override_dh_auto_clean:
override_dh_auto_test:
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
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?

Copy link
Contributor

@antony-rheneus antony-rheneus left a comment

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